1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.provider;
18 
19 import android.annotation.CallbackExecutor;
20 import android.annotation.NonNull;
21 import android.annotation.Nullable;
22 import android.content.ContentResolver;
23 import android.database.ContentObserver;
24 import android.provider.DeviceConfig;
25 
26 import java.util.concurrent.Executor;
27 import java.util.Map;
28 
29 /**
30  *  @hide
31  */
32 public interface DeviceConfigDataStore {
getAllProperties()33     @NonNull Map<String, String> getAllProperties();
34 
getProperties(@onNull String namespace, @NonNull String ... names)35     @NonNull DeviceConfig.Properties getProperties(@NonNull String namespace, @NonNull String ... names);
36 
setProperties(@onNull DeviceConfig.Properties properties)37     boolean setProperties(@NonNull DeviceConfig.Properties properties) throws
38             DeviceConfig.BadConfigException;
39 
setProperty(@onNull String namespace, @NonNull String name, @Nullable String value, boolean makeDefault)40     boolean setProperty(@NonNull String namespace, @NonNull String name,
41             @Nullable String value, boolean makeDefault);
42 
deleteProperty(@onNull String namespace, @NonNull String name)43     boolean deleteProperty(@NonNull String namespace, @NonNull String name);
44 
resetToDefaults(int resetMode, @Nullable String namespace)45     void resetToDefaults(int resetMode, @Nullable String namespace);
46 
setSyncDisabledMode(int syncDisabledMode)47     void setSyncDisabledMode(int syncDisabledMode);
getSyncDisabledMode()48     int getSyncDisabledMode();
49 
setMonitorCallback( @onNull ContentResolver resolver, @NonNull @CallbackExecutor Executor executor, @NonNull DeviceConfig.MonitorCallback callback)50     void setMonitorCallback(
51             @NonNull ContentResolver resolver,
52             @NonNull @CallbackExecutor Executor executor,
53             @NonNull DeviceConfig.MonitorCallback callback);
54 
clearMonitorCallback(@onNull ContentResolver resolver)55     void clearMonitorCallback(@NonNull ContentResolver resolver);
56 
registerContentObserver(@onNull String namespace, boolean notifyForescendants, ContentObserver contentObserver)57     void registerContentObserver(@NonNull String namespace, boolean notifyForescendants,
58             ContentObserver contentObserver);
59 
unregisterContentObserver(@onNull ContentObserver contentObserver)60     void unregisterContentObserver(@NonNull ContentObserver contentObserver);
61 }
62