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

Commit e0e39227 authored by Winson Chung's avatar Winson Chung
Browse files

Reset the frozen recents list for other split tests

Bug: 379473564
Flag: EXEMPT bugfix
Test: atest WMShellFlickerServicePlatinumTests
Change-Id: I4148702645b216bee911d05cb0f9230c776fe2bd
parent 471e6c9e
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -66,5 +66,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) {
    fun teardown() {
    fun teardown() {
        primaryApp.exit(wmHelper)
        primaryApp.exit(wmHelper)
        secondaryApp.exit(wmHelper)
        secondaryApp.exit(wmHelper)
        Utils.resetFreezeRecentTaskList()
    }
    }
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -65,5 +65,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) {
    fun teardown() {
    fun teardown() {
        primaryApp.exit(wmHelper)
        primaryApp.exit(wmHelper)
        secondaryApp.exit(wmHelper)
        secondaryApp.exit(wmHelper)
        Utils.resetFreezeRecentTaskList()
    }
    }
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -68,5 +68,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) {
    fun teardown() {
    fun teardown() {
        primaryApp.exit(wmHelper)
        primaryApp.exit(wmHelper)
        secondaryApp.exit(wmHelper)
        secondaryApp.exit(wmHelper)
        Utils.resetFreezeRecentTaskList()
    }
    }
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -68,5 +68,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) {
        secondaryApp.exit(wmHelper)
        secondaryApp.exit(wmHelper)
        thirdApp.exit(wmHelper)
        thirdApp.exit(wmHelper)
        fourthApp.exit(wmHelper)
        fourthApp.exit(wmHelper)
        Utils.resetFreezeRecentTaskList()
    }
    }
}
}
+16 −0
Original line number Original line 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.ChangeDisplayOrientationRule
import android.tools.flicker.rules.LaunchAppRule
import android.tools.flicker.rules.LaunchAppRule
import android.tools.flicker.rules.RemoveAllTasksButHomeRule
import android.tools.flicker.rules.RemoveAllTasksButHomeRule
import android.util.Log
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import java.io.IOException
import org.junit.rules.RuleChain
import org.junit.rules.RuleChain


object Utils {
object Utils {
@@ -52,4 +55,17 @@ object Utils {
            .around(PressHomeRule())
            .around(PressHomeRule())
            .around(EnsureDeviceSettingsRule())
            .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)
        }
    }
}
}