Loading services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java +4 −10 Original line number Diff line number Diff line Loading @@ -231,6 +231,10 @@ public class PowerManagerServiceTest { cr.addProvider(Settings.AUTHORITY, new FakeSettingsProvider()); when(mContextSpy.getContentResolver()).thenReturn(cr); when(mResourcesSpy.getBoolean(com.android.internal.R.bool.config_dreamsSupported)) .thenReturn(true); when(mResourcesSpy.getBoolean(com.android.internal.R.bool.config_dreamsEnabledByDefault)) .thenReturn(true); Settings.Global.putInt(mContextSpy.getContentResolver(), Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0); Settings.Secure.putInt(mContextSpy.getContentResolver(), Loading Loading @@ -1076,8 +1080,6 @@ public class PowerManagerServiceTest { @Test public void testScreensaverActivateOnSleepEnabled_powered_afterTimeout_goesToDreaming() { when(mBatteryManagerInternalMock.isPowered(anyInt())).thenReturn(true); Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1); doAnswer(inv -> { when(mDreamManagerInternalMock.isDreaming()).thenReturn(true); Loading @@ -1099,8 +1101,6 @@ public class PowerManagerServiceTest { public void testAmbientSuppression_disablesDreamingAndWakesDevice() { Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1); Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ENABLED, 1); setDreamsDisabledByAmbientModeSuppressionConfig(true); setMinimumScreenOffTimeoutConfig(10000); Loading Loading @@ -1128,8 +1128,6 @@ public class PowerManagerServiceTest { public void testAmbientSuppressionDisabled_shouldNotWakeDevice() { Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1); Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ENABLED, 1); setDreamsDisabledByAmbientModeSuppressionConfig(false); setMinimumScreenOffTimeoutConfig(10000); Loading @@ -1156,8 +1154,6 @@ public class PowerManagerServiceTest { public void testAmbientSuppression_doesNotAffectDreamForcing() { Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1); Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ENABLED, 1); setDreamsDisabledByAmbientModeSuppressionConfig(true); setMinimumScreenOffTimeoutConfig(10000); Loading @@ -1183,8 +1179,6 @@ public class PowerManagerServiceTest { public void testBatteryDrainDuringDream() { Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1); Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ENABLED, 1); setMinimumScreenOffTimeoutConfig(100); setDreamsBatteryLevelDrainConfig(5); Loading Loading
services/tests/servicestests/src/com/android/server/power/PowerManagerServiceTest.java +4 −10 Original line number Diff line number Diff line Loading @@ -231,6 +231,10 @@ public class PowerManagerServiceTest { cr.addProvider(Settings.AUTHORITY, new FakeSettingsProvider()); when(mContextSpy.getContentResolver()).thenReturn(cr); when(mResourcesSpy.getBoolean(com.android.internal.R.bool.config_dreamsSupported)) .thenReturn(true); when(mResourcesSpy.getBoolean(com.android.internal.R.bool.config_dreamsEnabledByDefault)) .thenReturn(true); Settings.Global.putInt(mContextSpy.getContentResolver(), Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0); Settings.Secure.putInt(mContextSpy.getContentResolver(), Loading Loading @@ -1076,8 +1080,6 @@ public class PowerManagerServiceTest { @Test public void testScreensaverActivateOnSleepEnabled_powered_afterTimeout_goesToDreaming() { when(mBatteryManagerInternalMock.isPowered(anyInt())).thenReturn(true); Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1); doAnswer(inv -> { when(mDreamManagerInternalMock.isDreaming()).thenReturn(true); Loading @@ -1099,8 +1101,6 @@ public class PowerManagerServiceTest { public void testAmbientSuppression_disablesDreamingAndWakesDevice() { Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1); Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ENABLED, 1); setDreamsDisabledByAmbientModeSuppressionConfig(true); setMinimumScreenOffTimeoutConfig(10000); Loading Loading @@ -1128,8 +1128,6 @@ public class PowerManagerServiceTest { public void testAmbientSuppressionDisabled_shouldNotWakeDevice() { Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1); Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ENABLED, 1); setDreamsDisabledByAmbientModeSuppressionConfig(false); setMinimumScreenOffTimeoutConfig(10000); Loading @@ -1156,8 +1154,6 @@ public class PowerManagerServiceTest { public void testAmbientSuppression_doesNotAffectDreamForcing() { Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1); Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ENABLED, 1); setDreamsDisabledByAmbientModeSuppressionConfig(true); setMinimumScreenOffTimeoutConfig(10000); Loading @@ -1183,8 +1179,6 @@ public class PowerManagerServiceTest { public void testBatteryDrainDuringDream() { Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, 1); Settings.Secure.putInt(mContextSpy.getContentResolver(), Settings.Secure.SCREENSAVER_ENABLED, 1); setMinimumScreenOffTimeoutConfig(100); setDreamsBatteryLevelDrainConfig(5); Loading