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

Commit 6373a4ed authored by Yi Jiang's avatar Yi Jiang
Browse files

Disables screen attention in settings.

Disables screen attention in settings when attention service is not
available.

Bug: 139532479
Test: Manually
Change-Id: I0b1f9c36d38f875fcf5eaeabd0bf8051e80064a7
parent e99edb8a
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -172,12 +172,13 @@ public class AttentionDetector {
    public long updateUserActivity(long nextScreenDimming) {
    public long updateUserActivity(long nextScreenDimming) {
        if (nextScreenDimming == mLastActedOnNextScreenDimming
        if (nextScreenDimming == mLastActedOnNextScreenDimming
                || !mIsSettingEnabled
                || !mIsSettingEnabled
                || !isAttentionServiceSupported()
                || mWindowManager.isKeyguardShowingAndNotOccluded()) {
                || mWindowManager.isKeyguardShowingAndNotOccluded()) {
            return nextScreenDimming;
            return nextScreenDimming;
        }
        }


        if (!serviceHasSufficientPermissions()) {
        if (!isAttentionServiceSupported() || !serviceHasSufficientPermissions()) {
            // Turns off adaptive sleep in settings for all users if attention service is not
            // available. The setting itself should also be grayed out in this case.
            Settings.System.putInt(mContentResolver, ADAPTIVE_SLEEP, 0);
            Settings.System.putInt(mContentResolver, ADAPTIVE_SLEEP, 0);
            return nextScreenDimming;
            return nextScreenDimming;
        }
        }