From 5414dab01eda3d6ef6e3bbe4baeb5680ec1171ef Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Mon, 3 Oct 2022 22:12:08 +0000 Subject: [PATCH] Clean up some methods on the Pip interface - Remove some pip methods that aren't used from SysUI - Migrate an old ISystemUIProxy pip call to IPip Bug: 238217847 Test: atest WMShellUnitTests Change-Id: Iab57329a9d79704b0e35fdb22a36594aa4368141 --- .../src/com/android/wm/shell/pip/IPip.aidl | 7 ++++- .../src/com/android/wm/shell/pip/Pip.java | 17 ------------ .../wm/shell/pip/phone/PipController.java | 27 ++++++++----------- .../shared/recents/ISystemUiProxy.aidl | 5 ---- .../recents/OverviewProxyService.java | 8 ------ 5 files changed, 17 insertions(+), 47 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/IPip.aidl b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/IPip.aidl index 4def15db2f52d..2624ee536b583 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/IPip.aidl +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/IPip.aidl @@ -59,10 +59,15 @@ interface IPip { /** * Sets listener to get pinned stack animation callbacks. */ - oneway void setPinnedStackAnimationListener(IPipAnimationListener listener) = 3; + oneway void setPipAnimationListener(IPipAnimationListener listener) = 3; /** * Sets the shelf height and visibility. */ oneway void setShelfHeight(boolean visible, int shelfHeight) = 4; + + /** + * Sets the next pip animation type to be the alpha animation. + */ + oneway void setPipAnimationTypeToAlpha() = 5; } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/Pip.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/Pip.java index c06881ae6ad7a..72b9dd37ac7da 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/Pip.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/Pip.java @@ -50,15 +50,6 @@ public interface Pip { default void onSystemUiStateChanged(boolean isSysUiStateValid, int flag) { } - /** - * Sets both shelf visibility and its height. - * - * @param visible visibility of shelf. - * @param height to specify the height for shelf. - */ - default void setShelfHeight(boolean visible, int height) { - } - /** * Set the callback when {@link PipTaskOrganizer#isInPip()} state is changed. * @@ -67,14 +58,6 @@ public interface Pip { */ default void setOnIsInPipStateChangedListener(Consumer callback) {} - /** - * Set the pinned stack with {@link PipAnimationController.AnimationType} - * - * @param animationType The pre-defined {@link PipAnimationController.AnimationType} - */ - default void setPinnedStackAnimationType(int animationType) { - } - /** * Called when showing Pip menu. */ 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 af47666efa5a0..3345b1b2d0e80 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 @@ -23,6 +23,7 @@ import static android.view.WindowManager.INPUT_CONSUMER_PIP; import static com.android.internal.jank.InteractionJankMonitor.CUJ_PIP_TRANSITION; import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission; +import static com.android.wm.shell.pip.PipAnimationController.ANIM_TYPE_ALPHA; import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_EXPAND_OR_UNEXPAND; import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_LEAVE_PIP; import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_LEAVE_PIP_TO_SPLIT_SCREEN; @@ -1064,13 +1065,6 @@ public class PipController implements PipTransitionController.PipTransitionCallb }); } - @Override - public void setShelfHeight(boolean visible, int height) { - mMainExecutor.execute(() -> { - PipController.this.setShelfHeight(visible, height); - }); - } - @Override public void setOnIsInPipStateChangedListener(Consumer callback) { mMainExecutor.execute(() -> { @@ -1078,13 +1072,6 @@ public class PipController implements PipTransitionController.PipTransitionCallb }); } - @Override - public void setPinnedStackAnimationType(int animationType) { - mMainExecutor.execute(() -> { - PipController.this.setPinnedStackAnimationType(animationType); - }); - } - @Override public void addPipExclusionBoundsChangeListener(Consumer listener) { mMainExecutor.execute(() -> { @@ -1178,8 +1165,8 @@ public class PipController implements PipTransitionController.PipTransitionCallb } @Override - public void setPinnedStackAnimationListener(IPipAnimationListener listener) { - executeRemoteCallWithTaskPermission(mController, "setPinnedStackAnimationListener", + public void setPipAnimationListener(IPipAnimationListener listener) { + executeRemoteCallWithTaskPermission(mController, "setPipAnimationListener", (controller) -> { if (listener != null) { mListener.register(listener); @@ -1188,5 +1175,13 @@ public class PipController implements PipTransitionController.PipTransitionCallb } }); } + + @Override + public void setPipAnimationTypeToAlpha() { + executeRemoteCallWithTaskPermission(mController, "setPipAnimationTypeToAlpha", + (controller) -> { + controller.setPinnedStackAnimationType(ANIM_TYPE_ALPHA); + }); + } } } diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl index e77c650794567..2b2b05ce2fbf0 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl @@ -81,11 +81,6 @@ interface ISystemUiProxy { */ void stopScreenPinning() = 17; - /* - * Notifies that the swipe-to-home (recents animation) is finished. - */ - void notifySwipeToHomeFinished() = 23; - /** * Notifies that quickstep will switch to a new task * @param rotation indicates which Surface.Rotation the gesture was started in diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 7e2a5c51786d5..899e57d7d0ae2 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -341,14 +341,6 @@ public class OverviewProxyService extends CurrentUserTracker implements }); } - @Override - public void notifySwipeToHomeFinished() { - verifyCallerAndClearCallingIdentity("notifySwipeToHomeFinished", () -> - mPipOptional.ifPresent( - pip -> pip.setPinnedStackAnimationType( - PipAnimationController.ANIM_TYPE_ALPHA))); - } - @Override public void notifySwipeUpGestureStarted() { verifyCallerAndClearCallingIdentityPostMain("notifySwipeUpGestureStarted", () ->