summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dennis Shen <dzshen@google.com> 2025-03-17 14:21:07 +0000
committer Dennis Shen <dzshen@google.com> 2025-03-21 10:01:55 -0700
commit09bc9a73cb3bfffb5b501ff9d578ee73dc367b44 (patch)
treebde71b4af171168a1c1aee2146b0da611f32e0f6
parent0b6e906703df5b9c916fa55ed895c2ac581a7e5d (diff)
Fully deprecate sys prop for aconfig flags
Aconfig new storage system has been enabled for several months. Turning off syncing over to sys prop completely. Test: m Change-Id: Ic575d95f8a6d5d0c654d315f8fd707c055431b91 Merged-In: I51e9cf39b459e651c0bcc5b74445c660a44469f0
-rw-r--r--services/core/java/com/android/server/am/SettingsToPropertiesMapper.java119
1 files changed, 0 insertions, 119 deletions
diff --git a/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java b/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
index ccc0a25633e5..6fd37b78d758 100644
--- a/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
+++ b/services/core/java/com/android/server/am/SettingsToPropertiesMapper.java
@@ -257,8 +257,6 @@ public class SettingsToPropertiesMapper {
private final String[] mDeviceConfigScopes;
- private final String[] mDeviceConfigAconfigScopes;
-
private final ContentResolver mContentResolver;
@VisibleForTesting
@@ -269,7 +267,6 @@ public class SettingsToPropertiesMapper {
mContentResolver = contentResolver;
mGlobalSettings = globalSettings;
mDeviceConfigScopes = deviceConfigScopes;
- mDeviceConfigAconfigScopes = deviceConfigAconfigScopes;
}
@VisibleForTesting
@@ -315,36 +312,6 @@ public class SettingsToPropertiesMapper {
return;
}
setProperty(propertyName, properties.getString(key, null));
-
- // for legacy namespaces, they can also be used for trunk stable
- // purposes. so push flag also into trunk stable slot in sys prop,
- // later all legacy usage will be refactored and the sync to old
- // sys prop slot can be removed.
- String aconfigPropertyName = makeAconfigFlagPropertyName(scope, key);
- if (aconfigPropertyName == null) {
- logErr("unable to construct system property for " + scope + "/"
- + key);
- return;
- }
- setProperty(aconfigPropertyName, properties.getString(key, null));
- }
- });
- }
-
- for (String deviceConfigAconfigScope : mDeviceConfigAconfigScopes) {
- DeviceConfig.addOnPropertiesChangedListener(
- deviceConfigAconfigScope,
- AsyncTask.THREAD_POOL_EXECUTOR,
- (DeviceConfig.Properties properties) -> {
- String scope = properties.getNamespace();
- for (String key : properties.getKeyset()) {
- String aconfigPropertyName = makeAconfigFlagPropertyName(scope, key);
- if (aconfigPropertyName == null) {
- logErr("unable to construct system property for " + scope + "/"
- + key);
- return;
- }
- setProperty(aconfigPropertyName, properties.getString(key, null));
}
});
}
@@ -354,34 +321,6 @@ public class SettingsToPropertiesMapper {
NAMESPACE_REBOOT_STAGING,
newSingleThreadScheduledExecutor(),
(DeviceConfig.Properties properties) -> {
-
- for (String flagName : properties.getKeyset()) {
- String flagValue = properties.getString(flagName, null);
- if (flagName == null || flagValue == null) {
- continue;
- }
-
- int idx = flagName.indexOf(NAMESPACE_REBOOT_STAGING_DELIMITER);
- if (idx == -1 || idx == flagName.length() - 1 || idx == 0) {
- logErr("invalid staged flag: " + flagName);
- continue;
- }
-
- String actualNamespace = flagName.substring(0, idx);
- String actualFlagName = flagName.substring(idx+1);
- String propertyName = "next_boot." + makeAconfigFlagPropertyName(
- actualNamespace, actualFlagName);
-
- if (Flags.supportLocalOverridesSysprops()) {
- // Don't propagate if there is a local override.
- String overrideName = actualNamespace + ":" + actualFlagName;
- if (DeviceConfig.getProperty(NAMESPACE_LOCAL_OVERRIDES, overrideName) != null) {
- continue;
- }
- }
- setProperty(propertyName, flagValue);
- }
-
// send prop stage request to new storage
if (enableAconfigStorageDaemon()) {
stageFlagsInNewStorage(properties);
@@ -397,42 +336,6 @@ public class SettingsToPropertiesMapper {
if (enableAconfigStorageDaemon()) {
setLocalOverridesInNewStorage(properties);
}
-
- if (Flags.supportLocalOverridesSysprops()) {
- String overridesNamespace = properties.getNamespace();
- for (String key : properties.getKeyset()) {
- String realNamespace = key.split(":")[0];
- String realFlagName = key.split(":")[1];
- String aconfigPropertyName =
- makeAconfigFlagPropertyName(realNamespace, realFlagName);
- if (aconfigPropertyName == null) {
- logErr("unable to construct system property for " + realNamespace + "/"
- + key);
- return;
- }
-
- if (properties.getString(key, null) == null) {
- String deviceConfigValue =
- DeviceConfig.getProperty(realNamespace, realFlagName);
- String stagedDeviceConfigValue =
- DeviceConfig.getProperty(NAMESPACE_REBOOT_STAGING,
- realNamespace + "*" + realFlagName);
-
- setProperty(aconfigPropertyName, deviceConfigValue);
- if (stagedDeviceConfigValue == null) {
- setProperty("next_boot." + aconfigPropertyName, deviceConfigValue);
- } else {
- setProperty("next_boot." + aconfigPropertyName, stagedDeviceConfigValue);
- }
- } else {
- // Otherwise, propagate the override to sysprops.
- setProperty(aconfigPropertyName, properties.getString(key, null));
- // If there's a staged value, make sure it's the override value.
- setProperty("next_boot." + aconfigPropertyName,
- properties.getString(key, null));
- }
- }
- }
});
}
@@ -745,28 +648,6 @@ public class SettingsToPropertiesMapper {
sendAconfigdRequests(requests);
}
- /**
- * system property name constructing rule for aconfig flags:
- * "persist.device_config.aconfig_flags.[category_name].[flag_name]".
- * If the name contains invalid characters or substrings for system property name,
- * will return null.
- * @param categoryName
- * @param flagName
- * @return
- */
- @VisibleForTesting
- static String makeAconfigFlagPropertyName(String categoryName, String flagName) {
- String propertyName = SYSTEM_PROPERTY_PREFIX + "aconfig_flags." +
- categoryName + "." + flagName;
-
- if (!propertyName.matches(SYSTEM_PROPERTY_VALID_CHARACTERS_REGEX)
- || propertyName.contains(SYSTEM_PROPERTY_INVALID_SUBSTRING)) {
- return null;
- }
-
- return propertyName;
- }
-
private void setProperty(String key, String value) {
// Check if need to clear the property
if (value == null) {