Remove hard code color space.
In general when there's a color space involved, we must explicitly
specify instead of hard coding.
Bug: N/A
Test: atest SurfaceFlinger_unittest
Change-Id: I87c84990b4ec4bd815d7d552346c5fc8c7274135
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 7edbcaa..575da26 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -5414,9 +5414,8 @@
// (ex. displayP3) to enhance the content, but some cases are checking native RGB in bytes,
// and failed if display is not in native mode. This provide a way to force using native
// colors when capture.
- if (args.useRGBColorSpace) {
- dataspace = Dataspace::V0_SRGB;
- } else {
+ dataspace = args.dataspace;
+ if (dataspace == ui::Dataspace::UNKNOWN) {
const ui::ColorMode colorMode = display->getCompositionDisplay()->getState().colorMode;
dataspace = pickDataspaceFromColorMode(colorMode);
}
@@ -5580,9 +5579,8 @@
// (ex. displayP3) to enhance the content, but some cases are checking native RGB in bytes,
// and failed if display is not in native mode. This provide a way to force using native
// colors when capture.
- if (args.useRGBColorSpace) {
- dataspace = Dataspace::V0_SRGB;
- } else {
+ dataspace = args.dataspace;
+ if (dataspace == ui::Dataspace::UNKNOWN) {
const ui::ColorMode colorMode = display->getCompositionDisplay()->getState().colorMode;
dataspace = pickDataspaceFromColorMode(colorMode);
}