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

Commit f9ccf017 authored by vadimt's avatar vadimt
Browse files

Revert "Removing workaround for battery defender"

This reverts commit f4bb052c.

Reason: we have new episodes of phone locking during the test.
https://flakes-clusters.corp.google.com/#?androidAtpBranch=git_sc-dev&androidAtpModule=com.google.android.apps.nexuslauncher.out_of_proc_tests&d=3&maxResults=10

https://flakes-clusters.corp.google.com/#?androidAtpBranch=git_sc-dev&androidAtpModule=com.google.android.apps.nexuslauncher.tests&d=3&maxResults=10

Search for "Phone is locked" and "Keyguard is visible".

Also, for new devices, the phone is locked consistently, see for example
Redfin here:
https://blackbox.googleplex.com/dashboard/Launcher3Main_new_devices/testsuite/git_master/nexuslauncher_oop_tests_platform/2/bramble-userdebug/0

Reverting to see whether this helps.

Bug: 151613234
Test: presubmit
Change-Id: I44a94f9722deaa21d89fdfd79646ae661ebe972d
parent e010332e
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 {