diff options
author | Hassan Ali <hsnali@google.com> | 2022-12-16 13:10:26 +0000 |
---|---|---|
committer | Hassan Ali <hsnali@google.com> | 2022-12-16 20:16:25 +0000 |
commit | 6dc2ee552c5cdfcea4ea3ad51a7e9755e84aae97 (patch) | |
tree | cce0d8131e4dc5c4938823a0968485e4e23693aa | |
parent | 8e8f1d26d88b525cb69bfa65527bfd7a3ae71063 (diff) | |
download | ConfigInfrastructure-6dc2ee552c5cdfcea4ea3ad51a7e9755e84aae97.tar.gz |
Add monitor callback interface
Add monitor callback interface which has callback functions for updating
a namespace and accessing device config.
Test: m
Bug: 261723248
Change-Id: Ifd7e61864db5b9df8fc3e0f5dd98d21491ab302b
-rw-r--r-- | framework/api/system-current.txt | 5 | ||||
-rw-r--r-- | framework/java/android/provider/DeviceConfig.java | 31 |
2 files changed, 36 insertions, 0 deletions
diff --git a/framework/api/system-current.txt b/framework/api/system-current.txt index ff12196..0512dc5 100644 --- a/framework/api/system-current.txt +++ b/framework/api/system-current.txt @@ -94,6 +94,11 @@ package android.provider { ctor public DeviceConfig.BadConfigException(); } + public static interface DeviceConfig.MonitorCallback { + method public void onDeviceConfigAccess(@NonNull String, @NonNull String); + method public void onNamespaceUpdate(@NonNull String); + } + public static interface DeviceConfig.OnPropertiesChangedListener { method public void onPropertiesChanged(@NonNull android.provider.DeviceConfig.Properties); } diff --git a/framework/java/android/provider/DeviceConfig.java b/framework/java/android/provider/DeviceConfig.java index 2bb30bd..15fc985 100644 --- a/framework/java/android/provider/DeviceConfig.java +++ b/framework/java/android/provider/DeviceConfig.java @@ -881,6 +881,37 @@ public final class DeviceConfig { private static Map<String, Pair<ContentObserver, Integer>> sNamespaces = new HashMap<>(); private static final String TAG = "DeviceConfig"; + /** + * Interface for monitoring callback functions. + * + * @hide + */ + @SystemApi + public interface MonitorCallback { + /** + * Callback for updating a namespace. + * Reports that a config in the given namespace has changed. + * Isn't called for {@link DeviceConfig#getPublicNamespaces() public namespaces}. + * + * @param updatedNamespace the namespace, within which at least one config has changed. + * @hide + */ + @SystemApi + void onNamespaceUpdate(@NonNull String updatedNamespace); + + /** + * Callback for accessing device config. + * Reports an access to a the given namespace and the given calling package. + * Isn't called for {@link DeviceConfig#getPublicNamespaces() public namespaces}. + * + * @param callingPackage the calling package id. + * @param namespace the namespace, within which one of its config has been accessed. + * @hide + */ + @SystemApi + void onDeviceConfigAccess(@NonNull String callingPackage, @NonNull String namespace); + } + // Should never be invoked private DeviceConfig() { } |