Fix launch app crash could stuck system ui render thread.

Do not play reveal animation if the launching app is crashed. When
requesting the reveal animation, the splash screen window will need to
request traversal in system ui process, however, since the starting
window will be removed from WM, the VRI#reportDrawFinished transaction
will never being apply, which will stuck the system ui render thread
until dequeue buffer timeout.

Also fix a crash issue that the window which request to start reveal
animation might be removed already, we should skip to create the
animation leash by checking whether the window was removed.

Bug: 236931014
Bug: 229853681
Test: enable shell transition, repeatly launch the test app which will
crash at onCreate. Verify no ANR on systemui process.

Change-Id: I3fa4b5f231780d0b4e7ab9ab9070167768e5a122
This commit is contained in:
wilsonshih
2022-06-29 15:53:51 +08:00
parent a88654665d
commit e062ca6636
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.
if (parcelable == null
|| mTransferringSplashScreenState != TRANSFER_SPLASH_SCREEN_COPYING
|| mStartingWindow == null
|| mStartingWindow == null || mStartingWindow.mRemoved
|| finishing) {
if (parcelable != null) {
parcelable.clearIfNeeded();

View File

@@ -632,6 +632,11 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
final Rect mainFrame = window.getRelativeFrame();
final StartingWindowAnimationAdaptor adaptor = new StartingWindowAnimationAdaptor();
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);
return adaptor.mAnimationLeash;
}
@@ -679,13 +684,15 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
if (topActivity != null) {
removalInfo.deferRemoveForIme = topActivity.mDisplayContent
.mayImeShowOnLaunchingActivity(topActivity);
if (removalInfo.playRevealAnimation && playShiftUpAnimation) {
final WindowState mainWindow =
topActivity.findMainWindow(false/* includeStartingApp */);
if (mainWindow != null) {
removalInfo.windowAnimationLeash = applyStartingWindowAnimation(mainWindow);
removalInfo.mainFrame = mainWindow.getRelativeFrame();
}
final WindowState mainWindow =
topActivity.findMainWindow(false/* includeStartingApp */);
// No app window for this activity, app might be crashed.
// Remove starting window immediately without playing reveal animation.
if (mainWindow == null || mainWindow.mRemoved) {
removalInfo.playRevealAnimation = false;
} else if (removalInfo.playRevealAnimation && playShiftUpAnimation) {
removalInfo.windowAnimationLeash = applyStartingWindowAnimation(mainWindow);
removalInfo.mainFrame = mainWindow.getRelativeFrame();
}
}
try {