Merge "Reset leash and content overlay if auto-enter-pip is aborted" into sc-dev am: d8bc208185

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15341832

Change-Id: I9aa6f1e29899c70d8be908c9873463bfaf15a77d
This commit is contained in:
Hongwei Wang
2021-07-28 14:51:16 +00:00
committed by Automerger Merge Worker
3 changed files with 11 additions and 2 deletions

View File

@@ -5154,6 +5154,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
void notifyAppStopped() {
ProtoLog.v(WM_DEBUG_ADD_REMOVE, "notifyAppStopped: %s", this);
mAppStopped = true;
// This is to fix the edge case that auto-enter-pip is finished in Launcher but app calls
// setAutoEnterEnabled(false) and transitions to STOPPED state, see b/191930787.
// Clear any surface transactions and content overlay in this case.
if (task != null && task.mLastRecentsAnimationTransaction != null) {
task.clearLastRecentsAnimationTransaction(true /* forceRemoveOverlay */);
}
// Reset the last saved PiP snap fraction on app stop.
mDisplayContent.mPinnedTaskController.onActivityHidden(mActivityComponent);
mDisplayContent.mUnknownAppVisibilityController.appRemovedOrHidden(this);

View File

@@ -2157,7 +2157,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
rootTask.setLastRecentsAnimationTransaction(
task.mLastRecentsAnimationTransaction,
task.mLastRecentsAnimationOverlay);
task.clearLastRecentsAnimationTransaction();
task.clearLastRecentsAnimationTransaction(false /* forceRemoveOverlay */);
}
// There are multiple activities in the task and moving the top activity should

View File

@@ -6031,7 +6031,10 @@ class Task extends TaskFragment {
mLastRecentsAnimationOverlay = overlay;
}
void clearLastRecentsAnimationTransaction() {
void clearLastRecentsAnimationTransaction(boolean forceRemoveOverlay) {
if (forceRemoveOverlay && mLastRecentsAnimationOverlay != null) {
getPendingTransaction().remove(mLastRecentsAnimationOverlay);
}
mLastRecentsAnimationTransaction = null;
mLastRecentsAnimationOverlay = null;
// reset also the crop and transform introduced by mLastRecentsAnimationTransaction