4-2/ Enhance AbstractStandardAppHelper.exit() to exit PIP at end
Integrate forceStop() in exit() that PIP window could really exit after each round of test Bug: 173567664 Test: atest com.android.wm.shell.flicker Test: atest com.android.server.wm.flicker.Flicker Change-Id: I8aaa4f590344f8fb1e6e731ed865f21f63892bb2
This commit is contained in:
@@ -70,8 +70,8 @@ class AppPairsTest(
|
||||
eachRun {
|
||||
executeShellCommand(composePairsCommand(
|
||||
primaryTaskId, secondaryTaskId, false /* pair */))
|
||||
primaryApp.forceStop()
|
||||
secondaryApp.forceStop()
|
||||
primaryApp.exit()
|
||||
secondaryApp.exit()
|
||||
}
|
||||
}
|
||||
assertions {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.wm.shell.flicker.helpers
|
||||
|
||||
import android.app.ActivityManager
|
||||
import android.app.Instrumentation
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
@@ -46,9 +45,6 @@ abstract class BaseAppHelper(
|
||||
protected val context: Context
|
||||
get() = mInstrumentation.context
|
||||
|
||||
private val activityManager: ActivityManager?
|
||||
get() = context.getSystemService(ActivityManager::class.java)
|
||||
|
||||
private val appSelector = By.pkg(packageName).depth(0)
|
||||
|
||||
protected val isTelevision: Boolean
|
||||
@@ -77,10 +73,6 @@ abstract class BaseAppHelper(
|
||||
return uiDevice.wait(Until.gone(appSelector), APP_CLOSE_WAIT_TIME_MS)
|
||||
}
|
||||
|
||||
fun forceStop() {
|
||||
activityManager?.forceStopPackage(packageName)
|
||||
}
|
||||
|
||||
override fun getOpenAppIntent(): Intent {
|
||||
val intent = Intent()
|
||||
intent.component = launcherActivityComponent
|
||||
|
||||
@@ -76,12 +76,12 @@ class PipKeyboardTest(
|
||||
}
|
||||
teardown {
|
||||
test {
|
||||
keyboardApp.forceStop()
|
||||
keyboardApp.exit()
|
||||
|
||||
if (device.hasPipWindow()) {
|
||||
device.closePipWindow()
|
||||
}
|
||||
testApp.forceStop()
|
||||
testApp.exit()
|
||||
this.setRotation(Surface.ROTATION_0)
|
||||
}
|
||||
}
|
||||
@@ -210,4 +210,4 @@ class PipKeyboardTest(
|
||||
return supportedRotations.map { arrayOf(Surface.rotationToString(it), it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ abstract class TvPipTestBase : PipTestBase(rotationToString(ROTATION_0), ROTATIO
|
||||
open fun tearDown() {
|
||||
if (!isTelevision) return
|
||||
|
||||
testApp.forceStop()
|
||||
testApp.exit()
|
||||
|
||||
// Wait for 1 second, and check if the SystemUI has been alive and well since the start.
|
||||
SystemClock.sleep(AFTER_TEXT_PROCESS_CHECK_DELAY)
|
||||
|
||||
@@ -60,8 +60,8 @@ class EnterSplitScreenTest(
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
splitScreenApp.forceStop()
|
||||
secondaryApp.forceStop()
|
||||
splitScreenApp.exit()
|
||||
secondaryApp.exit()
|
||||
}
|
||||
}
|
||||
assertions {
|
||||
|
||||
@@ -65,8 +65,8 @@ class ExitSplitScreenTest(
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
splitScreenApp.forceStop()!!
|
||||
secondaryApp.forceStop()!!
|
||||
splitScreenApp.exit()
|
||||
secondaryApp.exit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" />
|
||||
<!-- Enable / Disable tracing !-->
|
||||
<uses-permission android:name="android.permission.DUMP" />
|
||||
<!-- Force-stop test apps -->
|
||||
<uses-permission android:name="android.permission.FORCE_STOP_PACKAGES"/>
|
||||
<!-- Run layers trace -->
|
||||
<uses-permission android:name="android.permission.HARDWARE_TEST"/>
|
||||
<!-- Workaround grant runtime permission exception from b/152733071 -->
|
||||
|
||||
Reference in New Issue
Block a user