Merge "Cleanup on aborting auto-enter-pip" into udc-dev
This commit is contained in:
@@ -56,28 +56,36 @@ interface IPip {
|
||||
oneway void stopSwipePipToHome(int taskId, in ComponentName componentName,
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
@@ -1312,6 +1316,12 @@ public class PipController implements PipTransitionController.PipTransitionCallb
|
||||
taskId, componentName, destinationBounds, overlay));
|
||||
}
|
||||
|
||||
@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",
|
||||
|
||||
Reference in New Issue
Block a user