summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author wilsonshih <wilsonshih@google.com> 2022-06-29 15:53:51 +0800
committer wilsonshih <wilsonshih@google.com> 2022-07-27 18:25:10 +0800
commite062ca66367f6abc09be81ee0f59052a1bcd29a1 (patch)
treee28de807eb4b6cfd5520d0509ee301dd78841558
parenta88654665df1f0f572abe8ab17bdf47e03bbb281 (diff)
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
-rw-r--r--services/core/java/com/android/server/wm/ActivityRecord.java2
-rw-r--r--services/core/java/com/android/server/wm/TaskOrganizerController.java21
2 files changed, 15 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index a044e60b40ae..91f8b3b9c361 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -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();
diff --git a/services/core/java/com/android/server/wm/TaskOrganizerController.java b/services/core/java/com/android/server/wm/TaskOrganizerController.java
index 801665862d29..c6989ef906d5 100644
--- a/services/core/java/com/android/server/wm/TaskOrganizerController.java
+++ b/services/core/java/com/android/server/wm/TaskOrganizerController.java
@@ -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 {