Don't transfer splash screen if activity is finishing.

Save more unnecessary memory.

Bug: 221703756
Test: atest SplashscreenTests
Test: register exit listener at onCreate and finish activity at onStart,
verify no transfer splash screen happen at all.

Change-Id: If515b0825a56b8899750fde842853724ce17ab41
This commit is contained in:
wilsonshih
2022-03-10 15:57:13 +08:00
parent c48098c1f1
commit 0d095c2a97

View File

@@ -2476,7 +2476,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
}
private boolean transferSplashScreenIfNeeded() {
if (!mHandleExitSplashScreen || mStartingSurface == null || mStartingWindow == null
if (finishing || !mHandleExitSplashScreen || mStartingSurface == null
|| mStartingWindow == null
|| mTransferringSplashScreenState == TRANSFER_SPLASH_SCREEN_FINISH) {
return false;
}