CVE-2026-58957 AI-generated analysis
platform/frameworks/base, WindowManager/ActivityTaskManager activity start (services/core/java/com/android/server/wm/ActivityStarter.java)
ActivityStarter.resolveToHeavyWeightSwitcherIfNeeded() now keeps the original app calling UID/PID in mRequest (and sets ignoreTargetSecurity) when rerouting a launch to HeavyWeightSwitcherActivity, instead of replacing them with the system identity from Binder.getCallingUid()/getCallingPid(), so BAL and Intent Firewall checks run against the real caller.
Root cause
In ActivityStarter.resolveToHeavyWeightSwitcherIfNeeded(), when a launch of a cantSaveState="true" activity conflicts with the active heavy-weight process, the request is rewritten to target HeavyWeightSwitcherActivity. The rewrite set mRequest.callingUid = Binder.getCallingUid() and mRequest.callingPid = Binder.getCallingPid(); because this runs after Binder.clearCallingIdentity(), those values are the system_server identity (SYSTEM_UID 1000). checkBackgroundActivityStart() evaluates BAL against mRequest.callingUid, so the rerouted launch was judged as coming from SYSTEM_UID and allowed via BAL_ALLOW_ALLOWLISTED_UID, letting an untrusted background app get the switcher activity started over the foreground app (per the commit message).
How the fix works
- ActivityStarter.java:resolveToHeavyWeightSwitcherIfNeeded(): next to the existing appCallingUid capture, a new local appCallingPid is initialized from mRequest.callingPid. When mRequest.caller resolves to a WindowProcessController, the fix sets appCallingUid = callerApp.mInfo.uid (callerApp.mUid on Android 17) and appCallingPid = callerApp.getPid(). When mRequest.caller is null, the values taken from mRequest are kept.
- ActivityStarter.java:resolveToHeavyWeightSwitcherIfNeeded(): when the request is rewritten to HeavyWeightSwitcherActivity, mRequest.callingUid = appCallingUid and mRequest.callingPid = appCallingPid replace the previous Binder.getCallingUid()/Binder.getCallingPid() assignments. The BAL check in checkBackgroundActivityStart() and the Intent Firewall therefore see the true app caller.
- ActivityStarter.java:resolveToHeavyWeightSwitcherIfNeeded(): mRequest.ignoreTargetSecurity = true is set on the rerouted request so that ActivityTaskSupervisor.checkStartAnyActivityPermission still lets the app-identity caller start the non-exported system activity. This compensates for the request no longer carrying SYSTEM_UID.
- ActivityStarter.java:Request: new Javadoc on ignoreTargetSecurity states that it only bypasses target component permission/exported checks in checkStartAnyActivityPermission and has no effect on BAL or Intent Firewall.
- ActivityStarterTests.java (shown in the Android 17 commit): two tests are added. testHeavyWeightSwitcher_preservesCallingUid_setsFlag asserts that callingUid/callingPid are preserved, ignoreTargetSecurity is true, the component is HeavyWeightSwitcherActivity and the result is START_SUCCESS. testHeavyWeightSwitcher_blockedByBal_whenCallerInBackground asserts START_ABORTED when BalVerdict.BLOCK is returned.
Completeness
- The fix is confined to the HeavyWeightSwitcherActivity reroute in resolveToHeavyWeightSwitcherIfNeeded(). There, the identity overwrite is removed for both UID and PID.
- The diff does not touch mRequest.realCallingUid/realCallingPid. The material does not show whether the reroute altered them before the fix, so how this path handles them cannot be judged either way.
- ignoreTargetSecurity is now set to true for the rerouted request. This bypasses the component permission and exported checks in checkStartAnyActivityPermission for that request. The reroute fixes the target component to HeavyWeightSwitcherActivity, and the new Javadoc states the flag does not affect BAL or Intent Firewall.
- When mRequest.caller is null, the preserved identity is whatever mRequest.callingUid/callingPid already held. The diff adds no validation of those values.
- Other intent-rerouting paths in ActivityStarter are not in the material, so it cannot be judged whether they handle calling identity in a similar way.
Behavior changes
- Launches rerouted to HeavyWeightSwitcherActivity are now subject to Background Activity Launch evaluation against the originating app UID/PID. If a background caller fails BAL, the launch is aborted (START_ABORTED in the added test) and the switcher does not appear.
- Intent Firewall checks for the rerouted launch now see the app's UID/PID rather than SYSTEM_UID.
- The rerouted request carries ignoreTargetSecurity = true, so callers that pass BAL can still start the non-exported system activity.
Per major
- Android 14: Same fix, applied by change_id as f7305581b71e in android-security-14.0.0_r31. The shown diff touches only ActivityStarter.java (offsets differ, callerApp.mInfo.uid). The resolver reports 7/8 patched-region lines present at that tag.
- Android 15: Same fix, 99a8636b4142 in android-security-15.0.0_r19 (cherry-pick of 038570272e1b). The diffstat shows only ActivityStarter.java changed (20 insertions, 3 deletions), so the unit tests named in the commit message are not in this cherry-pick. 7/8 patched-region lines present.
- Android 16: Same fix, 7c921ec9ebb0 in android-security-16.0.0_r10. The shown diff touches only ActivityStarter.java (offsets differ). 7/8 patched-region lines present.
- Android 17: Adapted fix, c6dfa8f425a6 in android-security-17.0.0_r3. It uses callerApp.mUid instead of callerApp.mInfo.uid and includes the two new ActivityStarterTests tests. 7/8 patched-region lines present.
Unknowns
- Which of the 8 patched-region lines the resolver reports as missing at each security tag (7/8 on all four majors) is not shown. It may be a context-line difference rather than a missing fix line.
- Whether the Android 14 and 16 cherry-picks include the ActivityStarterTests changes (only the ActivityStarter.java hunks are shown for them).
- The rest of the else branch after the WindowProcessController lookup fails (beyond the Slog.w line) is not shown, so it is unknown whether the method returns early there or continues with the mRequest values.
- The pre-fix handling of mRequest.realCallingUid/realCallingPid in the reroute path is not in the provided context.
- The code of checkBackgroundActivityStart() and checkStartAnyActivityPermission() is not provided. Their behavior is taken from the commit message and the new Javadoc.