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:
Bill Lin
2020-11-18 15:44:52 +08:00
parent f48a5e3d13
commit a6c32cc9af
7 changed files with 12 additions and 18 deletions

View File

@@ -70,8 +70,8 @@ class AppPairsTest(
eachRun {
executeShellCommand(composePairsCommand(
primaryTaskId, secondaryTaskId, false /* pair */))
primaryApp.forceStop()
secondaryApp.forceStop()
primaryApp.exit()
secondaryApp.exit()
}
}
assertions {

View File

@@ -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

View File

@@ -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) }
}
}
}
}

View File

@@ -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)

View File

@@ -60,8 +60,8 @@ class EnterSplitScreenTest(
}
teardown {
eachRun {
splitScreenApp.forceStop()
secondaryApp.forceStop()
splitScreenApp.exit()
secondaryApp.exit()
}
}
assertions {

View File

@@ -65,8 +65,8 @@ class ExitSplitScreenTest(
}
teardown {
eachRun {
splitScreenApp.forceStop()!!
secondaryApp.forceStop()!!
splitScreenApp.exit()
secondaryApp.exit()
}
}
}

View File

@@ -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 -->