diff options
author | 2025-03-07 01:10:15 -0800 | |
---|---|---|
committer | 2025-03-07 01:10:15 -0800 | |
commit | e0ab7b97975c18603ec4cd92806932393bd749e1 (patch) | |
tree | 9f471bbc5ef059b163a81c53ef1e70bb239202bd /services/surfaceflinger/DisplayDevice.cpp | |
parent | 8520206d162a244e100e27354246fc021d585367 (diff) |
Handle virtual display power state in SurfaceFlinger
If the state changes while there's no surface, the new power state is lost. Even though there's no DisplayDevice, there's a proper DisplayDeviceState for that virtual display. Storing the power state there and respecting it when creating the display will work.
This is tied to android::companion::virtualdevice::flags::correct_virtual_display_power_state since that flag controls whether or not to set the power mode of the SurfaceControl for the virtual display (which ultimately feeds into SurfaceFlinger::setPowerMode).
With this change, virtual displays whose PowerMode is OFF will no longer be composited since the correct power mode is now set in SurfaceFlinger (instead of assuming all virtual displays are ON).
Bug: 342681202
Flag: android.companion.virtualdevice.flags.correct_virtual_display_power_state
Test: manually tested with flag on/off with Android Auto Projected
Change-Id: Ib10514da05e277a8ed574c92ff71d2a4d52975b2
Diffstat (limited to 'services/surfaceflinger/DisplayDevice.cpp')
-rw-r--r-- | services/surfaceflinger/DisplayDevice.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp index 07770f12ba..b39654437f 100644 --- a/services/surfaceflinger/DisplayDevice.cpp +++ b/services/surfaceflinger/DisplayDevice.cpp @@ -180,8 +180,7 @@ auto DisplayDevice::getFrontEndInfo() const -> frontend::DisplayInfo { } void DisplayDevice::setPowerMode(hal::PowerMode mode) { - // TODO(b/241285876): Skip this for virtual displays. - if (mode == hal::PowerMode::OFF || mode == hal::PowerMode::ON) { + if (!isVirtual() && (mode == hal::PowerMode::OFF || mode == hal::PowerMode::ON)) { if (mStagedBrightness && mBrightness != mStagedBrightness) { getCompositionDisplay()->setNextBrightness(*mStagedBrightness); mBrightness = *mStagedBrightness; |