Loading services/core/java/com/android/server/power/AttentionDetector.java +0 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading services/tests/servicestests/src/com/android/server/power/AttentionDetectorTest.java +0 −11 Original line number Diff line number Diff line Loading @@ -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; Loading Loading
services/core/java/com/android/server/power/AttentionDetector.java +0 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading
services/tests/servicestests/src/com/android/server/power/AttentionDetectorTest.java +0 −11 Original line number Diff line number Diff line Loading @@ -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; Loading