Fixes crash (race cond) when destroyActivity.

some UI stress (or sleep on UI thread) causes a crash
from DESTROY_TIMEOUT_MSG.
The steps that crash the app are:
1. build two activities ,such as A and B;
2. A start B;
3. B(oncreate) start A use FLAG_ACTIVITY_CLEAR_TOP;
4. B(oncreate) stall UI thread (Thread.sleep, heavy task)
5. crash tring to handleLaunchActivity or handleResumeActivity

Bug: 128469605
Test: manual - write an app to jump between two activities, then
Thread.sleep();
Change-Id: I4027dfc0cf3878c12964cabee54ad82bc108d79c
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
2026-01-02 22:31:16 +07:00
parent ce1887346c
commit 9dcedb7f28

View File

@@ -4493,7 +4493,7 @@ public final class ActivityThread extends ClientTransactionHandler
return;
}
Configuration[] configurations = r.activity.getResources().getSizeConfigurations();
if (configurations == null) {
if (configurations == null || r.activity.mFinished) {
return;
}
r.mSizeConfigurations = new SizeConfigurationBuckets(configurations);