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

Commit 18f0d02b authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Reset the frozen recents list for other split tests" into main

parents 11f37474 e0e39227
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -66,5 +66,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) {
    fun teardown() {
        primaryApp.exit(wmHelper)
        secondaryApp.exit(wmHelper)
        Utils.resetFreezeRecentTaskList()
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -65,5 +65,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) {
    fun teardown() {
        primaryApp.exit(wmHelper)
        secondaryApp.exit(wmHelper)
        Utils.resetFreezeRecentTaskList()
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -68,5 +68,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) {
    fun teardown() {
        primaryApp.exit(wmHelper)
        secondaryApp.exit(wmHelper)
        Utils.resetFreezeRecentTaskList()
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -68,5 +68,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) {
        secondaryApp.exit(wmHelper)
        thirdApp.exit(wmHelper)
        fourthApp.exit(wmHelper)
        Utils.resetFreezeRecentTaskList()
    }
}
+16 −0
Original line number Diff line number Diff line
@@ -28,7 +28,10 @@ import android.tools.flicker.rules.ArtifactSaverRule
import android.tools.flicker.rules.ChangeDisplayOrientationRule
import android.tools.flicker.rules.LaunchAppRule
import android.tools.flicker.rules.RemoveAllTasksButHomeRule
import android.util.Log
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import java.io.IOException
import org.junit.rules.RuleChain

object Utils {
@@ -52,4 +55,17 @@ object Utils {
            .around(PressHomeRule())
            .around(EnsureDeviceSettingsRule())
    }

    /**
     * Resets the frozen recent tasks list (ie. commits the quickswitch to the current task and
     * reorders the current task to the end of the recents list).
     */
    fun resetFreezeRecentTaskList() {
        try {
            UiDevice.getInstance(instrumentation)
                .executeShellCommand("wm reset-freeze-recent-tasks")
        } catch (e: IOException) {
            Log.e("TestUtils", "Failed to reset frozen recent tasks list", e)
        }
    }
}