Merge "Don't reset adaptive_sleep setting" into rvc-dev
This commit is contained in:
@@ -17,7 +17,6 @@
|
|||||||
package com.android.server.power;
|
package com.android.server.power;
|
||||||
|
|
||||||
import static android.provider.DeviceConfig.NAMESPACE_ATTENTION_MANAGER_SERVICE;
|
import static android.provider.DeviceConfig.NAMESPACE_ATTENTION_MANAGER_SERVICE;
|
||||||
import static android.provider.Settings.Secure.ADAPTIVE_SLEEP;
|
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
@@ -192,9 +191,6 @@ public class AttentionDetector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isAttentionServiceSupported() || !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.Secure.putInt(mContentResolver, ADAPTIVE_SLEEP, 0);
|
|
||||||
return nextScreenDimming;
|
return nextScreenDimming;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -157,17 +157,6 @@ public class AttentionDetectorTest extends AndroidTestCase {
|
|||||||
assertThat(mNextDimming).isEqualTo(when);
|
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
|
@Test
|
||||||
public void testOnUserActivity_doesntCrashIfNoAttentionService() {
|
public void testOnUserActivity_doesntCrashIfNoAttentionService() {
|
||||||
mAttentionManagerInternal = null;
|
mAttentionManagerInternal = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user