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

Commit 14b60d77 authored by vadimt's avatar vadimt Committed by Vadim Tryshev
Browse files

Unlocking device from the test

This is a workaround for the infra not unlocking
the device properly.

I don't have access to may machine, so
I've created this CL in Gerrit editor, didn't test,
but it should work.

Bug: 151613234
parent ef1d1b93
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ public abstract class AbstractLauncherUiTest {

    private static String sDetectedActivityLeak;
    private static boolean sActivityLeakReported;
    private static final String SYSTEMUI_PACKAGE = "com.android.systemui";

    protected LooperExecutor mMainThreadExecutor = MAIN_EXECUTOR;
    protected final UiDevice mDevice = UiDevice.getInstance(getInstrumentation());
@@ -213,8 +214,16 @@ 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 {
        if (hasSystemUiObject("keyguard_status_view")) {
            mDevice.executeShellCommand("input keyevent 82");
        }

        final String launcherPackageName = mDevice.getLauncherPackageName();
        try {
            final Context context = InstrumentationRegistry.getContext();