Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java +7 −9 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); Loading Loading @@ -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(); Loading @@ -320,13 +325,6 @@ public class PipMenuActivityController { onMenuStateChanged(MENU_STATE_NONE, false /* resize */); } /** * @return the current menu state. */ public int getMenuState() { return mMenuState; } /** * Sets the menu actions to the actions provided by the current PiP activity. */ Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java +17 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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()); Loading Loading @@ -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(() -> { Loading @@ -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(() -> { Loading Loading @@ -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 { Loading @@ -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 { Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +11 −7 Original line number Diff line number Diff line Loading @@ -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) { Loading @@ -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; } } Loading Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java +7 −9 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); Loading Loading @@ -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(); Loading @@ -320,13 +325,6 @@ public class PipMenuActivityController { onMenuStateChanged(MENU_STATE_NONE, false /* resize */); } /** * @return the current menu state. */ public int getMenuState() { return mMenuState; } /** * Sets the menu actions to the actions provided by the current PiP activity. */ Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipMotionHelper.java +17 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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()); Loading Loading @@ -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(() -> { Loading @@ -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(() -> { Loading Loading @@ -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 { Loading @@ -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 { Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +11 −7 Original line number Diff line number Diff line Loading @@ -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) { Loading @@ -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; } } Loading