Merge changes from topic "remove-all-tasks" into sc-dev
* changes: Ensure apps not running on cold launch test Remove all tasks before flicker tests
This commit is contained in:
committed by
Android (Google) Code Review
commit
400197ade7
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:JvmName("Utils")
|
||||
package com.android.wm.shell.flicker
|
||||
|
||||
import android.app.ActivityTaskManager
|
||||
import android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT
|
||||
import android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS
|
||||
import android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD
|
||||
import android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED
|
||||
|
||||
fun removeAllTasksButHome() {
|
||||
val ALL_ACTIVITY_TYPE_BUT_HOME = intArrayOf(
|
||||
ACTIVITY_TYPE_STANDARD, ACTIVITY_TYPE_ASSISTANT, ACTIVITY_TYPE_RECENTS,
|
||||
ACTIVITY_TYPE_UNDEFINED)
|
||||
val atm = ActivityTaskManager.getService()
|
||||
atm.removeRootTasksWithActivityTypes(ALL_ACTIVITY_TYPE_BUT_HOME)
|
||||
}
|
||||
@@ -29,7 +29,7 @@ import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
|
||||
import com.android.wm.shell.flicker.helpers.ImeAppHelper
|
||||
import com.android.wm.shell.flicker.helpers.FixedAppHelper
|
||||
import com.android.server.wm.flicker.repetitions
|
||||
import com.android.wm.shell.flicker.removeAllTasksButHome
|
||||
import com.android.server.wm.flicker.rules.RemoveAllTasksButHomeRule.Companion.removeAllTasksButHome
|
||||
import com.android.wm.shell.flicker.testapp.Components.PipActivity.EXTRA_ENTER_PIP
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Test
|
||||
|
||||
@@ -33,12 +33,12 @@ import com.android.server.wm.flicker.navBarLayerRotatesAndScales
|
||||
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.noUncoveredRegions
|
||||
import com.android.server.wm.flicker.repetitions
|
||||
import com.android.server.wm.flicker.rules.RemoveAllTasksButHomeRule.Companion.removeAllTasksButHome
|
||||
import com.android.server.wm.flicker.startRotation
|
||||
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
|
||||
import com.android.server.wm.flicker.statusBarLayerRotatesScales
|
||||
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
import com.android.wm.shell.flicker.helpers.PipAppHelper
|
||||
import com.android.wm.shell.flicker.removeAllTasksButHome
|
||||
import com.android.wm.shell.flicker.testapp.Components
|
||||
import org.junit.Test
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
<!-- Workaround grant runtime permission exception from b/152733071 -->
|
||||
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/>
|
||||
<uses-permission android:name="android.permission.READ_LOGS"/>
|
||||
<!-- ATM.removeRootTasksWithActivityTypes() -->
|
||||
<uses-permission android:name="android.permission.MANAGE_ACTIVITY_TASKS" />
|
||||
<!-- Allow the test to write directly to /sdcard/ -->
|
||||
<application android:requestLegacyExternalStorage="true">
|
||||
<uses-library android:name="android.test.runner"/>
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory
|
||||
import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.server.wm.flicker.startRotation
|
||||
import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.rules.RemoveAllTasksButHomeRule.Companion.removeAllTasksButHome
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -44,6 +45,7 @@ class OpenAppColdTest(testSpec: FlickerTestParameter) : OpenAppTransition(testSp
|
||||
super.transition(this, it)
|
||||
setup {
|
||||
eachRun {
|
||||
removeAllTasksButHome()
|
||||
this.setRotation(testSpec.config.startRotation)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user