From bddc58e3bc6caea905d1db5023b56d9c14bdce65 Mon Sep 17 00:00:00 2001 From: Hongwei Wang Date: Tue, 22 Mar 2022 17:33:06 -0700 Subject: [PATCH] Add IPipAnimationListener#onExpandPip This signals Launcher when user leaves PiP mode by tapping on the expand button in PiP window. Launcher can use signal, for instance, to hide the Taskbar to avoid flicker when the app settles in full-screen mode. Video: http://recall/-/aaaaaabFQoRHlzixHdtY/dIgvinb9yEB8MYfYDx0Ijy Bug: 218450853 Test: see video Change-Id: I0e9882324daa6dc419ad2746312a22a0c8721ff4 --- .../android/wm/shell/pip/IPipAnimationListener.aidl | 5 +++++ .../android/wm/shell/pip/phone/PipController.java | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/IPipAnimationListener.aidl b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/IPipAnimationListener.aidl index b4c745fc48925..ef627647794ed 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/IPipAnimationListener.aidl +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/IPipAnimationListener.aidl @@ -32,4 +32,9 @@ oneway interface IPipAnimationListener { * @param cornerRadius the pixel value of the corner radius, zero means it's disabled. */ void onPipCornerRadiusChanged(int cornerRadius); + + /** + * Notifies the listener that user leaves PiP by tapping on the expand button. + */ + void onExpandPip(); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java index ba522c072f11f..70d6e2246a213 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java @@ -136,6 +136,11 @@ public class PipController implements PipTransitionController.PipTransitionCallb * @param cornerRadius the pixel value of the corner radius, zero means it's disabled. */ void onPipCornerRadiusChanged(int cornerRadius); + + /** + * Notifies the listener that user leaves PiP by tapping on the expand button. + */ + void onExpandPip(); } /** @@ -643,6 +648,9 @@ public class PipController implements PipTransitionController.PipTransitionCallb mTouchHandler.setTouchEnabled(false); if (mPinnedStackAnimationRecentsCallback != null) { mPinnedStackAnimationRecentsCallback.onPipAnimationStarted(); + if (direction == TRANSITION_DIRECTION_LEAVE_PIP) { + mPinnedStackAnimationRecentsCallback.onExpandPip(); + } } } @@ -902,6 +910,11 @@ public class PipController implements PipTransitionController.PipTransitionCallb public void onPipCornerRadiusChanged(int cornerRadius) { mListener.call(l -> l.onPipCornerRadiusChanged(cornerRadius)); } + + @Override + public void onExpandPip() { + mListener.call(l -> l.onExpandPip()); + } }; IPipImpl(PipController controller) {