Loading libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipTransition.kt +0 −7 Original line number Diff line number Diff line Loading @@ -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 Loading libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/SetRequestedOrientationWhilePinnedTest.kt +15 −10 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading @@ -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 { Loading @@ -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() } } Loading libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/SetRequestedOrientationWhilePinnedTestShellTransit.kt +4 −0 Original line number Diff line number Diff line Loading @@ -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) Loading services/core/java/com/android/server/wm/Transition.java +5 −1 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading
libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/PipTransition.kt +0 −7 Original line number Diff line number Diff line Loading @@ -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 Loading
libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/SetRequestedOrientationWhilePinnedTest.kt +15 −10 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading @@ -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 { Loading @@ -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() } } Loading
libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/SetRequestedOrientationWhilePinnedTestShellTransit.kt +4 −0 Original line number Diff line number Diff line Loading @@ -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) Loading
services/core/java/com/android/server/wm/Transition.java +5 −1 Original line number Diff line number Diff line Loading @@ -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(); Loading