Don't reset adaptive_sleep setting
Always respect user setting since we can't meaningfully recover from the loss. Bug: 153765285 Test: manually Change-Id: I29f3b82e2c40d80c36721882724846a7439454eb
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user