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

Commit e726406a authored by Jing Ji's avatar Jing Ji Committed by Android (Google) Code Review
Browse files

Merge "Keep the test helper process unfrozen during the test" into main

parents 39af13d2 4a5c468e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -90,6 +90,9 @@ public final class OomAdjPerfTest extends BasePerfTest {
        TargetPackageUtils.startStubPackage(mContext, STUB_PACKAGE1_NAME);
        TargetPackageUtils.startStubPackage(mContext, STUB_PACKAGE2_NAME);
        TargetPackageUtils.startStubPackage(mContext, STUB_PACKAGE3_NAME);

        Utils.wakeUp();
        Utils.runShellCommand("wm dismiss-keyguard");
    }

    @After
+1 −0
Original line number Diff line number Diff line
@@ -175,6 +175,7 @@ public class TargetPackageUtils {
            context.startService(intent);
            Assert.assertTrue("Timeout when waiting for starting package " +  pkgName,
                    pair.second.await(AWAIT_SERVICE_CONNECT_MS, TimeUnit.MILLISECONDS));
            Utils.runShellCommand("am unfreeze --sticky " + pkgName);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
+11 −0
Original line number Diff line number Diff line
@@ -66,4 +66,15 @@ public class Utils {
        ResultReceiver resultReceiver = intent.getParcelableExtra(Intent.EXTRA_RESULT_RECEIVER);
        resultReceiver.send(0, null);
    }

    /**
     * Wake up the device.
     */
    public static void wakeUp() {
        try {
            UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()).wakeUp();
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
    }
}