Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac76152a authored by Yi Jiang's avatar Yi Jiang Committed by Android (Google) Code Review
Browse files

Merge "Updates screen attention preference at onStart()."

parents 786d3578 0bbc7581
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ public class ScreenTimeoutSettings extends RadioButtonPickerFragment implements
    public void onStart() {
        super.onStart();
        mAdaptiveSleepPermissionController.updateVisibility();
        mAdaptiveSleepController.updatePreference();
    }

    @Override