Loading packages/SettingsProvider/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ android_test { // because this test is not an instrumentation test. (because the target runs in the system process.) "SettingsProviderLib", "androidx.test.rules", "device_config_service_flags_java", "flag-junit", "junit", "libaconfig_java_proto_lite", Loading packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java +31 −0 Original line number Diff line number Diff line Loading @@ -357,6 +357,15 @@ final class SettingsState { } } @VisibleForTesting @GuardedBy("mLock") public void addAconfigDefaultValuesFromMap( @NonNull Map<String, Map<String, String>> defaultMap) { if (mNamespaceDefaults != null) { mNamespaceDefaults.putAll(defaultMap); } } @VisibleForTesting @GuardedBy("mLock") public static void loadAconfigDefaultValues(byte[] fileContents, Loading Loading @@ -510,6 +519,28 @@ final class SettingsState { return false; } // Aconfig flags are always boot stable, so we anytime we write one, we staged it to be // applied on reboot. if (Flags.stageAllAconfigFlags() && mNamespaceDefaults != null) { int slashIndex = name.indexOf("/"); boolean stageFlag = isConfigSettingsKey(mKey) && slashIndex != -1 && slashIndex != 0 && slashIndex != name.length(); if (stageFlag) { String namespace = name.substring(0, slashIndex); String flag = name.substring(slashIndex + 1); boolean isAconfig = mNamespaceDefaults.containsKey(namespace) && mNamespaceDefaults.get(namespace).containsKey(name); if (isAconfig) { name = "staged/" + namespace + "*" + flag; } } } final boolean isNameTooLong = name.length() > SettingsState.MAX_LENGTH_PER_STRING; final boolean isValueTooLong = value != null && value.length() > SettingsState.MAX_LENGTH_PER_STRING; Loading packages/SettingsProvider/src/com/android/providers/settings/device_config_service.aconfig +11 −0 Original line number Diff line number Diff line Loading @@ -14,3 +14,14 @@ flag { bug: "311155098" is_fixed_read_only: true } flag { name: "stage_all_aconfig_flags" namespace: "core_experiments_team_internal" description: "Stage _all_ aconfig flags on writes, even local ones." bug: "326598713" is_fixed_read_only: true metadata { purpose: PURPOSE_BUGFIX } } packages/SettingsProvider/test/src/com/android/providers/settings/SettingsStateTest.java +178 −32 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
packages/SettingsProvider/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ android_test { // because this test is not an instrumentation test. (because the target runs in the system process.) "SettingsProviderLib", "androidx.test.rules", "device_config_service_flags_java", "flag-junit", "junit", "libaconfig_java_proto_lite", Loading
packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java +31 −0 Original line number Diff line number Diff line Loading @@ -357,6 +357,15 @@ final class SettingsState { } } @VisibleForTesting @GuardedBy("mLock") public void addAconfigDefaultValuesFromMap( @NonNull Map<String, Map<String, String>> defaultMap) { if (mNamespaceDefaults != null) { mNamespaceDefaults.putAll(defaultMap); } } @VisibleForTesting @GuardedBy("mLock") public static void loadAconfigDefaultValues(byte[] fileContents, Loading Loading @@ -510,6 +519,28 @@ final class SettingsState { return false; } // Aconfig flags are always boot stable, so we anytime we write one, we staged it to be // applied on reboot. if (Flags.stageAllAconfigFlags() && mNamespaceDefaults != null) { int slashIndex = name.indexOf("/"); boolean stageFlag = isConfigSettingsKey(mKey) && slashIndex != -1 && slashIndex != 0 && slashIndex != name.length(); if (stageFlag) { String namespace = name.substring(0, slashIndex); String flag = name.substring(slashIndex + 1); boolean isAconfig = mNamespaceDefaults.containsKey(namespace) && mNamespaceDefaults.get(namespace).containsKey(name); if (isAconfig) { name = "staged/" + namespace + "*" + flag; } } } final boolean isNameTooLong = name.length() > SettingsState.MAX_LENGTH_PER_STRING; final boolean isValueTooLong = value != null && value.length() > SettingsState.MAX_LENGTH_PER_STRING; Loading
packages/SettingsProvider/src/com/android/providers/settings/device_config_service.aconfig +11 −0 Original line number Diff line number Diff line Loading @@ -14,3 +14,14 @@ flag { bug: "311155098" is_fixed_read_only: true } flag { name: "stage_all_aconfig_flags" namespace: "core_experiments_team_internal" description: "Stage _all_ aconfig flags on writes, even local ones." bug: "326598713" is_fixed_read_only: true metadata { purpose: PURPOSE_BUGFIX } }
packages/SettingsProvider/test/src/com/android/providers/settings/SettingsStateTest.java +178 −32 File changed.Preview size limit exceeded, changes collapsed. Show changes