CVE-2026-58934 AI-generated analysis
platform/frameworks/base, WindowManager (services/core/java/com/android/server/wm/WindowState.java)
WindowState.prepareWindowToDisplayDuringRelayout() now only allows a window with FLAG_TURN_SCREEN_ON (or an ActivityRecord that can turn the screen on) to call PowerManager.wakeUp() when the window's DisplayContent is non-null and trusted, closing a path where a non-activity window on an untrusted virtual display could wake the physical screen.
Root cause
In WindowState.prepareWindowToDisplayDuringRelayout(), when hasTurnScreenOnFlag was set, canTurnScreenOn was computed as `mActivityRecord == null || mActivityRecord.currentLaunchCanTurnScreenOn()`. For a window with no ActivityRecord (for example a TYPE_PRIVATE_PRESENTATION window, per the commit message) this short-circuited to true, with no check of which display the window belonged to and no one-shot restriction. If theater mode allowed waking and the device was dreaming or not interactive, the code called mWmService.mPowerManager.wakeUp(..., WAKE_REASON_APPLICATION, "android.server.wm:SCREEN_ON_FLAG"). According to the commit message, zero-permission virtual displays fall back to the DEFAULT_DISPLAY_GROUP, so a window on such an untrusted private virtual display woke the physical screen and could do so repeatedly, bypassing the TURN_SCREEN_ON permission.
How the fix works
- services/core/java/com/android/server/wm/WindowState.java:prepareWindowToDisplayDuringRelayout(): the canTurnScreenOn expression is replaced by `getDisplayContent() != null && getDisplayContent().isTrusted() && (mActivityRecord == null || mActivityRecord.currentLaunchCanTurnScreenOn())`, declared final.
- Effect: the wakeUp() branch (`allowTheaterMode && canTurnScreenOn && (isDreaming() || !isInteractive())`) is now unreachable for windows whose DisplayContent is null or whose display is not trusted, regardless of whether the window has an ActivityRecord.
- The rest of the block is unchanged: hasTurnScreenOnFlag is computed the same way, and mActivityRecord.setCurrentLaunchCanTurnScreenOn(false) is still called afterwards for activity windows.
- Single-file, single-hunk change; the commit message lists WindowStateTests as the test, but no test file is included in the diff shown.
Completeness
- Covers: the only wakeUp() call in prepareWindowToDisplayDuringRelayout(); both activity windows and non-activity windows on untrusted or null DisplayContent are now blocked from waking the screen through this path.
- Leaves unchanged: on trusted displays, a non-activity window (mActivityRecord == null) still short-circuits canTurnScreenOn to true with no one-shot restriction; the fix gates on display trust rather than adding a per-window limit or a TURN_SCREEN_ON permission check at this point.
- The material does not show other code paths that honor FLAG_TURN_SCREEN_ON or ActivityRecord.canTurnScreenOn() (for example at activity launch), so whether they already check display trust is not visible here.
Behavior changes
- Windows on untrusted displays (including activity windows, and any caller holding the TURN_SCREEN_ON permission) no longer wake the device via FLAG_TURN_SCREEN_ON or ActivityRecord.canTurnScreenOn() during relayout.
- A window whose getDisplayContent() returns null also no longer triggers wakeUp() from this path.
- No new error or exception; the wake request is silently skipped. Debug log 'Relayout window turning screen on' is no longer emitted for these windows.
Per major
- Android 14: same fix: commit 1abda71b5d04 in android-security-14.0.0_r31, identical hunk; surrounding code differs only in using mPowerManagerWrapper.isInteractive() on the following line.
- Android 15: same fix: commit 301fa640ebd7 in android-security-15.0.0_r19, the reference diff; following line uses mWmService.mPowerManager.isInteractive().
- Android 16: same fix: commit e4cabe8de086 in android-security-16.0.0_r10, identical hunk at a different offset (line 2717); following line uses mWmService.mPowerManager.isInteractive(getDisplayId()).
- Android 17: same fix: commit dfc1b5219ffb in android-security-17.0.0_r3, identical hunk at line 2895; following line uses mWmService.mPowerManager.isInteractive(getDisplayId()).
Unknowns
- The second cherry-picked commit (0d805b6d75ae...) and the WindowStateTests changes are not shown in the material.
- The material does not show DisplayContent.isTrusted() or how untrusted virtual displays map to DEFAULT_DISPLAY_GROUP; that behavior is taken from the commit message only.
- The per-major facts report 6/7 lines of the patched region on every branch, including the reference branch 15; the material does not show which line is missing.