Merge "Only read the use_new_storage_value flag once per process." into main am: bdaf14f9e2

Original change: https://android-review.googlesource.com/c/platform/build/+/3212787

Change-Id: I3ac230d45a2b4decb0bd6efdeb3bd22f1541df3a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2024-08-13 19:22:59 +00:00
committed by Automerger Merge Worker
2 changed files with 15 additions and 5 deletions

View File

@@ -698,6 +698,8 @@ mod tests {
StorageInternalReader reader;
boolean readFromNewStorage;
boolean useNewStorageValueAndDiscardOld = false;
private final static String TAG = "AconfigJavaCodegen";
private final static String SUCCESS_LOG = "success: %s value matches";
private final static String MISMATCH_LOG = "error: %s value mismatch, new storage value is %s, old storage value is %s";
@@ -713,6 +715,9 @@ mod tests {
reader = null;
}
}
useNewStorageValueAndDiscardOld =
DeviceConfig.getBoolean("core_experiments_team_internal", "com.android.providers.settings.use_new_storage_value", false);
}
private void load_overrides_aconfig_test() {
@@ -746,7 +751,7 @@ mod tests {
Log.i(TAG, String.format(MISMATCH_LOG, "disabledRw", val, disabledRw));
}
if (DeviceConfig.getBoolean("core_experiments_team_internal", "com.android.providers.settings.use_new_storage_value", false)) {
if (useNewStorageValueAndDiscardOld) {
disabledRw = val;
}
@@ -757,7 +762,7 @@ mod tests {
Log.i(TAG, String.format(MISMATCH_LOG, "disabledRwExported", val, disabledRwExported));
}
if (DeviceConfig.getBoolean("core_experiments_team_internal", "com.android.providers.settings.use_new_storage_value", false)) {
if (useNewStorageValueAndDiscardOld) {
disabledRwExported = val;
}
@@ -768,7 +773,7 @@ mod tests {
Log.i(TAG, String.format(MISMATCH_LOG, "enabledRw", val, enabledRw));
}
if (DeviceConfig.getBoolean("core_experiments_team_internal", "com.android.providers.settings.use_new_storage_value", false)) {
if (useNewStorageValueAndDiscardOld) {
enabledRw = val;
}
@@ -805,7 +810,7 @@ mod tests {
Log.i(TAG, String.format(MISMATCH_LOG, "disabledRwInOtherNamespace", val, disabledRwInOtherNamespace));
}
if (DeviceConfig.getBoolean("core_experiments_team_internal", "com.android.providers.settings.use_new_storage_value", false)) {
if (useNewStorageValueAndDiscardOld) {
disabledRwInOtherNamespace = val;
}

View File

@@ -35,6 +35,8 @@ public final class FeatureFlagsImpl implements FeatureFlags \{
StorageInternalReader reader;
boolean readFromNewStorage;
boolean useNewStorageValueAndDiscardOld = false;
private final static String TAG = "AconfigJavaCodegen";
private final static String SUCCESS_LOG = "success: %s value matches";
private final static String MISMATCH_LOG = "error: %s value mismatch, new storage value is %s, old storage value is %s";
@@ -50,6 +52,9 @@ public final class FeatureFlagsImpl implements FeatureFlags \{
reader = null;
}
}
useNewStorageValueAndDiscardOld =
DeviceConfig.getBoolean("core_experiments_team_internal", "com.android.providers.settings.use_new_storage_value", false);
}
{{ -endif }}
@@ -91,7 +96,7 @@ public final class FeatureFlagsImpl implements FeatureFlags \{
Log.i(TAG, String.format(MISMATCH_LOG, "{flag.method_name}", val, {flag.method_name}));
}
if (DeviceConfig.getBoolean("core_experiments_team_internal", "com.android.providers.settings.use_new_storage_value", false)) \{
if (useNewStorageValueAndDiscardOld) \{
{flag.method_name} = val;
}