Merge "Allow auto-pip on launching new Task from TaskBar" into sc-v2-dev

This commit is contained in:
Hongwei Wang
2021-11-19 00:08:42 +00:00
committed by Android (Google) Code Review
3 changed files with 24 additions and 22 deletions

View File

@@ -961,6 +961,12 @@
"group": "WM_DEBUG_ORIENTATION",
"at": "com\/android\/server\/wm\/RootWindowContainer.java"
},
"-1101551167": {
"message": "Auto-PIP allowed, entering PIP mode directly: %s, didAutoPip: %b",
"level": "DEBUG",
"group": "WM_DEBUG_STATES",
"at": "com\/android\/server\/wm\/TaskFragment.java"
},
"-1089874824": {
"message": "SURFACE SHOW (performLayout): %s",
"level": "INFO",
@@ -2629,12 +2635,6 @@
"group": "WM_ERROR",
"at": "com\/android\/server\/wm\/WindowManagerService.java"
},
"660908897": {
"message": "Auto-PIP allowed, entering PIP mode directly: %s",
"level": "DEBUG",
"group": "WM_DEBUG_STATES",
"at": "com\/android\/server\/wm\/TaskFragment.java"
},
"662572728": {
"message": "Attempted to add a toast window with bad token %s. Aborting.",
"level": "WARN",

View File

@@ -594,10 +594,10 @@ public class PipAnimationController {
getSurfaceTransactionHelper().scaleAndCrop(tx, leash,
initialSourceValue, bounds, insets);
if (shouldApplyCornerRadius()) {
final Rect destinationBounds = new Rect(bounds);
destinationBounds.inset(insets);
final Rect sourceBounds = new Rect(initialContainerRect);
sourceBounds.inset(insets);
getSurfaceTransactionHelper().round(tx, leash,
initialContainerRect, destinationBounds);
sourceBounds, bounds);
}
}
if (!handlePipTransaction(leash, tx, bounds)) {
@@ -641,11 +641,13 @@ public class PipAnimationController {
y = fraction * (end.bottom - start.top) + start.top;
}
}
final Rect sourceBounds = new Rect(initialContainerRect);
sourceBounds.inset(insets);
getSurfaceTransactionHelper()
.rotateAndScaleWithCrop(tx, leash, initialContainerRect, bounds,
insets, degree, x, y, isOutPipDirection,
rotationDelta == ROTATION_270 /* clockwise */)
.round(tx, leash, initialContainerRect, bounds);
.round(tx, leash, sourceBounds, bounds);
tx.apply();
}

View File

@@ -1417,29 +1417,29 @@ class TaskFragment extends WindowContainer<WindowContainer> {
boolean pauseImmediately = false;
boolean shouldAutoPip = false;
if (resuming != null && (resuming.info.flags & FLAG_RESUME_WHILE_PAUSING) != 0) {
// If the flag RESUME_WHILE_PAUSING is set, then continue to schedule the previous
// activity to be paused, while at the same time resuming the new resume activity
// only if the previous activity can't go into Pip since we want to give Pip
// activities a chance to enter Pip before resuming the next activity.
final boolean lastResumedCanPip = prev != null && prev.checkEnterPictureInPictureState(
"shouldResumeWhilePausing", userLeaving);
if (resuming != null) {
// Resuming the new resume activity only if the previous activity can't go into Pip
// since we want to give Pip activities a chance to enter Pip before resuming the
// next activity.
final boolean lastResumedCanPip = prev.checkEnterPictureInPictureState(
"shouldAutoPipWhilePausing", userLeaving);
if (lastResumedCanPip && prev.pictureInPictureArgs.isAutoEnterEnabled()) {
shouldAutoPip = true;
} else if (!lastResumedCanPip) {
pauseImmediately = true;
// If the flag RESUME_WHILE_PAUSING is set, then continue to schedule the previous
// activity to be paused.
pauseImmediately = (resuming.info.flags & FLAG_RESUME_WHILE_PAUSING) != 0;
} else {
// The previous activity may still enter PIP even though it did not allow auto-PIP.
}
}
boolean didAutoPip = false;
if (prev.attachedToProcess()) {
if (shouldAutoPip) {
boolean didAutoPip = mAtmService.enterPictureInPictureMode(
prev, prev.pictureInPictureArgs);
ProtoLog.d(WM_DEBUG_STATES, "Auto-PIP allowed, entering PIP mode "
+ "directly: %s", prev);
didAutoPip = mAtmService.enterPictureInPictureMode(prev, prev.pictureInPictureArgs);
+ "directly: %s, didAutoPip: %b", prev, didAutoPip);
} else {
schedulePauseActivity(prev, userLeaving, pauseImmediately, reason);
}