diff options
3 files changed, 35 insertions, 16 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java index 1ccea6f684df..e310847943c5 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java @@ -27,6 +27,7 @@ import android.content.Intent; import android.content.pm.ParceledListSlice; import android.graphics.Rect; import android.os.Bundle; +import android.os.Debug; import android.os.Handler; import android.os.Message; import android.os.Messenger; @@ -254,7 +255,9 @@ public class PipMenuActivityController { public void showMenu(int menuState, Rect stackBounds, Rect movementBounds, boolean allowMenuTimeout) { if (DEBUG) { - Log.d(TAG, "showMenu() hasActivity=" + (mToActivityMessenger != null)); + Log.d(TAG, "showMenu() state=" + menuState + + " hasActivity=" + (mToActivityMessenger != null) + + " callers=\n" + Debug.getCallers(5, " ")); } if (mToActivityMessenger != null) { Bundle data = new Bundle(); @@ -298,7 +301,9 @@ public class PipMenuActivityController { */ public void hideMenu() { if (DEBUG) { - Log.d(TAG, "hideMenu() hasActivity=" + (mToActivityMessenger != null)); + Log.d(TAG, "hideMenu() state=" + mMenuState + + " hasActivity=" + (mToActivityMessenger != null) + + " callers=\n" + Debug.getCallers(5, " ")); } if (mToActivityMessenger != null) { Message m = Message.obtain(); @@ -321,13 +326,6 @@ public class PipMenuActivityController { } /** - * @return the current menu state. - */ - public int getMenuState() { - return mMenuState; - } - - /** * Sets the menu actions to the actions provided by the current PiP activity. */ public void setAppActions(ParceledListSlice appActions) { diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java index 590e3c62e82a..9fa7ff61a13d 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java @@ -34,6 +34,7 @@ import android.content.Context; import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; +import android.os.Debug; import android.os.Handler; import android.os.RemoteException; import android.util.Log; @@ -54,6 +55,7 @@ import java.io.PrintWriter; public class PipMotionHelper { private static final String TAG = "PipMotionHelper"; + private static final boolean DEBUG = false; private static final RectEvaluator RECT_EVALUATOR = new RectEvaluator(new Rect()); @@ -150,6 +152,10 @@ public class PipMotionHelper { * Resizes the pinned stack back to fullscreen. */ void expandPip(boolean skipAnimation) { + if (DEBUG) { + Log.d(TAG, "expandPip: skipAnimation=" + skipAnimation + + " callers=\n" + Debug.getCallers(5, " ")); + } cancelAnimations(); mMenuController.hideMenuWithoutResize(); mHandler.post(() -> { @@ -171,6 +177,9 @@ public class PipMotionHelper { * Dismisses the pinned stack. */ void dismissPip() { + if (DEBUG) { + Log.d(TAG, "dismissPip: callers=\n" + Debug.getCallers(5, " ")); + } cancelAnimations(); mMenuController.hideMenuWithoutResize(); mHandler.post(() -> { @@ -419,6 +428,10 @@ public class PipMotionHelper { * Directly resizes the PiP to the given {@param bounds}. */ private void resizePipUnchecked(Rect toBounds) { + if (DEBUG) { + Log.d(TAG, "resizePipUnchecked: toBounds=" + toBounds + + " callers=\n" + Debug.getCallers(5, " ")); + } if (!toBounds.equals(mBounds)) { mVsyncChoreographer.scheduleAtSfVsync(() -> { try { @@ -435,6 +448,10 @@ public class PipMotionHelper { * Directly resizes the PiP to the given {@param bounds}. */ private void resizeAndAnimatePipUnchecked(Rect toBounds, int duration) { + if (DEBUG) { + Log.d(TAG, "resizeAndAnimatePipUnchecked: toBounds=" + toBounds + + " duration=" + duration + " callers=\n" + Debug.getCallers(5, " ")); + } if (!toBounds.equals(mBounds)) { mHandler.post(() -> { try { diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java index 199b027d098b..c35fdd5c5781 100644 --- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java @@ -484,14 +484,15 @@ public class PipTouchHandler { // Try and restore the PiP to the closest edge, using the saved snap fraction // if possible if (resize) { - // This is a very special case: when the menu is expanded and visible, navigating to - // another activity can trigger auto-enter PiP, and if the revealed activity has a - // forced rotation set, then the controller will get updated with the new rotation - // of the display. However, at the same time, SystemUI will try to hide the menu by - // creating an animation to the normal bounds which are now stale. In such a case - // we defer the animation to the normal bounds until after the next - // onMovementBoundsChanged() call to get the bounds in the new orientation if (mDeferResizeToNormalBoundsUntilRotation == -1) { + // This is a very special case: when the menu is expanded and visible, + // navigating to another activity can trigger auto-enter PiP, and if the + // revealed activity has a forced rotation set, then the controller will get + // updated with the new rotation of the display. However, at the same time, + // SystemUI will try to hide the menu by creating an animation to the normal + // bounds which are now stale. In such a case we defer the animation to the + // normal bounds until after the next onMovementBoundsChanged() call to get the + // bounds in the new orientation try { int displayRotation = mPinnedStackController.getDisplayRotation(); if (mDisplayRotation != displayRotation) { @@ -510,6 +511,9 @@ public class PipTouchHandler { mSavedSnapFraction = -1f; } } else { + // If resizing is not allowed, then the PiP should be frozen until the transition + // ends as well + setTouchEnabled(false); mSavedSnapFraction = -1f; } } |