Loading services/core/java/com/android/server/wm/PinnedStackController.java +29 −24 Original line number Diff line number Diff line Loading @@ -230,32 +230,37 @@ class PinnedStackController { } /** * @param preChangeTargetBounds The final bounds of the stack if it is currently animating * @return the repositioned PIP bounds given it's pre-change bounds, and the new display * content. * Updates the display info, calculating and returning the new stack and movement bounds in the * new orientation of the device if necessary. */ Rect onDisplayChanged(Rect preChangeStackBounds, Rect preChangeTargetBounds, DisplayContent displayContent) { final Rect postChangeStackBounds = new Rect(preChangeTargetBounds); final DisplayInfo displayInfo = displayContent.getDisplayInfo(); if (!mDisplayInfo.equals(displayInfo)) { // Calculate the snap fraction of the current stack along the old movement bounds, and // then update the stack bounds to the same fraction along the rotated movement bounds. final Rect preChangeMovementBounds = getMovementBounds(preChangeStackBounds); final float snapFraction = mSnapAlgorithm.getSnapFraction(preChangeStackBounds, void onTaskStackBoundsChanged(Rect targetBounds, Rect outBounds) { final DisplayInfo displayInfo = mDisplayContent.getDisplayInfo(); if (mDisplayInfo.equals(displayInfo)) { return; } mTmpRect.set(targetBounds); final Rect postChangeStackBounds = mTmpRect; // Calculate the snap fraction of the current stack along the old movement bounds final Rect preChangeMovementBounds = getMovementBounds(postChangeStackBounds); final float snapFraction = mSnapAlgorithm.getSnapFraction(postChangeStackBounds, preChangeMovementBounds); mDisplayInfo.copyFrom(displayInfo); final Rect postChangeMovementBounds = getMovementBounds(preChangeStackBounds, // Calculate the stack bounds in the new orientation to the same same fraction along the // rotated movement bounds. final Rect postChangeMovementBounds = getMovementBounds(postChangeStackBounds, false /* adjustForIme */); mSnapAlgorithm.applySnapFraction(postChangeStackBounds, postChangeMovementBounds, snapFraction); if (mIsMinimized) { applyMinimizedOffset(postChangeStackBounds, postChangeMovementBounds); } notifyMovementBoundsChanged(false /* fromImeAdjustment */); } return postChangeStackBounds; outBounds.set(postChangeStackBounds); } /** Loading services/core/java/com/android/server/wm/TaskStack.java +15 −16 Original line number Diff line number Diff line Loading @@ -262,6 +262,12 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye if (mDisplayContent != null) { mDisplayContent.mDimLayerController.updateDimLayer(this); if (mStackId == PINNED_STACK_ID) { // Update the bounds based on any changes to the display info getAnimatingBounds(mTmpRect2); mDisplayContent.mPinnedStackControllerLocked.onTaskStackBoundsChanged(mTmpRect2, bounds); } mAnimationBackgroundSurface.setBounds(bounds); } Loading Loading @@ -391,15 +397,18 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye return false; } if (StackId.tasksAreFloating(mStackId)) { // Update stack bounds again since the display info has changed since updateDisplayInfo, // however, for floating tasks, we don't need to apply the new rotation to the bounds, // we can just update and return them here setBounds(mBounds); mBoundsAfterRotation.set(mBounds); return true; } mTmpRect2.set(mBounds); mDisplayContent.rotateBounds(mRotation, newRotation, mTmpRect2); switch (mStackId) { case PINNED_STACK_ID: Rect targetBounds = new Rect(); getAnimatingBounds(targetBounds); mTmpRect2 = mDisplayContent.getPinnedStackController().onDisplayChanged(mBounds, targetBounds, mDisplayContent); break; case DOCKED_STACK_ID: repositionDockedStackAfterRotation(mTmpRect2); snapDockedStackAfterRotation(mTmpRect2); Loading Loading @@ -651,7 +660,6 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye mAnimationBackgroundSurface = new DimLayer(mService, this, mDisplayContent.getDisplayId(), "animation background stackId=" + mStackId); final Rect oldBounds = new Rect(mBounds); Rect bounds = null; final TaskStack dockedStack = dc.getDockedStackIgnoringVisibility(); if (mStackId == DOCKED_STACK_ID Loading @@ -675,15 +683,6 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye } updateDisplayInfo(bounds); // Update the pinned stack controller after the display info is updated if (mStackId == PINNED_STACK_ID) { Rect targetBounds = new Rect(); getAnimatingBounds(targetBounds); mDisplayContent.getPinnedStackController().onDisplayChanged(oldBounds, targetBounds, mDisplayContent); } super.onDisplayChanged(dc); } Loading Loading
services/core/java/com/android/server/wm/PinnedStackController.java +29 −24 Original line number Diff line number Diff line Loading @@ -230,32 +230,37 @@ class PinnedStackController { } /** * @param preChangeTargetBounds The final bounds of the stack if it is currently animating * @return the repositioned PIP bounds given it's pre-change bounds, and the new display * content. * Updates the display info, calculating and returning the new stack and movement bounds in the * new orientation of the device if necessary. */ Rect onDisplayChanged(Rect preChangeStackBounds, Rect preChangeTargetBounds, DisplayContent displayContent) { final Rect postChangeStackBounds = new Rect(preChangeTargetBounds); final DisplayInfo displayInfo = displayContent.getDisplayInfo(); if (!mDisplayInfo.equals(displayInfo)) { // Calculate the snap fraction of the current stack along the old movement bounds, and // then update the stack bounds to the same fraction along the rotated movement bounds. final Rect preChangeMovementBounds = getMovementBounds(preChangeStackBounds); final float snapFraction = mSnapAlgorithm.getSnapFraction(preChangeStackBounds, void onTaskStackBoundsChanged(Rect targetBounds, Rect outBounds) { final DisplayInfo displayInfo = mDisplayContent.getDisplayInfo(); if (mDisplayInfo.equals(displayInfo)) { return; } mTmpRect.set(targetBounds); final Rect postChangeStackBounds = mTmpRect; // Calculate the snap fraction of the current stack along the old movement bounds final Rect preChangeMovementBounds = getMovementBounds(postChangeStackBounds); final float snapFraction = mSnapAlgorithm.getSnapFraction(postChangeStackBounds, preChangeMovementBounds); mDisplayInfo.copyFrom(displayInfo); final Rect postChangeMovementBounds = getMovementBounds(preChangeStackBounds, // Calculate the stack bounds in the new orientation to the same same fraction along the // rotated movement bounds. final Rect postChangeMovementBounds = getMovementBounds(postChangeStackBounds, false /* adjustForIme */); mSnapAlgorithm.applySnapFraction(postChangeStackBounds, postChangeMovementBounds, snapFraction); if (mIsMinimized) { applyMinimizedOffset(postChangeStackBounds, postChangeMovementBounds); } notifyMovementBoundsChanged(false /* fromImeAdjustment */); } return postChangeStackBounds; outBounds.set(postChangeStackBounds); } /** Loading
services/core/java/com/android/server/wm/TaskStack.java +15 −16 Original line number Diff line number Diff line Loading @@ -262,6 +262,12 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye if (mDisplayContent != null) { mDisplayContent.mDimLayerController.updateDimLayer(this); if (mStackId == PINNED_STACK_ID) { // Update the bounds based on any changes to the display info getAnimatingBounds(mTmpRect2); mDisplayContent.mPinnedStackControllerLocked.onTaskStackBoundsChanged(mTmpRect2, bounds); } mAnimationBackgroundSurface.setBounds(bounds); } Loading Loading @@ -391,15 +397,18 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye return false; } if (StackId.tasksAreFloating(mStackId)) { // Update stack bounds again since the display info has changed since updateDisplayInfo, // however, for floating tasks, we don't need to apply the new rotation to the bounds, // we can just update and return them here setBounds(mBounds); mBoundsAfterRotation.set(mBounds); return true; } mTmpRect2.set(mBounds); mDisplayContent.rotateBounds(mRotation, newRotation, mTmpRect2); switch (mStackId) { case PINNED_STACK_ID: Rect targetBounds = new Rect(); getAnimatingBounds(targetBounds); mTmpRect2 = mDisplayContent.getPinnedStackController().onDisplayChanged(mBounds, targetBounds, mDisplayContent); break; case DOCKED_STACK_ID: repositionDockedStackAfterRotation(mTmpRect2); snapDockedStackAfterRotation(mTmpRect2); Loading Loading @@ -651,7 +660,6 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye mAnimationBackgroundSurface = new DimLayer(mService, this, mDisplayContent.getDisplayId(), "animation background stackId=" + mStackId); final Rect oldBounds = new Rect(mBounds); Rect bounds = null; final TaskStack dockedStack = dc.getDockedStackIgnoringVisibility(); if (mStackId == DOCKED_STACK_ID Loading @@ -675,15 +683,6 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye } updateDisplayInfo(bounds); // Update the pinned stack controller after the display info is updated if (mStackId == PINNED_STACK_ID) { Rect targetBounds = new Rect(); getAnimatingBounds(targetBounds); mDisplayContent.getPinnedStackController().onDisplayChanged(oldBounds, targetBounds, mDisplayContent); } super.onDisplayChanged(dc); } Loading