Don't show warning dialog on opening ASM settings.
On older devices, the activation warning dialog would show upon the switchbar changing to On. This was occurring when the page opens because the status was changing onResume. By shuffling the switchbar changes into the ASMSwitchBarController, we can register our listener after the initialization of the switch bar's first status. Change-Id: I3610d07345684d1e66444981a8059d1c2965e955 Fixes: 37472724 Test: Settings robotests
This commit is contained in:
@@ -52,6 +52,17 @@ public class AutomaticStorageManagerSwitchBarController
|
||||
mDaysToRetainPreference = Preconditions.checkNotNull(daysToRetainPreference);
|
||||
mFragmentManager = Preconditions.checkNotNull(fragmentManager);
|
||||
|
||||
initializeCheckedStatus();
|
||||
}
|
||||
|
||||
private void initializeCheckedStatus() {
|
||||
boolean isStorageManagerChecked =
|
||||
Settings.Secure.getInt(
|
||||
mContext.getContentResolver(),
|
||||
Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED,
|
||||
0)
|
||||
!= 0;
|
||||
mSwitchBar.setChecked(isStorageManagerChecked);
|
||||
mSwitchBar.addOnSwitchChangeListener(this);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user