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

Commit db3931fe authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Gerrit Code Review
Browse files

Merge changes from topic "flicker"

* changes:
  New flicker test: Add rotation to split screen test
  Ensure screenshot layer appears during rotation
  New FlickerTests: Create initial flicker tests for Pip
parents ef04ccb4 68e0c874
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -9,6 +9,14 @@
        <option name="screen-always-on" value="on" />
        <!-- prevents the phone from restarting -->
        <option name="force-skip-system-props" value="true" />
        <!-- set WM tracing verbose level to all -->
        <option name="run-command" value="adb shell cmd window tracing level all" />
        <!-- inform WM to log all transactions -->
        <option name="run-command" value="adb shell cmd window tracing transaction" />
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.DeviceCleaner">
        <!-- keeps the screen on during tests -->
        <option name="cleanup-action" value="REBOOT" />
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
        <option name="cleanup-apks" value="true"/>
+13 −0
Original line number Diff line number Diff line
@@ -144,6 +144,19 @@ public class ChangeAppRotationTest extends FlickerTestBase {
        );
    }

    @Test
    public void checkVisibility_screenshotLayerBecomesInvisible() {
        checkResults(result -> LayersTraceSubject.assertThat(result)
                .showsLayer(mTestApp.getPackage())
                .then()
                .replaceVisibleLayer(mTestApp.getPackage(), "Screenshot")
                .then()
                .showsLayer(mTestApp.getPackage()).and().showsLayer("Screenshot")
                .then()
                .replaceVisibleLayer("Screenshot", mTestApp.getPackage())
                .forAllEntries());
    }

    @FlakyTest(bugId = 140855415)
    @Ignore("Waiting bug feedback")
    @Test
+31 −17
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static android.os.SystemClock.sleep;
import static android.view.Surface.rotationToString;

import static com.android.server.wm.flicker.helpers.AutomationUtils.clearRecents;
import static com.android.server.wm.flicker.helpers.AutomationUtils.closePipWindow;
import static com.android.server.wm.flicker.helpers.AutomationUtils.exitSplitScreen;
import static com.android.server.wm.flicker.helpers.AutomationUtils.expandPipWindow;
import static com.android.server.wm.flicker.helpers.AutomationUtils.launchSplitScreen;
@@ -176,11 +175,15 @@ class CommonTransitions {
                .repeat(ITERATIONS);
    }

    static TransitionBuilder appToSplitScreen(IAppHelper testApp, UiDevice device) {
    static TransitionBuilder appToSplitScreen(IAppHelper testApp, UiDevice device,
            int beginRotation) {
        final String testTag = "appToSplitScreen_" + testApp.getLauncherName() + "_"
                + rotationToString(beginRotation);
        return TransitionRunner.newBuilder()
                .withTag("appToSplitScreen_" + testApp.getLauncherName())
                .withTag(testTag)
                .recordAllRuns()
                .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
                .runBeforeAll(() -> setRotation(device, beginRotation))
                .runBefore(testApp::open)
                .runBefore(device::waitForIdle)
                .runBefore(() -> sleep(500))
@@ -285,41 +288,52 @@ class CommonTransitions {
                .repeat(ITERATIONS);
    }

    static TransitionBuilder enterPipMode(PipAppHelper testApp, UiDevice device) {
    static TransitionBuilder enterPipMode(PipAppHelper testApp, UiDevice device,
            int beginRotation) {
        return TransitionRunner.newBuilder()
                .withTag("enterPipMode_" + testApp.getLauncherName())
                .withTag("enterPipMode_" + testApp.getLauncherName()
                        + rotationToString(beginRotation))
                .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
                .runBefore(device::pressHome)
                .runBefore(() -> setRotation(device, beginRotation))
                .runBefore(testApp::open)
                .run(() -> testApp.clickEnterPipButton(device))
                .runAfter(() -> closePipWindow(device))
                .runAfter(() -> testApp.closePipWindow(device))
                .runAfterAll(testApp::exit)
                .repeat(ITERATIONS);
    }

    static TransitionBuilder exitPipModeToHome(PipAppHelper testApp, UiDevice device) {
    static TransitionBuilder exitPipModeToHome(PipAppHelper testApp, UiDevice device,
            int beginRotation) {
        return TransitionRunner.newBuilder()
                .withTag("exitPipModeToHome_" + testApp.getLauncherName())
                .withTag("exitPipModeToHome_" + testApp.getLauncherName()
                        + rotationToString(beginRotation))
                .recordAllRuns()
                .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
                .runBefore(device::pressHome)
                .runBefore(() -> setRotation(device, beginRotation))
                .runBefore(testApp::open)
                .runBefore(() -> testApp.clickEnterPipButton(device))
                .run(() -> closePipWindow(device))
                .run(() -> testApp.clickEnterPipButton(device))
                .run(() -> testApp.closePipWindow(device))
                .run(device::waitForIdle)
                .runAfterAll(testApp::exit)
                .run(testApp::exit)
                .repeat(ITERATIONS);
    }

    static TransitionBuilder exitPipModeToApp(PipAppHelper testApp, UiDevice device) {
    static TransitionBuilder exitPipModeToApp(PipAppHelper testApp, UiDevice device,
            int beginRotation) {
        return TransitionRunner.newBuilder()
                .withTag("exitPipModeToApp_" + testApp.getLauncherName())
                .withTag("exitPipModeToApp_" + testApp.getLauncherName()
                        + rotationToString(beginRotation))
                .recordAllRuns()
                .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
                .runBefore(device::pressHome)
                .runBefore(testApp::open)
                .runBefore(() -> testApp.clickEnterPipButton(device))
                .run(device::pressHome)
                .run(() -> setRotation(device, beginRotation))
                .run(testApp::open)
                .run(() -> testApp.clickEnterPipButton(device))
                .run(() -> expandPipWindow(device))
                .run(device::waitForIdle)
                .runAfterAll(testApp::exit)
                .run(testApp::exit)
                .repeat(ITERATIONS);
    }
}
+10 −8
Original line number Diff line number Diff line
@@ -94,7 +94,8 @@ public class DebugTest {
     */
    @Test
    public void openAppToSplitScreen() {
        CommonTransitions.appToSplitScreen(testApp, uiDevice).includeJankyRuns().recordAllRuns()
        CommonTransitions.appToSplitScreen(testApp, uiDevice,
                Surface.ROTATION_0).includeJankyRuns().recordAllRuns()
                .build().run();
    }

@@ -116,7 +117,7 @@ public class DebugTest {
        ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
        CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, Surface.ROTATION_0,
                new Rational(1, 3), new Rational(2, 3))
                .includeJankyRuns().recordEachRun().build().run();
                .includeJankyRuns().build().run();
    }

    // IME tests
@@ -128,7 +129,7 @@ public class DebugTest {
    public void editTextSetFocus() {
        ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
        CommonTransitions.editTextSetFocus(testApp, uiDevice, Surface.ROTATION_0)
                .includeJankyRuns().recordEachRun()
                .includeJankyRuns()
                .build().run();
    }

@@ -139,7 +140,7 @@ public class DebugTest {
    public void editTextLoseFocusToHome() {
        ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
        CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
                .includeJankyRuns().recordEachRun()
                .includeJankyRuns()
                .build().run();
    }

@@ -150,7 +151,7 @@ public class DebugTest {
    public void editTextLoseFocusToApp() {
        ImeAppHelper testApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
        CommonTransitions.editTextLoseFocusToHome(testApp, uiDevice, Surface.ROTATION_0)
                .includeJankyRuns().recordEachRun()
                .includeJankyRuns()
                .build().run();
    }

@@ -162,7 +163,7 @@ public class DebugTest {
    @Test
    public void enterPipMode() {
        PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
        CommonTransitions.enterPipMode(testApp, uiDevice).includeJankyRuns().recordEachRun()
        CommonTransitions.enterPipMode(testApp, uiDevice, Surface.ROTATION_0).includeJankyRuns()
                .build().run();
    }

@@ -172,7 +173,8 @@ public class DebugTest {
    @Test
    public void exitPipModeToHome() {
        PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
        CommonTransitions.exitPipModeToHome(testApp, uiDevice).includeJankyRuns().recordEachRun()
        CommonTransitions.exitPipModeToHome(testApp, uiDevice, Surface.ROTATION_0)
                .includeJankyRuns()
                .build().run();
    }

@@ -182,7 +184,7 @@ public class DebugTest {
    @Test
    public void exitPipModeToApp() {
        PipAppHelper testApp = new PipAppHelper(InstrumentationRegistry.getInstrumentation());
        CommonTransitions.exitPipModeToApp(testApp, uiDevice).includeJankyRuns().recordEachRun()
        CommonTransitions.exitPipModeToApp(testApp, uiDevice, Surface.ROTATION_0).includeJankyRuns()
                .build().run();
    }
}
+17 −5
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ package com.android.server.wm.flicker;
import static com.android.server.wm.flicker.CommonTransitions.openAppCold;
import static com.android.server.wm.flicker.WmTraceSubject.assertThat;

import android.view.Surface;

import androidx.test.InstrumentationRegistry;
import androidx.test.filters.FlakyTest;
import androidx.test.filters.LargeTest;
@@ -76,10 +78,20 @@ public class OpenAppColdTest extends NonRotationTestBase {

    @Test
    public void checkVisibility_wallpaperLayerBecomesInvisible() {
        if (mBeginRotation == Surface.ROTATION_0) {
            checkResults(result -> LayersTraceSubject.assertThat(result)
                    .showsLayer("Wallpaper")
                    .then()
                .hidesLayer("Wallpaper")
                    .replaceVisibleLayer("Wallpaper", mTestApp.getPackage())
                    .forAllEntries());
        } else {
            checkResults(result -> LayersTraceSubject.assertThat(result)
                    .showsLayer("Wallpaper")
                    .then()
                    .replaceVisibleLayer("Wallpaper", "Screenshot")
                    .then()
                    .showsLayer(mTestApp.getPackage())
                    .forAllEntries());
        }
    }
}
Loading