Fix activity launch incorrectly blocked after activity finishes
A race condition can cause the activity security model to incorrectly block a legitimate activity launch. This occurs when a top activity finishes and another is launched immediately after. When the first activity's task is removed, it can leave a stale reference in TaskDisplayArea.mPreferredTopFocusableRootTask. Subsequently, when getFocusedRootTask() is called to determine the current focus state, it returns this stale task. The BackgroundActivityStartController misinterprets this, believing a new activity is trying to launch over a valid focused task, and blocks it. The necessary cleanup logic to clear mPreferredTopFocusableRootTask was previously guarded by the polish_close_wallpaper_includes_open_change flag. This change removes the flag check, making this cleanup unconditional. This ensures the focus system always has an accurate view of the task stack and prevents the security model from making decisions based on stale data. Fixes: 429317375 Test: atest CtsWindowManagerBackgroundActivityTestCases:android.server.wm.ActivitySecurityModelTest#testTopFinishesThenLaunchesActivity_launchAllowed Flag: EXEMPT BUGFIX Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:836a80bc1cbc72b22cb79d2594ed088c6b58581c Merged-In: I77dbe773723cb6a3e5bc568a57040c469c1263c2 Change-Id: I77dbe773723cb6a3e5bc568a57040c469c1263c2
Loading
Please register or sign in to comment