Loading services/core/java/com/android/server/wm/DisplayContent.java +5 −4 Original line number Diff line number Diff line Loading @@ -1835,7 +1835,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (mTransitionController.useShellTransitionsRotation()) { return ROTATION_UNDEFINED; } final int activityOrientation = r.getOverrideOrientation(); int activityOrientation = r.getOverrideOrientation(); if (!WindowManagerService.ENABLE_FIXED_ROTATION_TRANSFORM || shouldIgnoreOrientationRequest(activityOrientation)) { return ROTATION_UNDEFINED; Loading @@ -1846,14 +1846,15 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp r /* boundary */, false /* includeBoundary */, true /* traverseTopToBottom */); if (nextCandidate != null) { r = nextCandidate; activityOrientation = r.getOverrideOrientation(); } } if (r.inMultiWindowMode() || r.getRequestedConfigurationOrientation(true /* forDisplay */) == getConfiguration().orientation) { if (r.inMultiWindowMode() || r.getRequestedConfigurationOrientation(true /* forDisplay */, activityOrientation) == getConfiguration().orientation) { return ROTATION_UNDEFINED; } final int currentRotation = getRotation(); final int rotation = mDisplayRotation.rotationForOrientation(r.getRequestedOrientation(), final int rotation = mDisplayRotation.rotationForOrientation(activityOrientation, currentRotation); if (rotation == currentRotation) { return ROTATION_UNDEFINED; Loading services/core/java/com/android/server/wm/WindowContainer.java +7 −7 Original line number Diff line number Diff line Loading @@ -1731,13 +1731,13 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< * last time {@link #getOrientation(int) was called. */ @Nullable WindowContainer getLastOrientationSource() { final WindowContainer source = mLastOrientationSource; if (source != null && source != this) { final WindowContainer nextSource = source.getLastOrientationSource(); if (nextSource != null) { return nextSource; final WindowContainer<?> getLastOrientationSource() { if (mLastOrientationSource == null) { return null; } WindowContainer<?> source = this; while (source != source.mLastOrientationSource && source.mLastOrientationSource != null) { source = source.mLastOrientationSource; } return source; } Loading services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +1 −0 Original line number Diff line number Diff line Loading @@ -1144,6 +1144,7 @@ public class DisplayContentTests extends WindowTestsBase { @Test public void testOrientationBehind() { assertNull(mDisplayContent.getLastOrientationSource()); final ActivityRecord prev = new ActivityBuilder(mAtm).setCreateTask(true) .setScreenOrientation(getRotatedOrientation(mDisplayContent)).build(); prev.setVisibleRequested(false); Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +5 −4 Original line number Diff line number Diff line Loading @@ -1835,7 +1835,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (mTransitionController.useShellTransitionsRotation()) { return ROTATION_UNDEFINED; } final int activityOrientation = r.getOverrideOrientation(); int activityOrientation = r.getOverrideOrientation(); if (!WindowManagerService.ENABLE_FIXED_ROTATION_TRANSFORM || shouldIgnoreOrientationRequest(activityOrientation)) { return ROTATION_UNDEFINED; Loading @@ -1846,14 +1846,15 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp r /* boundary */, false /* includeBoundary */, true /* traverseTopToBottom */); if (nextCandidate != null) { r = nextCandidate; activityOrientation = r.getOverrideOrientation(); } } if (r.inMultiWindowMode() || r.getRequestedConfigurationOrientation(true /* forDisplay */) == getConfiguration().orientation) { if (r.inMultiWindowMode() || r.getRequestedConfigurationOrientation(true /* forDisplay */, activityOrientation) == getConfiguration().orientation) { return ROTATION_UNDEFINED; } final int currentRotation = getRotation(); final int rotation = mDisplayRotation.rotationForOrientation(r.getRequestedOrientation(), final int rotation = mDisplayRotation.rotationForOrientation(activityOrientation, currentRotation); if (rotation == currentRotation) { return ROTATION_UNDEFINED; Loading
services/core/java/com/android/server/wm/WindowContainer.java +7 −7 Original line number Diff line number Diff line Loading @@ -1731,13 +1731,13 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< * last time {@link #getOrientation(int) was called. */ @Nullable WindowContainer getLastOrientationSource() { final WindowContainer source = mLastOrientationSource; if (source != null && source != this) { final WindowContainer nextSource = source.getLastOrientationSource(); if (nextSource != null) { return nextSource; final WindowContainer<?> getLastOrientationSource() { if (mLastOrientationSource == null) { return null; } WindowContainer<?> source = this; while (source != source.mLastOrientationSource && source.mLastOrientationSource != null) { source = source.mLastOrientationSource; } return source; } Loading
services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +1 −0 Original line number Diff line number Diff line Loading @@ -1144,6 +1144,7 @@ public class DisplayContentTests extends WindowTestsBase { @Test public void testOrientationBehind() { assertNull(mDisplayContent.getLastOrientationSource()); final ActivityRecord prev = new ActivityBuilder(mAtm).setCreateTask(true) .setScreenOrientation(getRotatedOrientation(mDisplayContent)).build(); prev.setVisibleRequested(false); Loading