Fix system crash during RWC#resumeHomeActivity called.

Add global lock when calling RWC#resumeHomeActivity to
fix the CL[1] that calling method by post runnable,
system may crash due to race condition during force-stop
launcher package.

[1]: I243fab507268f81df0a8067883157d63f0f79c22

Fix: 129352498
Test: atest TaplTestsLauncher3 without system crash.

Change-Id: I2d63ee43f8ca832d3f1c5e49b518af712ac6e0d3
This commit is contained in:
lumark
2019-03-27 16:40:46 +08:00
committed by Ming-Shin Lu
parent 356c5dfd42
commit 553fec2267

View File

@@ -3059,7 +3059,11 @@ class ActivityStack extends ConfigurationContainer {
// activity in home stack.
// See {@link #mInResumeTopActivity}.
mService.mH.post(
() -> mRootActivityContainer.resumeHomeActivity(prev, reason, mDisplayId));
() -> {
synchronized (mService.mGlobalLock) {
mRootActivityContainer.resumeHomeActivity(prev, reason, mDisplayId);
}
});
return true;
} else {
return mRootActivityContainer.resumeHomeActivity(prev, reason, mDisplayId);