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

Commit 280850c3 authored by Uwais Ashraf's avatar Uwais Ashraf
Browse files

Clear all apps in teardown to prevent build up affecting perf tests.

Bug: 381317629
Flag: EXEMPT test only
Test: Changed tests
Change-Id: Ic460434241496646e931e03003e1e376f9d36622
parent 93017da5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.utils.RecentTasksUtils
import com.android.wm.shell.flicker.utils.SplitScreenUtils
import org.junit.After
import org.junit.Before
@@ -61,7 +62,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) {

    @After
    fun teardown() {
        primaryApp.exit(wmHelper)
        secondaryApp.exit(wmHelper)
        RecentTasksUtils.clearAllVisibleRecentTasks(instrumentation)
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.utils.RecentTasksUtils
import com.android.wm.shell.flicker.utils.SplitScreenUtils
import org.junit.After
import org.junit.Before
@@ -74,7 +75,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) {

    @After
    fun teardown() {
        primaryApp.exit(wmHelper)
        secondaryApp.exit(wmHelper)
        RecentTasksUtils.clearAllVisibleRecentTasks(instrumentation)
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.utils.RecentTasksUtils
import com.android.wm.shell.flicker.utils.SplitScreenUtils
import org.junit.After
import org.junit.Before
@@ -60,7 +61,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) {

    @After
    fun teardown() {
        primaryApp.exit(wmHelper)
        secondaryApp.exit(wmHelper)
        RecentTasksUtils.clearAllVisibleRecentTasks(instrumentation)
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.wm.shell.Utils
import com.android.wm.shell.flicker.utils.RecentTasksUtils
import com.android.wm.shell.flicker.utils.SplitScreenUtils
import org.junit.After
import org.junit.Before
@@ -61,7 +62,6 @@ constructor(val rotation: Rotation = Rotation.ROTATION_0) {

    @After
    fun teardown() {
        primaryApp.exit(wmHelper)
        secondaryApp.exit(wmHelper)
        RecentTasksUtils.clearAllVisibleRecentTasks(instrumentation)
    }
}
+27 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.
 */

package com.android.wm.shell.flicker.utils

import android.app.Instrumentation

object RecentTasksUtils {
    fun clearAllVisibleRecentTasks(instrumentation: Instrumentation) {
        instrumentation.uiAutomation.executeShellCommand(
            "dumpsys activity service SystemUIService WMShell recents clearAll"
        )
    }
}
 No newline at end of file