CVE-2026-58961 AI-generated analysis
platform/frameworks/base, WindowManager/ActivityTaskManagerService (services/core/java/com/android/server/wm)
In ActivityTaskManagerService.moveTaskToFront, the fix checks the caller-supplied SafeActivityOptions against every ActivityRecord in the target task (task.forAllActivities with options.getOptions(r)) before it computes the real options and moves the task. If any activity in the task fails the check, a SecurityException is thrown (per the commit message) and the move does not happen.
Root cause
In services/core/java/com/android/server/wm/ActivityTaskManagerService.java, the moveTaskToFront path turned the caller's SafeActivityOptions into ActivityOptions with one call, options.getOptions(mTaskSupervisor), and passed the result to mTaskSupervisor.findTaskToMoveToFront(task, flags, realOptions, "moveTaskToFront", false). That call did not check the options against the individual activities in the task. Per the commit message, the per-activity display permission checks were therefore not performed for the activities being moved.
How the fix works
- services/core/java/com/android/server/wm/ActivityTaskManagerService.java, moveTaskToFront path (the block that ends with mTaskSupervisor.findTaskToMoveToFront(..., "moveTaskToFront", ...)): the ternary that computed realOptions is replaced by a variable initialized to null and an if (options != null) block.
- Inside that block, task.forAllActivities((r) -> { options.getOptions(r); }) runs first. It calls the ActivityRecord overload of getOptions for every activity in the task. Per the commit message, this checks display permissions using the caller's identity and throws SecurityException if any activity fails, which stops the call before findTaskToMoveToFront runs.
- Only after that is realOptions = options.getOptions(mTaskSupervisor) computed, as before the fix, and passed to findTaskToMoveToFront. When options is null nothing changes: realOptions stays null and no per-activity check runs.
Completeness
- Covers the single moveTaskToFront call site in ActivityTaskManagerService.java: every activity in the task is checked, not just the top one, and the check runs before findTaskToMoveToFront.
- When options is null no per-activity check runs, and the move proceeds with realOptions == null, as before the fix.
- The check covers the activities in the task at the time of the call. Activities added to the task later are outside the scope of this diff.
- The diff changes only this one call site. The material does not show whether other paths that turn SafeActivityOptions into ActivityOptions for an existing task apply the same per-activity check.
- The return value of options.getOptions(r) inside the lambda is thrown away; the call is made only for its permission check, which throws on failure.
Behavior changes
- moveTaskToFront with non-null ActivityOptions now throws SecurityException when any activity in the target task fails the options permission check (per the commit message). Before the fix the move went ahead.
- When options are non-null, getOptions is now called once per activity in the task plus once for the supervisor, instead of once.
- Legitimate callers whose options pass the check for every activity in the task see no functional change.
Per major
- Android 14: same fix: platform/frameworks/base 25931d579306 in android-security-14.0.0_r31, identical hunk at a different line offset (around line 2268).
- Android 15: same fix: platform/frameworks/base c4e0cdfe07eb in android-security-15.0.0_r19, hunk at around line 2283; this is the reference commit.
- Android 16: same fix: platform/frameworks/base d24c107b928d in android-security-16.0.0_r10, identical hunk at around line 2343.
- Android 17: same fix: platform/frameworks/base 4c71997176db in android-security-17.0.0_r3, identical hunk at around line 2482.
Unknowns
- The material does not include the exact check inside SafeActivityOptions.getOptions(ActivityRecord); the commit message calls it display permission verification.
- The diff does not show whether the Binder calling identity is still the original caller's when the new check runs; the commit message states that the caller's identity is used.
- Not provided: which of the three bug IDs (527035781, 527036864, 527039128) maps to which reported scenario, and what the ActivityTaskManagerServiceTests for this change contain.
- The material does not show whether any other entry point that moves or reorders an existing task with caller-supplied ActivityOptions received an equivalent change.
- The condition of the early SafeActivityOptions.abort guard before the changed block is not shown.