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

Commit 150075b7 authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Use TAPL to launch apps and recents

Currently we use app helpers to launch apps and UIAutomator to reach recents. Current recommendation is to use TAPL instead (go/tapl), which is more stable and provides additional functionality

Test: atest FlickerTests
Change-Id: Ib0e0d75000fee5d5f69c3fefbdc78e701873e3d3
parent ff8e08c5
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static com.android.server.wm.flicker.helpers.AutomationUtils.expandPipWin
import static com.android.server.wm.flicker.helpers.AutomationUtils.launchSplitScreen;
import static com.android.server.wm.flicker.helpers.AutomationUtils.stopPackage;

import android.app.Instrumentation;
import android.content.Context;
import android.content.Intent;
import android.os.RemoteException;
@@ -222,8 +223,9 @@ class CommonTransitions {
                .repeat(ITERATIONS);
    }

    static TransitionBuilder resizeSplitScreen(IAppHelper testAppTop, ImeAppHelper testAppBottom,
            UiDevice device, int beginRotation, Rational startRatio, Rational stopRatio) {
    static TransitionBuilder resizeSplitScreen(Instrumentation instr, IAppHelper testAppTop,
            ImeAppHelper testAppBottom, UiDevice device, int beginRotation, Rational startRatio,
            Rational stopRatio) {
        String testTag = "resizeSplitScreen_" + testAppTop.getLauncherName() + "_"
                + testAppBottom.getLauncherName() + "_"
                + startRatio.toString().replace("/", ":") + "_to_"
@@ -234,7 +236,7 @@ class CommonTransitions {
                .recordAllRuns()
                .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
                .runBeforeAll(() -> setRotation(device, beginRotation))
                .runBeforeAll(() -> clearRecents(device))
                .runBeforeAll(() -> clearRecents(instr))
                .runBefore(testAppBottom::open)
                .runBefore(device::pressHome)
                .runBefore(testAppTop::open)
+4 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.wm.flicker;

import android.app.Instrumentation;
import android.platform.helpers.IAppHelper;
import android.util.Rational;
import android.view.Surface;
@@ -114,8 +115,9 @@ public class DebugTest {
     */
    @Test
    public void resizeSplitScreen() {
        ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
        CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, Surface.ROTATION_0,
        Instrumentation instr = InstrumentationRegistry.getInstrumentation();
        ImeAppHelper bottomApp = new ImeAppHelper(instr);
        CommonTransitions.resizeSplitScreen(instr, testApp, bottomApp, uiDevice, Surface.ROTATION_0,
                new Rational(1, 3), new Rational(2, 3))
                .includeJankyRuns().build().run();
    }
+4 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static com.android.server.wm.flicker.helpers.AutomationUtils.isInSplitScr

import static com.google.common.truth.Truth.assertThat;

import android.app.Instrumentation;
import android.graphics.Rect;
import android.util.Rational;
import android.view.Surface;
@@ -65,8 +66,9 @@ public class ResizeSplitScreenTest extends FlickerTestBase {

    @Override
    TransitionRunner getTransitionToRun() {
        ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
        return resizeSplitScreen(mTestApp, bottomApp, mUiDevice, Surface.ROTATION_0,
        Instrumentation instr = InstrumentationRegistry.getInstrumentation();
        ImeAppHelper bottomApp = new ImeAppHelper(instr);
        return resizeSplitScreen(instr, mTestApp, bottomApp, mUiDevice, Surface.ROTATION_0,
                new Rational(1, 3), new Rational(2, 3))
                .includeJankyRuns().build();
    }