Loading core/java/android/view/IWindowManager.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -1145,4 +1145,9 @@ interface IWindowManager * @param deviceId The id of the {@link InputDevice} that will handle the shortcut. */ KeyboardShortcutGroup getApplicationLaunchKeyboardShortcuts(int deviceId); /** * Returns whether the display with {@code displayId} ignores orientation request. */ boolean getIgnoreOrientationRequest(int displayId); } libs/WindowManager/Shell/tests/flicker/pip/src/com/android/wm/shell/flicker/pip/EnterPipToOtherOrientation.kt +18 −16 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.tools.flicker.legacy.LegacyFlickerTest import android.tools.flicker.legacy.LegacyFlickerTestFactory import android.tools.helpers.WindowUtils import android.tools.traces.component.ComponentNameMatcher import android.view.WindowManagerGlobal import androidx.test.filters.FlakyTest import com.android.server.wm.flicker.entireScreenCovered import com.android.server.wm.flicker.helpers.FixedOrientationAppHelper Loading @@ -38,13 +39,12 @@ import com.android.wm.shell.flicker.pip.common.PipTransition import com.android.wm.shell.flicker.pip.common.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_LANDSCAPE import com.android.wm.shell.flicker.pip.common.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_PORTRAIT import org.junit.Assume.assumeFalse import org.junit.Assume.assumeTrue import org.junit.FixMethodOrder import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters import org.junit.runners.Parameterized import java.lang.AssertionError /** * Test entering pip while changing orientation (from app in landscape to pip window in portrait) Loading Loading @@ -75,7 +75,15 @@ import org.junit.runners.Parameterized open class EnterPipToOtherOrientation(flicker: LegacyFlickerTest) : PipTransition(flicker) { override val pipApp: PipAppHelper = PipAppHelper(instrumentation) internal val testApp = FixedOrientationAppHelper(instrumentation) internal val startingBounds = WindowUtils.getDisplayBounds(Rotation.ROTATION_90) internal val ignoreOrientationRequest = WindowManagerGlobal.getWindowManagerService() ?.getIgnoreOrientationRequest(WindowUtils.defaultDisplayId) ?: throw AssertionError("WMS must not be null.") internal val startingBounds = if (ignoreOrientationRequest) { // If the device chooses to ignore orientation request, use the current display bounds. WindowUtils.getDisplayBounds(Rotation.ROTATION_0) } else { WindowUtils.getDisplayBounds(Rotation.ROTATION_90) } private val endingBounds = WindowUtils.getDisplayBounds(Rotation.ROTATION_0) override val thisTransition: FlickerBuilder.() -> Unit = { Loading Loading @@ -167,20 +175,14 @@ open class EnterPipToOtherOrientation(flicker: LegacyFlickerTest) : PipTransitio @Presubmit @Test open fun pipAppLayerCoversFullScreenOnStart() { assumeFalse(tapl.isTablet) flicker.assertLayersStart { visibleRegion(pipApp).coversExactly(startingBounds) } } /** * Checks that the visible region of [pipApp] covers the full display area at the start of the * transition */ @Ignore("TODO(b/356277166): enable the tablet test") @Test open fun pipAppLayerPlusLetterboxCoversFullScreenOnStartTablet() { assumeTrue(tapl.isTablet) flicker.assertLayersStart { visibleRegion(pipApp.or(ComponentNameMatcher.LETTERBOX)).coversExactly(startingBounds) visibleRegion( if (ignoreOrientationRequest) { pipApp.or(ComponentNameMatcher.LETTERBOX) } else { pipApp } ).coversExactly(startingBounds) } } Loading libs/WindowManager/Shell/tests/flicker/pip/src/com/android/wm/shell/flicker/pip/nonmatchparent/BottomHalfEnterPipToOtherOrientation.kt +7 −15 Original line number Diff line number Diff line Loading @@ -26,10 +26,7 @@ import com.android.server.wm.flicker.helpers.BottomHalfPipAppHelper import com.android.server.wm.flicker.helpers.PipAppHelper import com.android.wm.shell.Flags import com.android.wm.shell.flicker.pip.EnterPipToOtherOrientation import org.junit.Assume.assumeFalse import org.junit.Assume.assumeTrue import org.junit.FixMethodOrder import org.junit.Ignore import org.junit.Test import org.junit.runners.MethodSorters import org.junit.runners.Parameterized Loading Loading @@ -71,19 +68,14 @@ class BottomHalfEnterPipToOtherOrientation(flicker: LegacyFlickerTest) : @Test override fun pipAppLayerCoversFullScreenOnStart() { // Test app and pip app should covers the entire screen on start. assumeFalse(tapl.isTablet) flicker.assertLayersStart { visibleRegion(pipApp.or(testApp)).coversExactly(startingBounds) visibleRegion( if (ignoreOrientationRequest) { pipApp.or(testApp).or(ComponentNameMatcher.LETTERBOX) } else { pipApp.or(testApp) } } @Ignore("TODO(b/356277166): enable the tablet test") @Test override fun pipAppLayerPlusLetterboxCoversFullScreenOnStartTablet() { // Test app and pip app should covers the entire screen on start. assumeTrue(tapl.isTablet) flicker.assertLayersStart { visibleRegion(pipApp.or(ComponentNameMatcher.LETTERBOX)).coversExactly(startingBounds) ).coversExactly(startingBounds) } } Loading services/core/java/com/android/server/wm/WindowManagerService.java +2 −1 Original line number Diff line number Diff line Loading @@ -4309,7 +4309,8 @@ public class WindowManagerService extends IWindowManager.Stub } } boolean getIgnoreOrientationRequest(int displayId) { @Override public boolean getIgnoreOrientationRequest(int displayId) { synchronized (mGlobalLock) { final DisplayContent display = mRoot.getDisplayContent(displayId); if (display == null) { Loading tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/BottomHalfPipAppHelper.kt +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ import com.android.server.wm.flicker.testapp.ActivityOptions.BottomHalfPip class BottomHalfPipAppHelper( instrumentation: Instrumentation, private val useLaunchingActivity: Boolean = false, private val fillTaskOnCreate: Boolean = true, private val fillTaskOnCreate: Boolean = false, ) : PipAppHelper( instrumentation, appName = BottomHalfPip.LABEL, Loading Loading
core/java/android/view/IWindowManager.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -1145,4 +1145,9 @@ interface IWindowManager * @param deviceId The id of the {@link InputDevice} that will handle the shortcut. */ KeyboardShortcutGroup getApplicationLaunchKeyboardShortcuts(int deviceId); /** * Returns whether the display with {@code displayId} ignores orientation request. */ boolean getIgnoreOrientationRequest(int displayId); }
libs/WindowManager/Shell/tests/flicker/pip/src/com/android/wm/shell/flicker/pip/EnterPipToOtherOrientation.kt +18 −16 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.tools.flicker.legacy.LegacyFlickerTest import android.tools.flicker.legacy.LegacyFlickerTestFactory import android.tools.helpers.WindowUtils import android.tools.traces.component.ComponentNameMatcher import android.view.WindowManagerGlobal import androidx.test.filters.FlakyTest import com.android.server.wm.flicker.entireScreenCovered import com.android.server.wm.flicker.helpers.FixedOrientationAppHelper Loading @@ -38,13 +39,12 @@ import com.android.wm.shell.flicker.pip.common.PipTransition import com.android.wm.shell.flicker.pip.common.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_LANDSCAPE import com.android.wm.shell.flicker.pip.common.PipTransition.BroadcastActionTrigger.Companion.ORIENTATION_PORTRAIT import org.junit.Assume.assumeFalse import org.junit.Assume.assumeTrue import org.junit.FixMethodOrder import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.MethodSorters import org.junit.runners.Parameterized import java.lang.AssertionError /** * Test entering pip while changing orientation (from app in landscape to pip window in portrait) Loading Loading @@ -75,7 +75,15 @@ import org.junit.runners.Parameterized open class EnterPipToOtherOrientation(flicker: LegacyFlickerTest) : PipTransition(flicker) { override val pipApp: PipAppHelper = PipAppHelper(instrumentation) internal val testApp = FixedOrientationAppHelper(instrumentation) internal val startingBounds = WindowUtils.getDisplayBounds(Rotation.ROTATION_90) internal val ignoreOrientationRequest = WindowManagerGlobal.getWindowManagerService() ?.getIgnoreOrientationRequest(WindowUtils.defaultDisplayId) ?: throw AssertionError("WMS must not be null.") internal val startingBounds = if (ignoreOrientationRequest) { // If the device chooses to ignore orientation request, use the current display bounds. WindowUtils.getDisplayBounds(Rotation.ROTATION_0) } else { WindowUtils.getDisplayBounds(Rotation.ROTATION_90) } private val endingBounds = WindowUtils.getDisplayBounds(Rotation.ROTATION_0) override val thisTransition: FlickerBuilder.() -> Unit = { Loading Loading @@ -167,20 +175,14 @@ open class EnterPipToOtherOrientation(flicker: LegacyFlickerTest) : PipTransitio @Presubmit @Test open fun pipAppLayerCoversFullScreenOnStart() { assumeFalse(tapl.isTablet) flicker.assertLayersStart { visibleRegion(pipApp).coversExactly(startingBounds) } } /** * Checks that the visible region of [pipApp] covers the full display area at the start of the * transition */ @Ignore("TODO(b/356277166): enable the tablet test") @Test open fun pipAppLayerPlusLetterboxCoversFullScreenOnStartTablet() { assumeTrue(tapl.isTablet) flicker.assertLayersStart { visibleRegion(pipApp.or(ComponentNameMatcher.LETTERBOX)).coversExactly(startingBounds) visibleRegion( if (ignoreOrientationRequest) { pipApp.or(ComponentNameMatcher.LETTERBOX) } else { pipApp } ).coversExactly(startingBounds) } } Loading
libs/WindowManager/Shell/tests/flicker/pip/src/com/android/wm/shell/flicker/pip/nonmatchparent/BottomHalfEnterPipToOtherOrientation.kt +7 −15 Original line number Diff line number Diff line Loading @@ -26,10 +26,7 @@ import com.android.server.wm.flicker.helpers.BottomHalfPipAppHelper import com.android.server.wm.flicker.helpers.PipAppHelper import com.android.wm.shell.Flags import com.android.wm.shell.flicker.pip.EnterPipToOtherOrientation import org.junit.Assume.assumeFalse import org.junit.Assume.assumeTrue import org.junit.FixMethodOrder import org.junit.Ignore import org.junit.Test import org.junit.runners.MethodSorters import org.junit.runners.Parameterized Loading Loading @@ -71,19 +68,14 @@ class BottomHalfEnterPipToOtherOrientation(flicker: LegacyFlickerTest) : @Test override fun pipAppLayerCoversFullScreenOnStart() { // Test app and pip app should covers the entire screen on start. assumeFalse(tapl.isTablet) flicker.assertLayersStart { visibleRegion(pipApp.or(testApp)).coversExactly(startingBounds) visibleRegion( if (ignoreOrientationRequest) { pipApp.or(testApp).or(ComponentNameMatcher.LETTERBOX) } else { pipApp.or(testApp) } } @Ignore("TODO(b/356277166): enable the tablet test") @Test override fun pipAppLayerPlusLetterboxCoversFullScreenOnStartTablet() { // Test app and pip app should covers the entire screen on start. assumeTrue(tapl.isTablet) flicker.assertLayersStart { visibleRegion(pipApp.or(ComponentNameMatcher.LETTERBOX)).coversExactly(startingBounds) ).coversExactly(startingBounds) } } Loading
services/core/java/com/android/server/wm/WindowManagerService.java +2 −1 Original line number Diff line number Diff line Loading @@ -4309,7 +4309,8 @@ public class WindowManagerService extends IWindowManager.Stub } } boolean getIgnoreOrientationRequest(int displayId) { @Override public boolean getIgnoreOrientationRequest(int displayId) { synchronized (mGlobalLock) { final DisplayContent display = mRoot.getDisplayContent(displayId); if (display == null) { Loading
tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/BottomHalfPipAppHelper.kt +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ import com.android.server.wm.flicker.testapp.ActivityOptions.BottomHalfPip class BottomHalfPipAppHelper( instrumentation: Instrumentation, private val useLaunchingActivity: Boolean = false, private val fillTaskOnCreate: Boolean = true, private val fillTaskOnCreate: Boolean = false, ) : PipAppHelper( instrumentation, appName = BottomHalfPip.LABEL, Loading