CVE-2026-58943 AI-generated analysis
platform/packages/apps/Settings, accounts (AddAccountSettings activity)
AddAccountSettings in the Settings app now tracks its own visibility (mIsVisible, set in onStart and cleared in onStop) and drops the authenticator-supplied KEY_INTENT launch in its AccountManagerCallback when the activity is not visible, closing a background activity launch (BAL) bypass.
Root cause
AddAccountSettings asks AccountManager to add an account. In its AccountManagerCallback it takes the Intent the account authenticator returned under AccountManager.KEY_INTENT and launches it with startActivityForResultAsUser(new Intent(intent), ADD_ACCOUNT_REQUEST, mUserHandle). The code did not check whether the Settings activity was still visible when the callback ran. As a result, Settings could start the authenticator's activity while Settings itself was in the background, bypassing background activity launch restrictions (the commit title calls it a BAL bypass).
How the fix works
- src/com/android/settings/accounts/AddAccountSettings.java: adds a private boolean field mIsVisible (default false).
- AddAccountSettings.onStart / AddAccountSettings.onStop (new overrides): each calls super, then sets mIsVisible to true in onStart and to false in onStop, with verbose logs.
- AddAccountSettings AccountManagerCallback: after reading the KEY_INTENT Intent from the result bundle, and before setting done = false and building addAccountOptions, it checks !mIsVisible. If the activity is not visible, it logs a warning and returns without launching. Otherwise it logs and continues as before.
- On Android 15 (and 14) this manual check is the only mechanism. The commit message says this approach was chosen because MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE is not available on this branch. The diff also adds an import of android.app.ActivityOptions that this branch does not use.
- On Android 16/17 the same visibility check is added. In addition, a static import of MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE is added, and the launch becomes startActivityForResultAsUser(new Intent(intent), ADD_ACCOUNT_REQUEST, options.toBundle(), mUserHandle). The options come from ActivityOptions.makeBasic() with setPendingIntentCreatorBackgroundActivityStartMode and setPendingIntentBackgroundActivityStartMode, both set to MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE.
Completeness
- The fix covers the one site in the AccountManagerCallback where the authenticator-provided KEY_INTENT is started. It is the only place changed.
- The gate is an app-level flag toggled in onStart/onStop, not a system-enforced BAL mode. On Android 15/14 there is no ActivityOptions-based enforcement, so the protection depends on the flag being accurate when the callback runs.
- The callback branch that handles a result without an intent (setResult(RESULT_OK) and mPendingIntent handling) is unchanged.
- When the launch is dropped, the code returns early without setting done = false. The provided context does not show what the surrounding logic then does.
Behavior changes
- If the callback delivers a KEY_INTENT while AddAccountSettings is not visible, the intent is no longer launched. The warning 'Activity is not visible, dropping AddAccount intent launch.' is logged.
- New verbose log lines in onStart, onStop and on the launch path.
- On 16/17 only: the authenticator intent is started with ActivityOptions setting both pending-intent BAL modes (creator and sender) to MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE.
- According to the commit message, the Google and TikTok authenticator login flows, and the OneGoogle login flow from Drive and Gmail, still work.
Per major
- Android 14: Same fix as 15: commit 1b0e31f070d7 in android-security-14.0.0_r31, with an identical diff (mIsVisible tracking and the manual drop in the callback, no ActivityOptions BAL mode). 8/8 patched lines present.
- Android 15: Fix commit 70dd7cc00109 in android-security-15.0.0_r19: mIsVisible tracking in onStart/onStop and a manual drop of the KEY_INTENT launch when not visible. The ActivityOptions import is added but unused because MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE is not available on this branch. 8/8 patched lines present.
- Android 16: Adapted fix: commit b70d3754d990 in android-security-16.0.0_r10 includes the same mIsVisible check. It also passes ActivityOptions with MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE (creator and sender modes) to startActivityForResultAsUser. 8/8 patched lines present.
- Android 17: Adapted fix: commit 9c7b03ebb047 in android-security-17.0.0_r3, same content as the Android 16 commit (manual check plus ActivityOptions BAL mode). 8/8 patched lines present.
Unknowns
- The rest of the callback logic (handling of the 'done' flag and finish()) after the new early return is not shown in the material.
- The material does not show whether other Settings components launch authenticator-supplied intents in a similar way.
- The material does not include the original report or PoC details beyond the commit message's test-flow description.