Merge "Don't reset adaptive_sleep setting" into rvc-dev

This commit is contained in:
Alex Salo
2020-04-21 21:27:38 +00:00
committed by Android (Google) Code Review
2 changed files with 0 additions and 15 deletions

View File

@@ -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;
}

View File

@@ -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;