Use the correct Smart Storage flag in SettingsLib.
Previously, the show_opt_in and enabled flags were conflated to basically mean the same thing. Because we are now distinctly making show_opt_in refer to showing a toggle to opt into the feature in SUW and enabled to mean the default enabled status, we need to change the utility method for querying the default enabled status. Bug: 122461924 Test: RunSettingsLibRoboTests Change-Id: I9802d307597d90514e7dc6631998daa1d2fab253
This commit is contained in:
@@ -38,8 +38,8 @@ public class Utils {
|
||||
private static final String CURRENT_MODE_KEY = "CURRENT_MODE";
|
||||
private static final String NEW_MODE_KEY = "NEW_MODE";
|
||||
@VisibleForTesting
|
||||
static final String STORAGE_MANAGER_SHOW_OPT_IN_PROPERTY =
|
||||
"ro.storage_manager.show_opt_in";
|
||||
static final String STORAGE_MANAGER_ENABLED_PROPERTY =
|
||||
"ro.storage_manager.enabled";
|
||||
|
||||
private static Signature[] sSystemSignature;
|
||||
private static String sPermissionControllerPackageName;
|
||||
@@ -373,8 +373,7 @@ public class Utils {
|
||||
public static boolean isStorageManagerEnabled(Context context) {
|
||||
boolean isDefaultOn;
|
||||
try {
|
||||
// Turn off by default if the opt-in was shown.
|
||||
isDefaultOn = !SystemProperties.getBoolean(STORAGE_MANAGER_SHOW_OPT_IN_PROPERTY, true);
|
||||
isDefaultOn = SystemProperties.getBoolean(STORAGE_MANAGER_ENABLED_PROPERTY, false);
|
||||
} catch (Resources.NotFoundException e) {
|
||||
isDefaultOn = false;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ package com.android.settingslib;
|
||||
|
||||
import static android.Manifest.permission.WRITE_SECURE_SETTINGS;
|
||||
|
||||
import static com.android.settingslib.Utils.STORAGE_MANAGER_SHOW_OPT_IN_PROPERTY;
|
||||
import static com.android.settingslib.Utils.STORAGE_MANAGER_ENABLED_PROPERTY;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
@@ -159,7 +159,7 @@ public class UtilsTest {
|
||||
|
||||
@Test
|
||||
public void testIsStorageManagerEnabled_UsesSystemProperties() {
|
||||
SystemProperties.set(STORAGE_MANAGER_SHOW_OPT_IN_PROPERTY, "false");
|
||||
SystemProperties.set(STORAGE_MANAGER_ENABLED_PROPERTY, "true");
|
||||
assertThat(Utils.isStorageManagerEnabled(mContext)).isTrue();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user