Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java +10 −10 Original line number Diff line number Diff line Loading @@ -201,24 +201,24 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange /** Applies new configuration, returns {@code false} if there's no effect to the layout. */ public boolean updateConfiguration(Configuration configuration) { // Always update configuration after orientation changed to make sure to render divider bar // with proper resources that matching screen orientation. final int orientation = configuration.orientation; if (mOrientation != orientation) { mContext = mContext.createConfigurationContext(configuration); mSplitWindowManager.setConfiguration(configuration); mOrientation = orientation; } // Update the split bounds when necessary. Besides root bounds changed, split bounds need to // be updated when the rotation changed to cover the case that users rotated the screen 180 // degrees. // Make sure to render the divider bar with proper resources that matching the screen // orientation. final int rotation = configuration.windowConfiguration.getRotation(); final Rect rootBounds = configuration.windowConfiguration.getBounds(); final int orientation = configuration.orientation; if (mOrientation == orientation && rotation == mRotation && mRootBounds.equals(rootBounds)) { if (mRotation == rotation && mRootBounds.equals(rootBounds)) { return false; } mContext = mContext.createConfigurationContext(configuration); mSplitWindowManager.setConfiguration(configuration); mOrientation = orientation; mTempRect.set(mRootBounds); mRootBounds.set(rootBounds); mRotation = rotation; Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +4 −4 Original line number Diff line number Diff line Loading @@ -1228,13 +1228,10 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, // Only do this when shell transition if (!ENABLE_SHELL_TRANSITIONS) return; final SurfaceControl.Transaction t = mTransactionPool.acquire(); mDisplayLayout.rotateTo(mContext.getResources(), toRotation); mSplitLayout.rotateTo(toRotation, mDisplayLayout.stableInsets()); updateWindowBounds(mSplitLayout, wct); updateUnfoldBounds(); t.apply(); mTransactionPool.release(t); } private void onFoldedStateChanged(boolean folded) { Loading Loading @@ -1286,7 +1283,10 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, final ActivityManager.RunningTaskInfo triggerTask = request.getTriggerTask(); if (triggerTask == null) { if (mMainStage.isActive()) { if (request.getType() == TRANSIT_CHANGE && request.getDisplayChange() != null) { final TransitionRequestInfo.DisplayChange displayChange = request.getDisplayChange(); if (request.getType() == TRANSIT_CHANGE && displayChange != null && displayChange.getStartRotation() != displayChange.getEndRotation()) { mSplitLayout.setFreezeDividerWindow(true); } // Still want to monitor everything while in split-screen, so return non-null. Loading libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java +9 −1 Original line number Diff line number Diff line Loading @@ -369,12 +369,20 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { } if (change.getMode() == TRANSIT_CHANGE) { // If task is child task, only set position in parent. // If task is child task, only set position in parent and update crop when needed. if (isTask && change.getParent() != null && info.getChange(change.getParent()).getTaskInfo() != null) { final Point positionInParent = change.getTaskInfo().positionInParent; startTransaction.setPosition(change.getLeash(), positionInParent.x, positionInParent.y); if (!change.getEndAbsBounds().equals( info.getChange(change.getParent()).getEndAbsBounds())) { startTransaction.setWindowCrop(change.getLeash(), change.getEndAbsBounds().width(), change.getEndAbsBounds().height()); } continue; } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/split/SplitLayoutTests.java +0 −5 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.wm.shell.common.split; import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static com.google.common.truth.Truth.assertThat; Loading Loading @@ -85,10 +84,6 @@ public class SplitLayoutTests extends ShellTestCase { // Verify it returns true if new config won't affect split layout. assertThat(mSplitLayout.updateConfiguration(config)).isFalse(); // Verify updateConfiguration returns true if the orientation changed. config.orientation = ORIENTATION_LANDSCAPE; assertThat(mSplitLayout.updateConfiguration(config)).isTrue(); // Verify updateConfiguration returns true if it rotated. config.windowConfiguration.setRotation(1); assertThat(mSplitLayout.updateConfiguration(config)).isTrue(); Loading services/core/java/com/android/server/wm/Task.java +1 −1 Original line number Diff line number Diff line Loading @@ -2701,7 +2701,7 @@ class Task extends TaskFragment { @Override void onDisplayChanged(DisplayContent dc) { final boolean isRootTask = isRootTask(); if (!isRootTask) { if (!isRootTask && !mCreatedByOrganizer) { adjustBoundsForDisplayChangeIfNeeded(dc); } super.onDisplayChanged(dc); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java +10 −10 Original line number Diff line number Diff line Loading @@ -201,24 +201,24 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange /** Applies new configuration, returns {@code false} if there's no effect to the layout. */ public boolean updateConfiguration(Configuration configuration) { // Always update configuration after orientation changed to make sure to render divider bar // with proper resources that matching screen orientation. final int orientation = configuration.orientation; if (mOrientation != orientation) { mContext = mContext.createConfigurationContext(configuration); mSplitWindowManager.setConfiguration(configuration); mOrientation = orientation; } // Update the split bounds when necessary. Besides root bounds changed, split bounds need to // be updated when the rotation changed to cover the case that users rotated the screen 180 // degrees. // Make sure to render the divider bar with proper resources that matching the screen // orientation. final int rotation = configuration.windowConfiguration.getRotation(); final Rect rootBounds = configuration.windowConfiguration.getBounds(); final int orientation = configuration.orientation; if (mOrientation == orientation && rotation == mRotation && mRootBounds.equals(rootBounds)) { if (mRotation == rotation && mRootBounds.equals(rootBounds)) { return false; } mContext = mContext.createConfigurationContext(configuration); mSplitWindowManager.setConfiguration(configuration); mOrientation = orientation; mTempRect.set(mRootBounds); mRootBounds.set(rootBounds); mRotation = rotation; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +4 −4 Original line number Diff line number Diff line Loading @@ -1228,13 +1228,10 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, // Only do this when shell transition if (!ENABLE_SHELL_TRANSITIONS) return; final SurfaceControl.Transaction t = mTransactionPool.acquire(); mDisplayLayout.rotateTo(mContext.getResources(), toRotation); mSplitLayout.rotateTo(toRotation, mDisplayLayout.stableInsets()); updateWindowBounds(mSplitLayout, wct); updateUnfoldBounds(); t.apply(); mTransactionPool.release(t); } private void onFoldedStateChanged(boolean folded) { Loading Loading @@ -1286,7 +1283,10 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler, final ActivityManager.RunningTaskInfo triggerTask = request.getTriggerTask(); if (triggerTask == null) { if (mMainStage.isActive()) { if (request.getType() == TRANSIT_CHANGE && request.getDisplayChange() != null) { final TransitionRequestInfo.DisplayChange displayChange = request.getDisplayChange(); if (request.getType() == TRANSIT_CHANGE && displayChange != null && displayChange.getStartRotation() != displayChange.getEndRotation()) { mSplitLayout.setFreezeDividerWindow(true); } // Still want to monitor everything while in split-screen, so return non-null. Loading
libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java +9 −1 Original line number Diff line number Diff line Loading @@ -369,12 +369,20 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { } if (change.getMode() == TRANSIT_CHANGE) { // If task is child task, only set position in parent. // If task is child task, only set position in parent and update crop when needed. if (isTask && change.getParent() != null && info.getChange(change.getParent()).getTaskInfo() != null) { final Point positionInParent = change.getTaskInfo().positionInParent; startTransaction.setPosition(change.getLeash(), positionInParent.x, positionInParent.y); if (!change.getEndAbsBounds().equals( info.getChange(change.getParent()).getEndAbsBounds())) { startTransaction.setWindowCrop(change.getLeash(), change.getEndAbsBounds().width(), change.getEndAbsBounds().height()); } continue; } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/split/SplitLayoutTests.java +0 −5 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.wm.shell.common.split; import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static com.google.common.truth.Truth.assertThat; Loading Loading @@ -85,10 +84,6 @@ public class SplitLayoutTests extends ShellTestCase { // Verify it returns true if new config won't affect split layout. assertThat(mSplitLayout.updateConfiguration(config)).isFalse(); // Verify updateConfiguration returns true if the orientation changed. config.orientation = ORIENTATION_LANDSCAPE; assertThat(mSplitLayout.updateConfiguration(config)).isTrue(); // Verify updateConfiguration returns true if it rotated. config.windowConfiguration.setRotation(1); assertThat(mSplitLayout.updateConfiguration(config)).isTrue(); Loading
services/core/java/com/android/server/wm/Task.java +1 −1 Original line number Diff line number Diff line Loading @@ -2701,7 +2701,7 @@ class Task extends TaskFragment { @Override void onDisplayChanged(DisplayContent dc) { final boolean isRootTask = isRootTask(); if (!isRootTask) { if (!isRootTask && !mCreatedByOrganizer) { adjustBoundsForDisplayChangeIfNeeded(dc); } super.onDisplayChanged(dc); Loading