Expand ASM activation warning.

If the device had ASM enabled by default but still opted to disable ASM
for policy reasons, we need to start warning the user.

Change-Id: I6a296e95d00413308de3ddc565b42c5f605087e9
Fixes: 62105682
Test: Settings robotest
This commit is contained in:
Daniel Nishi
2017-06-27 15:09:20 -07:00
parent 5d3f6d566b
commit 8f345d7fd6
2 changed files with 30 additions and 3 deletions

View File

@@ -88,9 +88,17 @@ public class AutomaticStorageManagementSwitchPreferenceController extends Prefer
Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED,
isChecked ? 1 : 0);
boolean storageManagerEnabledByDefault = SystemProperties.getBoolean(
STORAGE_MANAGER_ENABLED_BY_DEFAULT_PROPERTY, false);
if (isChecked && !storageManagerEnabledByDefault) {
final boolean storageManagerEnabledByDefault =
SystemProperties.getBoolean(STORAGE_MANAGER_ENABLED_BY_DEFAULT_PROPERTY, false);
final boolean storageManagerDisabledByPolicy =
Settings.Secure.getInt(
mContext.getContentResolver(),
Settings.Secure.AUTOMATIC_STORAGE_MANAGER_TURNED_OFF_BY_POLICY,
0)
!= 0;
// Show warning if it is disabled by default and turning it on or if it was disabled by
// policy and we're turning it on.
if ((isChecked && (!storageManagerEnabledByDefault || storageManagerDisabledByPolicy))) {
ActivationWarningFragment fragment = ActivationWarningFragment.newInstance();
fragment.show(mFragmentManager, ActivationWarningFragment.TAG);
}