Updates screen attention preference at onStart().
Screen attention preference needs to be refreshed at onStart() so that it get updated immediately once the camera permission is revoked/granted for the screen attention feature. Bug: 171019472 Test: manual + atest AdaptiveSleepPreferenceControllerTest Change-Id: If9ac68c022f10ffefde61b035bbf38ee14c02180
This commit is contained in:
@@ -75,6 +75,14 @@ public class AdaptiveSleepPreferenceController {
|
||||
* Adds the controlled preference to the provided preference screen.
|
||||
*/
|
||||
public void addToScreen(PreferenceScreen screen) {
|
||||
updatePreference();
|
||||
screen.addPreference(mPreference);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the appearance of the preference.
|
||||
*/
|
||||
public void updatePreference() {
|
||||
final EnforcedAdmin enforcedAdmin = mRestrictionUtils.checkIfRestrictionEnforced(mContext,
|
||||
UserManager.DISALLOW_CONFIG_SCREEN_TIMEOUT);
|
||||
if (enforcedAdmin != null) {
|
||||
@@ -82,7 +90,6 @@ public class AdaptiveSleepPreferenceController {
|
||||
} else {
|
||||
mPreference.setEnabled(hasSufficientPermission(mPackageManager));
|
||||
}
|
||||
screen.addPreference(mPreference);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
@@ -104,6 +104,7 @@ public class ScreenTimeoutSettings extends RadioButtonPickerFragment implements
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
mAdaptiveSleepPermissionController.updateVisibility();
|
||||
mAdaptiveSleepController.updatePreference();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user