Loading core/java/android/view/IPinnedStackListener.aidl +2 −6 Original line number Diff line number Diff line Loading @@ -37,13 +37,9 @@ oneway interface IPinnedStackListener { /** * Called when the window manager has detected a change that would cause the movement bounds * to be changed (ie. after configuration change, aspect ratio change, etc). It then provides * the components that allow the listener to calculate the movement bounds itself. * The {@param animatingBounds} are provided to indicate the current target bounds of the * pinned stack (the final bounds if animating, the current bounds if not), * which may be helpful in calculating dependent animation bounds. * to be changed (ie. after configuration change, aspect ratio change, etc). */ void onMovementBoundsChanged(in Rect animatingBounds, boolean fromImeAdjustment); void onMovementBoundsChanged(boolean fromImeAdjustment); /** * Called when window manager decides to adjust the pinned stack bounds because of the IME, or Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/PinnedStackListenerForwarder.java +3 −4 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.systemui.shared.system; import android.content.ComponentName; import android.content.pm.ParceledListSlice; import android.graphics.Rect; import android.view.DisplayInfo; import android.view.IPinnedStackController; import android.view.IPinnedStackListener; Loading Loading @@ -53,9 +52,9 @@ public class PinnedStackListenerForwarder extends IPinnedStackListener.Stub { } @Override public void onMovementBoundsChanged(Rect animatingBounds, boolean fromImeAdjustment) { public void onMovementBoundsChanged(boolean fromImeAdjustment) { for (PinnedStackListener listener : mListeners) { listener.onMovementBoundsChanged(animatingBounds, fromImeAdjustment); listener.onMovementBoundsChanged(fromImeAdjustment); } } Loading Loading @@ -108,7 +107,7 @@ public class PinnedStackListenerForwarder extends IPinnedStackListener.Stub { public static class PinnedStackListener { public void onListenerRegistered(IPinnedStackController controller) {} public void onMovementBoundsChanged(Rect animatingBounds, boolean fromImeAdjustment) {} public void onMovementBoundsChanged(boolean fromImeAdjustment) {} public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {} Loading packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java +7 −1 Original line number Diff line number Diff line Loading @@ -317,17 +317,22 @@ public class PipTaskOrganizer extends TaskOrganizer { /** * TODO(b/152809058): consolidate the display info handling logic in SysUI * * @param destinationBoundsOut the current destination bounds will be populated to this param */ @SuppressWarnings("unchecked") public void onMovementBoundsChanged(boolean fromImeAdjustment, boolean fromShelfAdjustment) { public void onMovementBoundsChanged(Rect destinationBoundsOut, boolean fromImeAdjustment, boolean fromShelfAdjustment) { final PipAnimationController.PipTransitionAnimator animator = mPipAnimationController.getCurrentAnimator(); destinationBoundsOut.set(mLastReportedBounds); if (animator == null || !animator.isRunning() || animator.getTransitionDirection() != TRANSITION_DIRECTION_TO_PIP) { return; } final Rect currentDestinationBounds = animator.getDestinationBounds(); destinationBoundsOut.set(currentDestinationBounds); if (!fromImeAdjustment && !fromShelfAdjustment && mPipBoundsHandler.getDisplayBounds().contains(currentDestinationBounds)) { // no need to update the destination bounds, bail early Loading @@ -342,6 +347,7 @@ public class PipTaskOrganizer extends TaskOrganizer { animator.updateEndValue(newDestinationBounds); } animator.setDestinationBounds(newDestinationBounds); destinationBoundsOut.set(newDestinationBounds); } /** Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +13 −10 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_TO_FULLSCREEN; import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityTaskManager; import android.app.IActivityManager; Loading Loading @@ -160,9 +161,9 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio } @Override public void onMovementBoundsChanged(Rect animatingBounds, boolean fromImeAdjustment) { mHandler.post(() -> updateMovementBounds(animatingBounds, fromImeAdjustment, false /* fromShelfAdjustment */)); public void onMovementBoundsChanged(boolean fromImeAdjustment) { mHandler.post(() -> updateMovementBounds(null /* toBounds */, fromImeAdjustment, false /* fromShelfAdjustment */)); } @Override Loading Loading @@ -352,17 +353,19 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio mMenuController.onPinnedStackAnimationEnded(); } private void updateMovementBounds(Rect animatingBounds, boolean fromImeAdjustment, boolean fromShelfAdjustment) { private void updateMovementBounds(@Nullable Rect toBounds, boolean fromImeAdjustment, boolean fromShelfAdjustment) { // Populate inset / normal bounds and DisplayInfo from mPipBoundsHandler before // passing to mTouchHandler, mTouchHandler would rely on the bounds calculated by // mPipBoundsHandler with up-to-dated information // passing to mTouchHandler/mPipTaskOrganizer final Rect outBounds = new Rect(toBounds); mPipBoundsHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, animatingBounds, mTmpDisplayInfo); outBounds, mTmpDisplayInfo); // mTouchHandler would rely on the bounds populated from mPipTaskOrganizer mPipTaskOrganizer.onMovementBoundsChanged(outBounds, fromImeAdjustment, fromShelfAdjustment); mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, animatingBounds, fromImeAdjustment, fromShelfAdjustment, outBounds, fromImeAdjustment, fromShelfAdjustment, mTmpDisplayInfo.rotation); mPipTaskOrganizer.onMovementBoundsChanged(fromImeAdjustment, fromShelfAdjustment); } public void dump(PrintWriter pw) { Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +10 −3 Original line number Diff line number Diff line Loading @@ -380,11 +380,18 @@ public class PipTouchHandler { } // Re-calculate the expanded bounds mNormalBounds = normalBounds; mNormalBounds.set(normalBounds); Rect normalMovementBounds = new Rect(); mSnapAlgorithm.getMovementBounds(mNormalBounds, insetBounds, normalMovementBounds, bottomOffset); if (mMovementBounds.isEmpty()) { // mMovementBounds is not initialized yet and a clean movement bounds without // bottom offset shall be used later in this function. mSnapAlgorithm.getMovementBounds(curBounds, insetBounds, mMovementBounds, 0 /* bottomOffset */); } // Calculate the expanded size float aspectRatio = (float) normalBounds.width() / normalBounds.height(); Point displaySize = new Point(); Loading Loading @@ -430,8 +437,8 @@ public class PipTouchHandler { // Update the movement bounds after doing the calculations based on the old movement bounds // above mNormalMovementBounds = normalMovementBounds; mExpandedMovementBounds = expandedMovementBounds; mNormalMovementBounds.set(normalMovementBounds); mExpandedMovementBounds.set(expandedMovementBounds); mDisplayRotation = displayRotation; mInsetBounds.set(insetBounds); updateMovementBounds(); Loading Loading
core/java/android/view/IPinnedStackListener.aidl +2 −6 Original line number Diff line number Diff line Loading @@ -37,13 +37,9 @@ oneway interface IPinnedStackListener { /** * Called when the window manager has detected a change that would cause the movement bounds * to be changed (ie. after configuration change, aspect ratio change, etc). It then provides * the components that allow the listener to calculate the movement bounds itself. * The {@param animatingBounds} are provided to indicate the current target bounds of the * pinned stack (the final bounds if animating, the current bounds if not), * which may be helpful in calculating dependent animation bounds. * to be changed (ie. after configuration change, aspect ratio change, etc). */ void onMovementBoundsChanged(in Rect animatingBounds, boolean fromImeAdjustment); void onMovementBoundsChanged(boolean fromImeAdjustment); /** * Called when window manager decides to adjust the pinned stack bounds because of the IME, or Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/PinnedStackListenerForwarder.java +3 −4 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package com.android.systemui.shared.system; import android.content.ComponentName; import android.content.pm.ParceledListSlice; import android.graphics.Rect; import android.view.DisplayInfo; import android.view.IPinnedStackController; import android.view.IPinnedStackListener; Loading Loading @@ -53,9 +52,9 @@ public class PinnedStackListenerForwarder extends IPinnedStackListener.Stub { } @Override public void onMovementBoundsChanged(Rect animatingBounds, boolean fromImeAdjustment) { public void onMovementBoundsChanged(boolean fromImeAdjustment) { for (PinnedStackListener listener : mListeners) { listener.onMovementBoundsChanged(animatingBounds, fromImeAdjustment); listener.onMovementBoundsChanged(fromImeAdjustment); } } Loading Loading @@ -108,7 +107,7 @@ public class PinnedStackListenerForwarder extends IPinnedStackListener.Stub { public static class PinnedStackListener { public void onListenerRegistered(IPinnedStackController controller) {} public void onMovementBoundsChanged(Rect animatingBounds, boolean fromImeAdjustment) {} public void onMovementBoundsChanged(boolean fromImeAdjustment) {} public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {} Loading
packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java +7 −1 Original line number Diff line number Diff line Loading @@ -317,17 +317,22 @@ public class PipTaskOrganizer extends TaskOrganizer { /** * TODO(b/152809058): consolidate the display info handling logic in SysUI * * @param destinationBoundsOut the current destination bounds will be populated to this param */ @SuppressWarnings("unchecked") public void onMovementBoundsChanged(boolean fromImeAdjustment, boolean fromShelfAdjustment) { public void onMovementBoundsChanged(Rect destinationBoundsOut, boolean fromImeAdjustment, boolean fromShelfAdjustment) { final PipAnimationController.PipTransitionAnimator animator = mPipAnimationController.getCurrentAnimator(); destinationBoundsOut.set(mLastReportedBounds); if (animator == null || !animator.isRunning() || animator.getTransitionDirection() != TRANSITION_DIRECTION_TO_PIP) { return; } final Rect currentDestinationBounds = animator.getDestinationBounds(); destinationBoundsOut.set(currentDestinationBounds); if (!fromImeAdjustment && !fromShelfAdjustment && mPipBoundsHandler.getDisplayBounds().contains(currentDestinationBounds)) { // no need to update the destination bounds, bail early Loading @@ -342,6 +347,7 @@ public class PipTaskOrganizer extends TaskOrganizer { animator.updateEndValue(newDestinationBounds); } animator.setDestinationBounds(newDestinationBounds); destinationBoundsOut.set(newDestinationBounds); } /** Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +13 −10 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static com.android.systemui.pip.PipAnimationController.TRANSITION_DIRECTION_TO_FULLSCREEN; import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityTaskManager; import android.app.IActivityManager; Loading Loading @@ -160,9 +161,9 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio } @Override public void onMovementBoundsChanged(Rect animatingBounds, boolean fromImeAdjustment) { mHandler.post(() -> updateMovementBounds(animatingBounds, fromImeAdjustment, false /* fromShelfAdjustment */)); public void onMovementBoundsChanged(boolean fromImeAdjustment) { mHandler.post(() -> updateMovementBounds(null /* toBounds */, fromImeAdjustment, false /* fromShelfAdjustment */)); } @Override Loading Loading @@ -352,17 +353,19 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio mMenuController.onPinnedStackAnimationEnded(); } private void updateMovementBounds(Rect animatingBounds, boolean fromImeAdjustment, boolean fromShelfAdjustment) { private void updateMovementBounds(@Nullable Rect toBounds, boolean fromImeAdjustment, boolean fromShelfAdjustment) { // Populate inset / normal bounds and DisplayInfo from mPipBoundsHandler before // passing to mTouchHandler, mTouchHandler would rely on the bounds calculated by // mPipBoundsHandler with up-to-dated information // passing to mTouchHandler/mPipTaskOrganizer final Rect outBounds = new Rect(toBounds); mPipBoundsHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, animatingBounds, mTmpDisplayInfo); outBounds, mTmpDisplayInfo); // mTouchHandler would rely on the bounds populated from mPipTaskOrganizer mPipTaskOrganizer.onMovementBoundsChanged(outBounds, fromImeAdjustment, fromShelfAdjustment); mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, animatingBounds, fromImeAdjustment, fromShelfAdjustment, outBounds, fromImeAdjustment, fromShelfAdjustment, mTmpDisplayInfo.rotation); mPipTaskOrganizer.onMovementBoundsChanged(fromImeAdjustment, fromShelfAdjustment); } public void dump(PrintWriter pw) { Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +10 −3 Original line number Diff line number Diff line Loading @@ -380,11 +380,18 @@ public class PipTouchHandler { } // Re-calculate the expanded bounds mNormalBounds = normalBounds; mNormalBounds.set(normalBounds); Rect normalMovementBounds = new Rect(); mSnapAlgorithm.getMovementBounds(mNormalBounds, insetBounds, normalMovementBounds, bottomOffset); if (mMovementBounds.isEmpty()) { // mMovementBounds is not initialized yet and a clean movement bounds without // bottom offset shall be used later in this function. mSnapAlgorithm.getMovementBounds(curBounds, insetBounds, mMovementBounds, 0 /* bottomOffset */); } // Calculate the expanded size float aspectRatio = (float) normalBounds.width() / normalBounds.height(); Point displaySize = new Point(); Loading Loading @@ -430,8 +437,8 @@ public class PipTouchHandler { // Update the movement bounds after doing the calculations based on the old movement bounds // above mNormalMovementBounds = normalMovementBounds; mExpandedMovementBounds = expandedMovementBounds; mNormalMovementBounds.set(normalMovementBounds); mExpandedMovementBounds.set(expandedMovementBounds); mDisplayRotation = displayRotation; mInsetBounds.set(insetBounds); updateMovementBounds(); Loading