Do not update enabled state when app ops is not changed
Only update it when app ops state is changed, as the preference is possibly disabled by other components already. Bug: 222677960 Test: "Sensitive Notification" grey out works Test: Enhanced confirmation flow for accessibility works Change-Id: I4930ede5de1bfe7594d4f9c6aa5fbd468528a313
This commit is contained in:
@@ -198,10 +198,9 @@ public class RestrictedPreferenceHelper {
|
||||
if (mDisabledByAdmin != disabled) {
|
||||
mDisabledByAdmin = disabled;
|
||||
changed = true;
|
||||
updateDisabledState();
|
||||
}
|
||||
|
||||
updateDisabledState();
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
@@ -210,10 +209,9 @@ public class RestrictedPreferenceHelper {
|
||||
if (mDisabledByAppOps != disabled) {
|
||||
mDisabledByAppOps = disabled;
|
||||
changed = true;
|
||||
updateDisabledState();
|
||||
}
|
||||
|
||||
updateDisabledState();
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
@@ -254,9 +254,11 @@ public class RestrictedSwitchPreference extends SwitchPreference {
|
||||
final boolean ecmEnabled = getContext().getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_enhancedConfirmationModeEnabled);
|
||||
final boolean appOpsAllowed = !ecmEnabled || mode == AppOpsManager.MODE_ALLOWED;
|
||||
if (appOpsAllowed || isEnabled) {
|
||||
if (isEnabled) {
|
||||
setEnabled(true);
|
||||
} else {
|
||||
} else if (appOpsAllowed && isDisabledByAppOps()) {
|
||||
setEnabled(true);
|
||||
} else if (!appOpsAllowed){
|
||||
setDisabledByAppOps(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user