Fix SetRequestedOrientationWhilePinnedTest with Shell transition
When the windowing mode is changed during fixed rotation, we don't want to animate to the fixed rotation anymore, because the fixed rotation will be cancelled later. Bug: 214324061 Test: atest WMShellFlickerTests:SetRequestedOrientationWhilePinnedTest Change-Id: I24b5389ec2b6ea28ce3ba7abf38fbd269566edf3
This commit is contained in:
@@ -56,13 +56,6 @@ abstract class PipTransition(protected val testSpec: FlickerTestParameter) {
|
||||
.sendBroadcast(createIntentWithAction(broadcastAction))
|
||||
}
|
||||
|
||||
fun requestOrientationForPip(orientation: Int) {
|
||||
instrumentation.context.sendBroadcast(
|
||||
createIntentWithAction(Components.PipActivity.ACTION_SET_REQUESTED_ORIENTATION)
|
||||
.putExtra(Components.PipActivity.EXTRA_PIP_ORIENTATION, orientation.toString())
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
// Corresponds to ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|
||||
@JvmStatic
|
||||
|
||||
@@ -28,8 +28,8 @@ import com.android.server.wm.flicker.dsl.FlickerBuilder
|
||||
import com.android.server.wm.flicker.helpers.WindowUtils
|
||||
import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled
|
||||
import com.android.wm.shell.flicker.pip.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_LANDSCAPE
|
||||
import com.android.wm.shell.flicker.testapp.Components
|
||||
import com.android.wm.shell.flicker.testapp.Components.FixedActivity.EXTRA_FIXED_ORIENTATION
|
||||
import com.android.wm.shell.flicker.testapp.Components.PipActivity.EXTRA_ENTER_PIP
|
||||
import org.junit.Assume
|
||||
import org.junit.Before
|
||||
import org.junit.FixMethodOrder
|
||||
@@ -39,7 +39,7 @@ import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test Pip with orientation changes.
|
||||
* Test exiting Pip with orientation changes.
|
||||
* To run this test: `atest WMShellFlickerTests:SetRequestedOrientationWhilePinnedTest`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@@ -65,10 +65,16 @@ open class SetRequestedOrientationWhilePinnedTest(
|
||||
|
||||
setup {
|
||||
eachRun {
|
||||
// Launch the PiP activity fixed as landscape
|
||||
// Launch the PiP activity fixed as landscape.
|
||||
pipApp.launchViaIntent(wmHelper, stringExtras = mapOf(
|
||||
EXTRA_FIXED_ORIENTATION to ORIENTATION_LANDSCAPE.toString(),
|
||||
EXTRA_ENTER_PIP to "true"))
|
||||
EXTRA_FIXED_ORIENTATION to ORIENTATION_LANDSCAPE.toString()))
|
||||
// Enter PiP.
|
||||
broadcastActionTrigger.doAction(Components.PipActivity.ACTION_ENTER_PIP)
|
||||
wmHelper.waitPipShown()
|
||||
wmHelper.waitForRotation(Surface.ROTATION_0)
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
// System bar may fade out during fixed rotation.
|
||||
wmHelper.waitForNavBarStatusBarVisible()
|
||||
}
|
||||
}
|
||||
teardown {
|
||||
@@ -77,14 +83,13 @@ open class SetRequestedOrientationWhilePinnedTest(
|
||||
}
|
||||
}
|
||||
transitions {
|
||||
// Request that the orientation is set to landscape
|
||||
broadcastActionTrigger.requestOrientationForPip(ORIENTATION_LANDSCAPE)
|
||||
|
||||
// Launch the activity back into fullscreen and
|
||||
// ensure that it is now in landscape
|
||||
// Launch the activity back into fullscreen and ensure that it is now in landscape
|
||||
pipApp.launchViaIntent(wmHelper)
|
||||
wmHelper.waitForFullScreenApp(pipApp.component)
|
||||
wmHelper.waitForRotation(Surface.ROTATION_90)
|
||||
wmHelper.waitForAppTransitionIdle()
|
||||
// System bar may fade out during fixed rotation.
|
||||
wmHelper.waitForNavBarStatusBarVisible()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,10 @@ import org.junit.runner.RunWith
|
||||
import org.junit.runners.MethodSorters
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
/**
|
||||
* Test exiting Pip with orientation changes.
|
||||
* To run this test: `atest WMShellFlickerTests:SetRequestedOrientationWhilePinnedTestShellTransit`
|
||||
*/
|
||||
@RequiresDevice
|
||||
@RunWith(Parameterized::class)
|
||||
@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class)
|
||||
|
||||
@@ -1262,7 +1262,11 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
|
||||
change.setAllowEnterPip(topMostActivity != null
|
||||
&& topMostActivity.checkEnterPictureInPictureAppOpsState());
|
||||
final ActivityRecord topRunningActivity = task.topRunningActivity();
|
||||
if (topRunningActivity != null && task.mDisplayContent != null) {
|
||||
if (topRunningActivity != null && task.mDisplayContent != null
|
||||
// Display won't be rotated for multi window Task, so the fixed rotation
|
||||
// won't be applied. This can happen when the windowing mode is changed
|
||||
// before the previous fixed rotation is applied.
|
||||
&& !task.inMultiWindowMode()) {
|
||||
// If Activity is in fixed rotation, its will be applied with the next rotation,
|
||||
// when the Task is still in the previous rotation.
|
||||
final int taskRotation = task.getWindowConfiguration().getDisplayRotation();
|
||||
|
||||
Reference in New Issue
Block a user