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

Commit eed17110 authored by Vadim Tryshev's avatar Vadim Tryshev Committed by Android (Google) Code Review
Browse files

Merge "Revert "Removing workaround for battery defender"" into sc-dev

parents c47d8a02 f9ccf017
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -247,12 +247,26 @@ public abstract class AbstractLauncherUiTest {
        return mDevice;
    }

    private boolean hasSystemUiObject(String resId) {
        return mDevice.hasObject(By.res(SYSTEMUI_PACKAGE, resId));
    }

    @Before
    public void setUp() throws Exception {
        mLauncher.onTestStart();
        Assert.assertTrue("Keyguard is visible, which is likely caused by a crash in SysUI",
        Log.d(TAG, "Before disabling battery defender");
        mDevice.executeShellCommand("setprop vendor.battery.defender.disable 1");
        Log.d(TAG, "Before enabling stay awake");
        mDevice.executeShellCommand("settings put global stay_on_while_plugged_in 3");
        for (int i = 0; i < 10 && hasSystemUiObject("keyguard_status_view"); ++i) {
            Log.d(TAG, "Before unlocking the phone");
            mDevice.executeShellCommand("input keyevent 82");
            mDevice.waitForIdle();
        }
        Assert.assertTrue("Keyguard still visible",
                TestHelpers.wait(
                        Until.gone(By.res(SYSTEMUI_PACKAGE, "keyguard_status_view")), 60000));
        Log.d(TAG, "Keyguard is not visible");

        final String launcherPackageName = mDevice.getLauncherPackageName();
        try {