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

Commit 4a5c468e authored by Jing Ji's avatar Jing Ji
Browse files

Keep the test helper process unfrozen during the test

Bug: 330463870
Test: atest ActivityManagerPerfTests:OomAdjPerfTest
Change-Id: Ieb60099a916a9412558f27683fb553447df495bd
parent 748f0532
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);
        }
    }
}