Wait for split screen apps to be visible
Previously used a fixed timeout, which was not reliable. Now wait for both apps or for the non-resizeable one Test: atest WMShellFlickerTests Bug: 189997782 Change-Id: I60d79317d5d1f684b8a4a75b3f3e6ad7d1048bcd
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.wm.shell.flicker.apppairs
|
||||
|
||||
import android.os.SystemClock
|
||||
import android.platform.test.annotations.Presubmit
|
||||
import androidx.test.filters.FlakyTest
|
||||
import androidx.test.filters.RequiresDevice
|
||||
@@ -61,7 +60,7 @@ class AppPairsTestCannotPairNonResizeableApps(
|
||||
// TODO pair apps through normal UX flow
|
||||
executeShellCommand(
|
||||
composePairsCommand(primaryTaskId, nonResizeableTaskId, pair = true))
|
||||
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
|
||||
nonResizeableApp?.run { wmHelper.waitForFullScreenApp(nonResizeableApp.component) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.wm.shell.flicker.apppairs
|
||||
|
||||
import android.os.SystemClock
|
||||
import android.platform.test.annotations.Presubmit
|
||||
import androidx.test.filters.FlakyTest
|
||||
import androidx.test.filters.RequiresDevice
|
||||
@@ -29,6 +28,7 @@ import com.android.server.wm.flicker.traces.layers.getVisibleBounds
|
||||
import com.android.wm.shell.flicker.APP_PAIR_SPLIT_DIVIDER
|
||||
import com.android.wm.shell.flicker.appPairsDividerIsVisible
|
||||
import com.android.wm.shell.flicker.helpers.AppPairsHelper
|
||||
import com.android.wm.shell.flicker.helpers.AppPairsHelper.Companion.waitAppsShown
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -54,7 +54,7 @@ class AppPairsTestPairPrimaryAndSecondaryApps(
|
||||
// TODO pair apps through normal UX flow
|
||||
executeShellCommand(
|
||||
composePairsCommand(primaryTaskId, secondaryTaskId, pair = true))
|
||||
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
|
||||
waitAppsShown(primaryApp, secondaryApp)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.wm.shell.flicker.apppairs
|
||||
|
||||
import android.os.SystemClock
|
||||
import android.platform.test.annotations.Presubmit
|
||||
import androidx.test.filters.FlakyTest
|
||||
import androidx.test.filters.RequiresDevice
|
||||
@@ -61,7 +60,7 @@ class AppPairsTestSupportPairNonResizeableApps(
|
||||
// TODO pair apps through normal UX flow
|
||||
executeShellCommand(
|
||||
composePairsCommand(primaryTaskId, nonResizeableTaskId, pair = true))
|
||||
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
|
||||
nonResizeableApp?.run { wmHelper.waitForFullScreenApp(nonResizeableApp.component) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.android.server.wm.flicker.traces.layers.getVisibleBounds
|
||||
import com.android.wm.shell.flicker.APP_PAIR_SPLIT_DIVIDER
|
||||
import com.android.wm.shell.flicker.appPairsDividerIsInvisible
|
||||
import com.android.wm.shell.flicker.helpers.AppPairsHelper
|
||||
import com.android.wm.shell.flicker.helpers.AppPairsHelper.Companion.waitAppsShown
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -51,9 +52,11 @@ class AppPairsTestUnpairPrimaryAndSecondaryApps(
|
||||
get() = {
|
||||
super.transition(this, it)
|
||||
setup {
|
||||
executeShellCommand(
|
||||
composePairsCommand(primaryTaskId, secondaryTaskId, pair = true))
|
||||
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
|
||||
eachRun {
|
||||
executeShellCommand(
|
||||
composePairsCommand(primaryTaskId, secondaryTaskId, pair = true))
|
||||
waitAppsShown(primaryApp, secondaryApp)
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
// TODO pair apps through normal UX flow
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.wm.shell.flicker.apppairs
|
||||
|
||||
import android.os.SystemClock
|
||||
import android.platform.test.annotations.Presubmit
|
||||
import android.view.Surface
|
||||
import androidx.test.filters.FlakyTest
|
||||
@@ -31,7 +30,7 @@ import com.android.server.wm.flicker.helpers.setRotation
|
||||
import com.android.wm.shell.flicker.appPairsDividerIsVisible
|
||||
import com.android.wm.shell.flicker.appPairsPrimaryBoundsIsVisible
|
||||
import com.android.wm.shell.flicker.appPairsSecondaryBoundsIsVisible
|
||||
import com.android.wm.shell.flicker.helpers.AppPairsHelper
|
||||
import com.android.wm.shell.flicker.helpers.AppPairsHelper.Companion.waitAppsShown
|
||||
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Test
|
||||
@@ -57,7 +56,7 @@ class RotateTwoLaunchedAppsInAppPairsMode(
|
||||
transitions {
|
||||
executeShellCommand(composePairsCommand(
|
||||
primaryTaskId, secondaryTaskId, true /* pair */))
|
||||
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
|
||||
waitAppsShown(primaryApp, secondaryApp)
|
||||
setRotation(testSpec.config.endRotation)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.wm.shell.flicker.apppairs
|
||||
|
||||
import android.os.SystemClock
|
||||
import android.platform.test.annotations.Presubmit
|
||||
import android.view.Surface
|
||||
import androidx.test.filters.FlakyTest
|
||||
@@ -33,7 +32,7 @@ import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
|
||||
import com.android.wm.shell.flicker.appPairsDividerIsVisible
|
||||
import com.android.wm.shell.flicker.appPairsPrimaryBoundsIsVisible
|
||||
import com.android.wm.shell.flicker.appPairsSecondaryBoundsIsVisible
|
||||
import com.android.wm.shell.flicker.helpers.AppPairsHelper
|
||||
import com.android.wm.shell.flicker.helpers.AppPairsHelper.Companion.waitAppsShown
|
||||
import com.android.wm.shell.flicker.helpers.SplitScreenHelper
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Test
|
||||
@@ -60,7 +59,7 @@ class RotateTwoLaunchedAppsRotateAndEnterAppPairsMode(
|
||||
this.setRotation(testSpec.config.endRotation)
|
||||
executeShellCommand(
|
||||
composePairsCommand(primaryTaskId, secondaryTaskId, pair = true))
|
||||
SystemClock.sleep(AppPairsHelper.TIMEOUT_MS)
|
||||
waitAppsShown(primaryApp, secondaryApp)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.wm.shell.flicker.helpers
|
||||
import android.app.Instrumentation
|
||||
import android.content.ComponentName
|
||||
import android.graphics.Region
|
||||
import com.android.server.wm.flicker.Flicker
|
||||
import com.android.server.wm.flicker.helpers.WindowUtils
|
||||
|
||||
class AppPairsHelper(
|
||||
@@ -43,5 +44,17 @@ class AppPairsHelper(
|
||||
companion object {
|
||||
const val TEST_REPETITIONS = 1
|
||||
const val TIMEOUT_MS = 3_000L
|
||||
|
||||
fun Flicker.waitAppsShown(app1: SplitScreenHelper?, app2: SplitScreenHelper?) {
|
||||
wmHelper.waitFor("primaryAndSecondaryAppsVisible") { dump ->
|
||||
val primaryAppVisible = app1?.let {
|
||||
dump.wmState.isWindowSurfaceShown(app1.defaultWindowName)
|
||||
} ?: false
|
||||
val secondaryAppVisible = app2?.let {
|
||||
dump.wmState.isWindowSurfaceShown(app2.defaultWindowName)
|
||||
} ?: false
|
||||
primaryAppVisible && secondaryAppVisible
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user