Set default color mode for all displays
Virtual displays were not getting their color mode set
and that confused SurfaceFlinger when it was working with
virtual displays. Now set the display to the same default
color mode as the default display.
Test: b/37102733
Should not see screen turn green when enabling
"simulate secondary displays" function.
bug: 37102733
Change-Id: I4d8f9e8d5c191623a286b03a05841bdeb20718b1
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index b5ffc60..6b1b3d2 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -121,7 +121,8 @@
ANativeWindow* const window = mNativeWindow.get();
#ifdef USE_HWC2
- mActiveColorMode = static_cast<android_color_mode_t>(-1);
+ // Set defaultColorMode to SRGB if this device supports wide-color
+ mActiveColorMode = (supportWideColor) ? HAL_COLOR_MODE_SRGB : HAL_COLOR_MODE_NATIVE;
mDisplayHasWideColor = supportWideColor;
#else
(void) supportWideColor;