Merge "Fix PiP transition ordering" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a8b3591b6b
@@ -3061,6 +3061,12 @@
|
|||||||
"group": "WM_DEBUG_STATES",
|
"group": "WM_DEBUG_STATES",
|
||||||
"at": "com\/android\/server\/wm\/RootWindowContainer.java"
|
"at": "com\/android\/server\/wm\/RootWindowContainer.java"
|
||||||
},
|
},
|
||||||
|
"898260097": {
|
||||||
|
"message": "Creating Pending Pip-Enter: %s",
|
||||||
|
"level": "VERBOSE",
|
||||||
|
"group": "WM_DEBUG_WINDOW_TRANSITIONS",
|
||||||
|
"at": "com\/android\/server\/wm\/ActivityTaskManagerService.java"
|
||||||
|
},
|
||||||
"898863925": {
|
"898863925": {
|
||||||
"message": "Attempted to add QS dialog window with unknown token %s. Aborting.",
|
"message": "Attempted to add QS dialog window with unknown token %s. Aborting.",
|
||||||
"level": "WARN",
|
"level": "WARN",
|
||||||
|
|||||||
@@ -145,6 +145,11 @@ public class PipTransition extends PipTransitionController {
|
|||||||
if (destinationBounds != null) {
|
if (destinationBounds != null) {
|
||||||
mExitDestinationBounds.set(destinationBounds);
|
mExitDestinationBounds.set(destinationBounds);
|
||||||
}
|
}
|
||||||
|
final PipAnimationController.PipTransitionAnimator animator =
|
||||||
|
mPipAnimationController.getCurrentAnimator();
|
||||||
|
if (animator != null && animator.isRunning()) {
|
||||||
|
animator.cancel();
|
||||||
|
}
|
||||||
mExitTransition = mTransitions.startTransition(type, out, this);
|
mExitTransition = mTransitions.startTransition(type, out, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -377,6 +377,7 @@ public class Transitions implements RemoteCallable<Transitions> {
|
|||||||
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "Invalid root leash (%s): %s",
|
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, "Invalid root leash (%s): %s",
|
||||||
transitionToken, info);
|
transitionToken, info);
|
||||||
t.apply();
|
t.apply();
|
||||||
|
finishT.apply();
|
||||||
onAbort(transitionToken);
|
onAbort(transitionToken);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -400,6 +401,7 @@ public class Transitions implements RemoteCallable<Transitions> {
|
|||||||
}
|
}
|
||||||
if (nonTaskChange && transferStartingWindow) {
|
if (nonTaskChange && transferStartingWindow) {
|
||||||
t.apply();
|
t.apply();
|
||||||
|
finishT.apply();
|
||||||
// Treat this as an abort since we are bypassing any merge logic and effectively
|
// Treat this as an abort since we are bypassing any merge logic and effectively
|
||||||
// finishing immediately.
|
// finishing immediately.
|
||||||
onAbort(transitionToken);
|
onAbort(transitionToken);
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ import static android.provider.Settings.System.FONT_SCALE;
|
|||||||
import static android.view.Display.DEFAULT_DISPLAY;
|
import static android.view.Display.DEFAULT_DISPLAY;
|
||||||
import static android.view.Display.INVALID_DISPLAY;
|
import static android.view.Display.INVALID_DISPLAY;
|
||||||
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_LAUNCHER_CLEAR_SNAPSHOT;
|
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_LAUNCHER_CLEAR_SNAPSHOT;
|
||||||
|
import static android.view.WindowManager.TRANSIT_PIP;
|
||||||
|
|
||||||
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONFIGURATION;
|
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONFIGURATION;
|
||||||
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_FOCUS;
|
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_FOCUS;
|
||||||
@@ -237,6 +238,7 @@ import com.android.internal.notification.SystemNotificationChannels;
|
|||||||
import com.android.internal.os.TransferPipe;
|
import com.android.internal.os.TransferPipe;
|
||||||
import com.android.internal.policy.AttributeCache;
|
import com.android.internal.policy.AttributeCache;
|
||||||
import com.android.internal.policy.KeyguardDismissCallback;
|
import com.android.internal.policy.KeyguardDismissCallback;
|
||||||
|
import com.android.internal.protolog.ProtoLogGroup;
|
||||||
import com.android.internal.protolog.common.ProtoLog;
|
import com.android.internal.protolog.common.ProtoLog;
|
||||||
import com.android.internal.util.ArrayUtils;
|
import com.android.internal.util.ArrayUtils;
|
||||||
import com.android.internal.util.FastPrintWriter;
|
import com.android.internal.util.FastPrintWriter;
|
||||||
@@ -3463,6 +3465,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a transition for this pip entry. We guarantee that this gets its own transition
|
||||||
|
// by queueing this transition on SyncEngine. This is shared by all the entry paths.
|
||||||
|
final Transition transition = getTransitionController().isShellTransitionsEnabled()
|
||||||
|
? new Transition(TRANSIT_PIP, 0 /* flags */,
|
||||||
|
getTransitionController(), mWindowManager.mSyncEngine)
|
||||||
|
: null;
|
||||||
|
|
||||||
final Runnable enterPipRunnable = () -> {
|
final Runnable enterPipRunnable = () -> {
|
||||||
synchronized (mGlobalLock) {
|
synchronized (mGlobalLock) {
|
||||||
if (r.getParent() == null) {
|
if (r.getParent() == null) {
|
||||||
@@ -3471,7 +3480,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
}
|
}
|
||||||
r.setPictureInPictureParams(params);
|
r.setPictureInPictureParams(params);
|
||||||
mRootWindowContainer.moveActivityToPinnedRootTask(r,
|
mRootWindowContainer.moveActivityToPinnedRootTask(r,
|
||||||
null /* launchIntoPipHostActivity */, "enterPictureInPictureMode");
|
null /* launchIntoPipHostActivity */, "enterPictureInPictureMode",
|
||||||
|
transition);
|
||||||
final Task task = r.getTask();
|
final Task task = r.getTask();
|
||||||
// Continue the pausing process after entering pip.
|
// Continue the pausing process after entering pip.
|
||||||
if (task.getPausingActivity() == r) {
|
if (task.getPausingActivity() == r) {
|
||||||
@@ -3488,12 +3498,36 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
mActivityClientController.dismissKeyguard(r.token, new KeyguardDismissCallback() {
|
mActivityClientController.dismissKeyguard(r.token, new KeyguardDismissCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onDismissSucceeded() {
|
public void onDismissSucceeded() {
|
||||||
mH.post(enterPipRunnable);
|
if (mWindowManager.mSyncEngine.hasActiveSync()) {
|
||||||
|
ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS,
|
||||||
|
"Creating Pending Pip-Enter: %s", transition);
|
||||||
|
mWindowManager.mSyncEngine.queueSyncSet(
|
||||||
|
() -> getTransitionController().moveToCollecting(transition),
|
||||||
|
enterPipRunnable);
|
||||||
|
} else {
|
||||||
|
// Move to collecting immediately to "claim" the sync-engine for this
|
||||||
|
// transition.
|
||||||
|
if (transition != null) {
|
||||||
|
getTransitionController().moveToCollecting(transition);
|
||||||
|
}
|
||||||
|
mH.post(enterPipRunnable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, null /* message */);
|
}, null /* message */);
|
||||||
} else {
|
} else {
|
||||||
// Enter picture in picture immediately otherwise
|
// Enter picture in picture immediately otherwise
|
||||||
enterPipRunnable.run();
|
if (mWindowManager.mSyncEngine.hasActiveSync()) {
|
||||||
|
ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS,
|
||||||
|
"Creating Pending Pip-Enter: %s", transition);
|
||||||
|
mWindowManager.mSyncEngine.queueSyncSet(
|
||||||
|
() -> getTransitionController().moveToCollecting(transition),
|
||||||
|
enterPipRunnable);
|
||||||
|
} else {
|
||||||
|
if (transition != null) {
|
||||||
|
getTransitionController().moveToCollecting(transition);
|
||||||
|
}
|
||||||
|
enterPipRunnable.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1977,16 +1977,21 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
|||||||
|
|
||||||
void moveActivityToPinnedRootTask(@NonNull ActivityRecord r,
|
void moveActivityToPinnedRootTask(@NonNull ActivityRecord r,
|
||||||
@Nullable ActivityRecord launchIntoPipHostActivity, String reason) {
|
@Nullable ActivityRecord launchIntoPipHostActivity, String reason) {
|
||||||
|
moveActivityToPinnedRootTask(r, launchIntoPipHostActivity, reason, null /* transition */);
|
||||||
|
}
|
||||||
|
|
||||||
|
void moveActivityToPinnedRootTask(@NonNull ActivityRecord r,
|
||||||
|
@Nullable ActivityRecord launchIntoPipHostActivity, String reason,
|
||||||
|
@Nullable Transition transition) {
|
||||||
final TaskDisplayArea taskDisplayArea = r.getDisplayArea();
|
final TaskDisplayArea taskDisplayArea = r.getDisplayArea();
|
||||||
final Task task = r.getTask();
|
final Task task = r.getTask();
|
||||||
final Task rootTask;
|
final Task rootTask;
|
||||||
|
|
||||||
Transition newTransition = null;
|
Transition newTransition = transition;
|
||||||
// Create a transition now to collect the current pinned Task dismiss. Only do the
|
// Create a transition now (if not provided) to collect the current pinned Task dismiss.
|
||||||
// create here as the Task (trigger) to enter PIP is not ready yet.
|
// Only do the create here as the Task (trigger) to enter PIP is not ready yet.
|
||||||
final TransitionController transitionController = task.mTransitionController;
|
final TransitionController transitionController = task.mTransitionController;
|
||||||
if (!transitionController.isCollecting()
|
if (newTransition == null && !transitionController.isCollecting()
|
||||||
&& transitionController.getTransitionPlayer() != null) {
|
&& transitionController.getTransitionPlayer() != null) {
|
||||||
newTransition = transitionController.createTransition(TRANSIT_PIP);
|
newTransition = transitionController.createTransition(TRANSIT_PIP);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user