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

Commit aefd543e authored by Alex Salo's avatar Alex Salo Committed by Android (Google) Code Review
Browse files

Merge "Don't reset adaptive_sleep setting"

parents 3b99c79b 5ac98874
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.server.power;

import static android.provider.DeviceConfig.NAMESPACE_ATTENTION_MANAGER_SERVICE;
import static android.provider.Settings.Secure.ADAPTIVE_SLEEP;

import android.Manifest;
import android.app.ActivityManager;
@@ -192,9 +191,6 @@ public class AttentionDetector {
        }

        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.Secure.putInt(mContentResolver, ADAPTIVE_SLEEP, 0);
            return nextScreenDimming;
        }

+0 −11
Original line number Diff line number Diff line
@@ -157,17 +157,6 @@ public class AttentionDetectorTest extends AndroidTestCase {
        assertThat(mNextDimming).isEqualTo(when);
    }

    @Test
    public void testOnUserActivity_disablesSettingIfNotSufficientPermissions() {
        when(mPackageManager.checkPermission(any(), any())).thenReturn(
                PackageManager.PERMISSION_DENIED);

        registerAttention();
        boolean enabled = Settings.Secure.getIntForUser(getContext().getContentResolver(),
                Settings.Secure.ADAPTIVE_SLEEP, 0, UserHandle.USER_CURRENT) == 1;
        assertFalse(enabled);
    }

    @Test
    public void testOnUserActivity_doesntCrashIfNoAttentionService() {
        mAttentionManagerInternal = null;