summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/IPip.aidl18
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java18
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java10
3 files changed, 40 insertions, 6 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 78de5f3e7a1f..3906599b7581 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
@@ -57,27 +57,35 @@ interface IPip {
in Rect destinationBounds, in SurfaceControl overlay) = 2;
/**
+ * Notifies the swiping Activity to PiP onto home transition is aborted
+ *
+ * @param taskId the Task id that the Activity and overlay are currently in.
+ * @param componentName ComponentName represents the Activity
+ */
+ oneway void abortSwipePipToHome(int taskId, in ComponentName componentName) = 3;
+
+ /**
* Sets listener to get pinned stack animation callbacks.
*/
- oneway void setPipAnimationListener(IPipAnimationListener listener) = 3;
+ oneway void setPipAnimationListener(IPipAnimationListener listener) = 4;
/**
* Sets the shelf height and visibility.
*/
- oneway void setShelfHeight(boolean visible, int shelfHeight) = 4;
+ oneway void setShelfHeight(boolean visible, int shelfHeight) = 5;
/**
* Sets the next pip animation type to be the alpha animation.
*/
- oneway void setPipAnimationTypeToAlpha() = 5;
+ oneway void setPipAnimationTypeToAlpha() = 6;
/**
* Sets the height and visibility of the Launcher keep clear area.
*/
- oneway void setLauncherKeepClearAreaHeight(boolean visible, int height) = 6;
+ oneway void setLauncherKeepClearAreaHeight(boolean visible, int height) = 7;
/**
* Sets the app icon size in pixel used by Launcher
*/
- oneway void setLauncherAppIconSize(int iconSizePx) = 7;
+ oneway void setLauncherAppIconSize(int iconSizePx) = 8;
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
index 58bc81dd3007..db7c3fc9c9ec 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
@@ -462,13 +462,29 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
// to the actual Task surface now.
// PipTransition is responsible to fade it out and cleanup when finishing the enter PIP
// transition.
- final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
+ final SurfaceControl.Transaction t = mSurfaceControlTransactionFactory.getTransaction();
mTaskOrganizer.reparentChildSurfaceToTask(taskId, overlay, t);
t.setLayer(overlay, Integer.MAX_VALUE);
t.apply();
}
}
+ /**
+ * Callback when launcher aborts swipe-pip-to-home operation.
+ */
+ public void abortSwipePipToHome(int taskId, ComponentName componentName) {
+ if (!mPipTransitionState.getInSwipePipToHomeTransition()) {
+ return;
+ }
+ ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
+ "Abort swipe-pip-to-home for %s", componentName);
+ sendOnPipTransitionCancelled(TRANSITION_DIRECTION_TO_PIP);
+ // Cleanup internal states
+ mPipTransitionState.setInSwipePipToHomeTransition(false);
+ mPictureInPictureParams = null;
+ mPipTransitionState.setTransitionState(PipTransitionState.UNDEFINED);
+ }
+
public ActivityManager.RunningTaskInfo getTaskInfo() {
return mTaskInfo;
}
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 9e6bd4760900..63181da46b02 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
@@ -1017,6 +1017,10 @@ public class PipController implements PipTransitionController.PipTransitionCallb
mPipTaskOrganizer.stopSwipePipToHome(taskId, componentName, destinationBounds, overlay);
}
+ private void abortSwipePipToHome(int taskId, ComponentName componentName) {
+ mPipTaskOrganizer.abortSwipePipToHome(taskId, componentName);
+ }
+
private String getTransitionTag(int direction) {
switch (direction) {
case TRANSITION_DIRECTION_TO_PIP:
@@ -1313,6 +1317,12 @@ public class PipController implements PipTransitionController.PipTransitionCallb
}
@Override
+ public void abortSwipePipToHome(int taskId, ComponentName componentName) {
+ executeRemoteCallWithTaskPermission(mController, "abortSwipePipToHome",
+ (controller) -> controller.abortSwipePipToHome(taskId, componentName));
+ }
+
+ @Override
public void setShelfHeight(boolean visible, int height) {
executeRemoteCallWithTaskPermission(mController, "setShelfHeight",
(controller) -> controller.setShelfHeight(visible, height));