Merge "Fix launch app crash could stuck system ui render thread." into tm-qpr-dev am: 01276d685c

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

Change-Id: Idf6a74d5a1c9ec77f9fd7da193a866ba22130b11
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Wei Sheng Shih
2022-08-02 11:57:15 +00:00
committed by Automerger Merge Worker
2 changed files with 15 additions and 8 deletions

View File

@@ -2612,7 +2612,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
// either way, abort and reset the sequence. // either way, abort and reset the sequence.
if (parcelable == null if (parcelable == null
|| mTransferringSplashScreenState != TRANSFER_SPLASH_SCREEN_COPYING || mTransferringSplashScreenState != TRANSFER_SPLASH_SCREEN_COPYING
|| mStartingWindow == null || mStartingWindow == null || mStartingWindow.mRemoved
|| finishing) { || finishing) {
if (parcelable != null) { if (parcelable != null) {
parcelable.clearIfNeeded(); parcelable.clearIfNeeded();

View File

@@ -632,6 +632,11 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
final Rect mainFrame = window.getRelativeFrame(); final Rect mainFrame = window.getRelativeFrame();
final StartingWindowAnimationAdaptor adaptor = new StartingWindowAnimationAdaptor(); final StartingWindowAnimationAdaptor adaptor = new StartingWindowAnimationAdaptor();
window.startAnimation(t, adaptor, false, ANIMATION_TYPE_STARTING_REVEAL); window.startAnimation(t, adaptor, false, ANIMATION_TYPE_STARTING_REVEAL);
if (adaptor.mAnimationLeash == null) {
Slog.e(TAG, "Cannot start starting window animation, the window " + window
+ " was removed");
return null;
}
t.setPosition(adaptor.mAnimationLeash, mainFrame.left, mainFrame.top); t.setPosition(adaptor.mAnimationLeash, mainFrame.left, mainFrame.top);
return adaptor.mAnimationLeash; return adaptor.mAnimationLeash;
} }
@@ -679,13 +684,15 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
if (topActivity != null) { if (topActivity != null) {
removalInfo.deferRemoveForIme = topActivity.mDisplayContent removalInfo.deferRemoveForIme = topActivity.mDisplayContent
.mayImeShowOnLaunchingActivity(topActivity); .mayImeShowOnLaunchingActivity(topActivity);
if (removalInfo.playRevealAnimation && playShiftUpAnimation) { final WindowState mainWindow =
final WindowState mainWindow = topActivity.findMainWindow(false/* includeStartingApp */);
topActivity.findMainWindow(false/* includeStartingApp */); // No app window for this activity, app might be crashed.
if (mainWindow != null) { // Remove starting window immediately without playing reveal animation.
removalInfo.windowAnimationLeash = applyStartingWindowAnimation(mainWindow); if (mainWindow == null || mainWindow.mRemoved) {
removalInfo.mainFrame = mainWindow.getRelativeFrame(); removalInfo.playRevealAnimation = false;
} } else if (removalInfo.playRevealAnimation && playShiftUpAnimation) {
removalInfo.windowAnimationLeash = applyStartingWindowAnimation(mainWindow);
removalInfo.mainFrame = mainWindow.getRelativeFrame();
} }
} }
try { try {