Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f51e1dd2 authored by Ted Bauer's avatar Ted Bauer
Browse files

Only read the use_new_storage_value flag once per process.

Change-Id: Ib088fbcc2283718a309097c7c45fb01d5a983a25
Test: m
Bug: 312235596
parent fa476051
Loading
Loading
Loading
Loading
+9 −4
Original line number Original line Diff line number Diff line
@@ -698,6 +698,8 @@ mod tests {
        StorageInternalReader reader;
        StorageInternalReader reader;
        boolean readFromNewStorage;
        boolean readFromNewStorage;


        boolean useNewStorageValueAndDiscardOld = false;

        private final static String TAG = "AconfigJavaCodegen";
        private final static String TAG = "AconfigJavaCodegen";
        private final static String SUCCESS_LOG = "success: %s value matches";
        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";
        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;
                    reader = null;
                }
                }
            }
            }

            useNewStorageValueAndDiscardOld =
                DeviceConfig.getBoolean("core_experiments_team_internal", "com.android.providers.settings.use_new_storage_value", false);
        }
        }


        private void load_overrides_aconfig_test() {
        private void load_overrides_aconfig_test() {
@@ -746,7 +751,7 @@ mod tests {
                        Log.i(TAG, String.format(MISMATCH_LOG, "disabledRw", val, disabledRw));
                        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;
                        disabledRw = val;
                    }
                    }


@@ -757,7 +762,7 @@ mod tests {
                        Log.i(TAG, String.format(MISMATCH_LOG, "disabledRwExported", val, disabledRwExported));
                        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;
                        disabledRwExported = val;
                    }
                    }


@@ -768,7 +773,7 @@ mod tests {
                        Log.i(TAG, String.format(MISMATCH_LOG, "enabledRw", val, enabledRw));
                        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;
                        enabledRw = val;
                    }
                    }


@@ -805,7 +810,7 @@ mod tests {
                        Log.i(TAG, String.format(MISMATCH_LOG, "disabledRwInOtherNamespace", val, disabledRwInOtherNamespace));
                        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;
                        disabledRwInOtherNamespace = val;
                    }
                    }


+6 −1
Original line number Original line Diff line number Diff line
@@ -35,6 +35,8 @@ public final class FeatureFlagsImpl implements FeatureFlags \{
    StorageInternalReader reader;
    StorageInternalReader reader;
    boolean readFromNewStorage;
    boolean readFromNewStorage;


    boolean useNewStorageValueAndDiscardOld = false;

    private final static String TAG = "AconfigJavaCodegen";
    private final static String TAG = "AconfigJavaCodegen";
    private final static String SUCCESS_LOG = "success: %s value matches";
    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";
    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;
                reader = null;
            }
            }
        }
        }

        useNewStorageValueAndDiscardOld =
            DeviceConfig.getBoolean("core_experiments_team_internal", "com.android.providers.settings.use_new_storage_value", false);
    }
    }


{{ -endif }}
{{ -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}));
                    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;
                    {flag.method_name} = val;
                }
                }