Merge "Fix a couple more issues with canceling the recents animation w/ screenshots" into sc-dev
This commit is contained in:
@@ -239,8 +239,10 @@ class RecentsAnimation implements RecentsAnimationCallbacks, OnRootTaskOrderChan
|
|||||||
// Fetch all the surface controls and pass them to the client to get the animation
|
// Fetch all the surface controls and pass them to the client to get the animation
|
||||||
// started. Cancel any existing recents animation running synchronously (do not hold the
|
// started. Cancel any existing recents animation running synchronously (do not hold the
|
||||||
// WM lock)
|
// WM lock)
|
||||||
mWindowManager.cancelRecentsAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION,
|
if (mWindowManager.getRecentsAnimationController() != null) {
|
||||||
"startRecentsActivity");
|
mWindowManager.getRecentsAnimationController().forceCancelAnimation(
|
||||||
|
REORDER_MOVE_TO_ORIGINAL_POSITION, "startRecentsActivity");
|
||||||
|
}
|
||||||
mWindowManager.initializeRecentsAnimation(mTargetActivityType, recentsAnimationRunner,
|
mWindowManager.initializeRecentsAnimation(mTargetActivityType, recentsAnimationRunner,
|
||||||
this, mDefaultTaskDisplayArea.getDisplayId(),
|
this, mDefaultTaskDisplayArea.getDisplayId(),
|
||||||
mTaskSupervisor.mRecentTasks.getRecentTaskIds(), targetActivity);
|
mTaskSupervisor.mRecentTasks.getRecentTaskIds(), targetActivity);
|
||||||
|
|||||||
@@ -122,9 +122,7 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
new ArrayList<>();
|
new ArrayList<>();
|
||||||
private final int mDisplayId;
|
private final int mDisplayId;
|
||||||
private boolean mWillFinishToHome = false;
|
private boolean mWillFinishToHome = false;
|
||||||
private final Runnable mFailsafeRunnable = () -> cancelAnimation(
|
private final Runnable mFailsafeRunnable = this::onFailsafe;
|
||||||
mWillFinishToHome ? REORDER_MOVE_TO_TOP : REORDER_MOVE_TO_ORIGINAL_POSITION,
|
|
||||||
"failSafeRunnable");
|
|
||||||
|
|
||||||
// The recents component app token that is shown behind the visibile tasks
|
// The recents component app token that is shown behind the visibile tasks
|
||||||
private ActivityRecord mTargetActivityRecord;
|
private ActivityRecord mTargetActivityRecord;
|
||||||
@@ -262,9 +260,6 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
final long token = Binder.clearCallingIdentity();
|
final long token = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
synchronized (mService.getWindowManagerLock()) {
|
synchronized (mService.getWindowManagerLock()) {
|
||||||
if (mCanceled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Remove all new task targets.
|
// Remove all new task targets.
|
||||||
for (int i = mPendingNewTaskTargets.size() - 1; i >= 0; i--) {
|
for (int i = mPendingNewTaskTargets.size() - 1; i >= 0; i--) {
|
||||||
removeTaskInternal(mPendingNewTaskTargets.get(i));
|
removeTaskInternal(mPendingNewTaskTargets.get(i));
|
||||||
@@ -807,6 +802,14 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
}, mPendingWallpaperAnimations);
|
}, mPendingWallpaperAnimations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void forceCancelAnimation(@ReorderMode int reorderMode, String reason) {
|
||||||
|
if (!mCanceled) {
|
||||||
|
cancelAnimation(reorderMode, reason);
|
||||||
|
} else {
|
||||||
|
continueDeferredCancelAnimation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cancelAnimation(@ReorderMode int reorderMode, String reason) {
|
void cancelAnimation(@ReorderMode int reorderMode, String reason) {
|
||||||
cancelAnimation(reorderMode, false /*screenshot */, reason);
|
cancelAnimation(reorderMode, false /*screenshot */, reason);
|
||||||
}
|
}
|
||||||
@@ -821,9 +824,6 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
* finish the animation.
|
* finish the animation.
|
||||||
*/
|
*/
|
||||||
public void cancelAnimationForHomeStart() {
|
public void cancelAnimationForHomeStart() {
|
||||||
if (mCanceled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final int reorderMode = mTargetActivityType == ACTIVITY_TYPE_HOME && mWillFinishToHome
|
final int reorderMode = mTargetActivityType == ACTIVITY_TYPE_HOME && mWillFinishToHome
|
||||||
? REORDER_MOVE_TO_TOP
|
? REORDER_MOVE_TO_TOP
|
||||||
: REORDER_KEEP_IN_PLACE;
|
: REORDER_KEEP_IN_PLACE;
|
||||||
@@ -836,9 +836,6 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
* how to finish the animation.
|
* how to finish the animation.
|
||||||
*/
|
*/
|
||||||
public void cancelAnimationForDisplayChange() {
|
public void cancelAnimationForDisplayChange() {
|
||||||
if (mCanceled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
cancelAnimation(mWillFinishToHome ? REORDER_MOVE_TO_TOP : REORDER_MOVE_TO_ORIGINAL_POSITION,
|
cancelAnimation(mWillFinishToHome ? REORDER_MOVE_TO_TOP : REORDER_MOVE_TO_ORIGINAL_POSITION,
|
||||||
true /* screenshot */, "cancelAnimationForDisplayChange");
|
true /* screenshot */, "cancelAnimationForDisplayChange");
|
||||||
}
|
}
|
||||||
@@ -868,6 +865,8 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
if (taskSnapshot != null) {
|
if (taskSnapshot != null) {
|
||||||
// Defer until the runner calls back to cleanupScreenshot()
|
// Defer until the runner calls back to cleanupScreenshot()
|
||||||
adapter.setSnapshotOverlay(taskSnapshot);
|
adapter.setSnapshotOverlay(taskSnapshot);
|
||||||
|
// Schedule a new failsafe for if the runner doesn't clean up the screenshot
|
||||||
|
scheduleFailsafe();
|
||||||
} else {
|
} else {
|
||||||
// Do a normal cancel since we couldn't screenshot
|
// Do a normal cancel since we couldn't screenshot
|
||||||
mCallbacks.onAnimationFinished(reorderMode, false /* sendUserLeaveHint */);
|
mCallbacks.onAnimationFinished(reorderMode, false /* sendUserLeaveHint */);
|
||||||
@@ -1014,6 +1013,12 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
mService.mH.postDelayed(mFailsafeRunnable, FAILSAFE_DELAY);
|
mService.mH.postDelayed(mFailsafeRunnable, FAILSAFE_DELAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onFailsafe() {
|
||||||
|
forceCancelAnimation(
|
||||||
|
mWillFinishToHome ? REORDER_MOVE_TO_TOP : REORDER_MOVE_TO_ORIGINAL_POSITION,
|
||||||
|
"onFailsafe");
|
||||||
|
}
|
||||||
|
|
||||||
private void linkToDeathOfRunner() throws RemoteException {
|
private void linkToDeathOfRunner() throws RemoteException {
|
||||||
if (!mLinkedToDeathOfRunner) {
|
if (!mLinkedToDeathOfRunner) {
|
||||||
mRunner.asBinder().linkToDeath(this, 0);
|
mRunner.asBinder().linkToDeath(this, 0);
|
||||||
@@ -1030,13 +1035,7 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void binderDied() {
|
public void binderDied() {
|
||||||
if (!mCanceled) {
|
forceCancelAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION, "binderDied");
|
||||||
cancelAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION, "binderDied");
|
|
||||||
} else {
|
|
||||||
// If we are already canceled but with a screenshot, and are waiting for the
|
|
||||||
// cleanupScreenshot() callback, then force-finish the animation now
|
|
||||||
continueDeferredCancelAnimation();
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized (mService.getWindowManagerLock()) {
|
synchronized (mService.getWindowManagerLock()) {
|
||||||
// Clear associated input consumers on runner death
|
// Clear associated input consumers on runner death
|
||||||
@@ -1358,5 +1357,7 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
+ mCancelOnNextTransitionStart);
|
+ mCancelOnNextTransitionStart);
|
||||||
pw.print(innerPrefix); pw.println("mCancelDeferredWithScreenshot="
|
pw.print(innerPrefix); pw.println("mCancelDeferredWithScreenshot="
|
||||||
+ mCancelDeferredWithScreenshot);
|
+ mCancelDeferredWithScreenshot);
|
||||||
|
pw.print(innerPrefix); pw.println("mPendingCancelWithScreenshotReorderMode="
|
||||||
|
+ mPendingCancelWithScreenshotReorderMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user