Loading api/system-current.txt +5 −1 Original line number Diff line number Diff line Loading @@ -7060,7 +7060,7 @@ package android.provider { method @RequiresPermission(android.Manifest.permission.READ_DEVICE_CONFIG) public static String getString(@NonNull String, @NonNull String, @Nullable String); method public static void removeOnPropertiesChangedListener(@NonNull android.provider.DeviceConfig.OnPropertiesChangedListener); method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static void resetToDefaults(int, @Nullable String); method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static boolean setProperties(@NonNull android.provider.DeviceConfig.Properties); method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static boolean setProperties(@NonNull android.provider.DeviceConfig.Properties) throws android.provider.DeviceConfig.BadConfigException; method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static boolean setProperty(@NonNull String, @NonNull String, @Nullable String, boolean); field public static final String NAMESPACE_ACTIVITY_MANAGER = "activity_manager"; field public static final String NAMESPACE_ACTIVITY_MANAGER_NATIVE_BOOT = "activity_manager_native_boot"; Loading Loading @@ -7092,6 +7092,10 @@ package android.provider { field public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier"; } public static class DeviceConfig.BadConfigException extends java.lang.Exception { ctor public DeviceConfig.BadConfigException(); } public static interface DeviceConfig.OnPropertiesChangedListener { method public void onPropertiesChanged(@NonNull android.provider.DeviceConfig.Properties); } Loading core/java/android/provider/DeviceConfig.java +13 −1 Original line number Diff line number Diff line Loading @@ -578,11 +578,13 @@ public final class DeviceConfig { * none or all of this update is picked up, but never only part of it. * * @param properties the complete set of properties to set for a specific namespace. * @throws BadConfigException if the provided properties are banned by RescueParty. * @return True if the values were set, false otherwise. * @hide */ @SystemApi @RequiresPermission(WRITE_DEVICE_CONFIG) public static boolean setProperties(@NonNull Properties properties) { public static boolean setProperties(@NonNull Properties properties) throws BadConfigException { ContentResolver contentResolver = ActivityThread.currentApplication().getContentResolver(); return Settings.Config.setStrings(contentResolver, properties.getNamespace(), properties.mMap); Loading Loading @@ -798,6 +800,15 @@ public final class DeviceConfig { void onPropertiesChanged(@NonNull Properties properties); } /** * Thrown by {@link #setProperties(Properties)} when a configuration is rejected. This * happens if RescueParty has identified a bad configuration and reset the namespace. * * @hide */ @SystemApi public static class BadConfigException extends Exception {} /** * A mapping of properties to values, as well as a single namespace which they all belong to. * Loading Loading @@ -934,4 +945,5 @@ public final class DeviceConfig { } } } } core/tests/coretests/src/android/provider/DeviceConfigTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -488,7 +488,7 @@ public class DeviceConfigTest { } @Test public void setProperties() { public void setProperties() throws DeviceConfig.BadConfigException { Map<String, String> keyValues = new HashMap<>(); keyValues.put(KEY, VALUE); keyValues.put(KEY2, VALUE2); Loading @@ -514,7 +514,7 @@ public class DeviceConfigTest { } @Test public void setProperties_multipleNamespaces() { public void setProperties_multipleNamespaces() throws DeviceConfig.BadConfigException { Map<String, String> keyValues = new HashMap<>(); keyValues.put(KEY, VALUE); keyValues.put(KEY2, VALUE2); Loading Loading
api/system-current.txt +5 −1 Original line number Diff line number Diff line Loading @@ -7060,7 +7060,7 @@ package android.provider { method @RequiresPermission(android.Manifest.permission.READ_DEVICE_CONFIG) public static String getString(@NonNull String, @NonNull String, @Nullable String); method public static void removeOnPropertiesChangedListener(@NonNull android.provider.DeviceConfig.OnPropertiesChangedListener); method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static void resetToDefaults(int, @Nullable String); method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static boolean setProperties(@NonNull android.provider.DeviceConfig.Properties); method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static boolean setProperties(@NonNull android.provider.DeviceConfig.Properties) throws android.provider.DeviceConfig.BadConfigException; method @RequiresPermission(android.Manifest.permission.WRITE_DEVICE_CONFIG) public static boolean setProperty(@NonNull String, @NonNull String, @Nullable String, boolean); field public static final String NAMESPACE_ACTIVITY_MANAGER = "activity_manager"; field public static final String NAMESPACE_ACTIVITY_MANAGER_NATIVE_BOOT = "activity_manager_native_boot"; Loading Loading @@ -7092,6 +7092,10 @@ package android.provider { field public static final String NAMESPACE_TEXTCLASSIFIER = "textclassifier"; } public static class DeviceConfig.BadConfigException extends java.lang.Exception { ctor public DeviceConfig.BadConfigException(); } public static interface DeviceConfig.OnPropertiesChangedListener { method public void onPropertiesChanged(@NonNull android.provider.DeviceConfig.Properties); } Loading
core/java/android/provider/DeviceConfig.java +13 −1 Original line number Diff line number Diff line Loading @@ -578,11 +578,13 @@ public final class DeviceConfig { * none or all of this update is picked up, but never only part of it. * * @param properties the complete set of properties to set for a specific namespace. * @throws BadConfigException if the provided properties are banned by RescueParty. * @return True if the values were set, false otherwise. * @hide */ @SystemApi @RequiresPermission(WRITE_DEVICE_CONFIG) public static boolean setProperties(@NonNull Properties properties) { public static boolean setProperties(@NonNull Properties properties) throws BadConfigException { ContentResolver contentResolver = ActivityThread.currentApplication().getContentResolver(); return Settings.Config.setStrings(contentResolver, properties.getNamespace(), properties.mMap); Loading Loading @@ -798,6 +800,15 @@ public final class DeviceConfig { void onPropertiesChanged(@NonNull Properties properties); } /** * Thrown by {@link #setProperties(Properties)} when a configuration is rejected. This * happens if RescueParty has identified a bad configuration and reset the namespace. * * @hide */ @SystemApi public static class BadConfigException extends Exception {} /** * A mapping of properties to values, as well as a single namespace which they all belong to. * Loading Loading @@ -934,4 +945,5 @@ public final class DeviceConfig { } } } }
core/tests/coretests/src/android/provider/DeviceConfigTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -488,7 +488,7 @@ public class DeviceConfigTest { } @Test public void setProperties() { public void setProperties() throws DeviceConfig.BadConfigException { Map<String, String> keyValues = new HashMap<>(); keyValues.put(KEY, VALUE); keyValues.put(KEY2, VALUE2); Loading @@ -514,7 +514,7 @@ public class DeviceConfigTest { } @Test public void setProperties_multipleNamespaces() { public void setProperties_multipleNamespaces() throws DeviceConfig.BadConfigException { Map<String, String> keyValues = new HashMap<>(); keyValues.put(KEY, VALUE); keyValues.put(KEY2, VALUE2); Loading