Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f233b436 authored by Robert Horvath's avatar Robert Horvath
Browse files

PowerManagerServiceTest: Set dreams as supported & enabled by default

Some tests depend on dreams being supported & enabled.
This change sets the corresponding config values in the test setup.

Bug: 293660604
Test: atest PowerManagerServiceTest
Merged-In: I022f69f49ef0a7380a7d772b43db4ed7e3fb28b9
Change-Id: Ib3a7356ac29383a0452c78239f3a79cc08b21c59
parent 5d425594
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -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(),
@@ -1099,8 +1103,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);
@@ -1128,8 +1130,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);
@@ -1156,8 +1156,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);
@@ -1183,8 +1181,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);