[SurfaceFlinger] Respect HDR data space.

Respect HDR data space when there is no legacy HDR support. Previously we only
cared about HDR data space when it is supported, however, on Pixel 2 there is
no HDR mode support. This patch makes sure that when HDR mode is not supported,
we fall back to Display P3 color mode correctly.

BUG: 80404330
Test: Build, flash and watch Youtube HDR
Change-Id: I7d27711fe4d33268e5ebbd14fce0975f9e642e84
Merged-In: I7d27711fe4d33268e5ebbd14fce0975f9e642e84
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 97edd35..cdd9c18 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1932,9 +1932,9 @@
     Dataspace hdrDataSpace;
     Dataspace bestDataSpace = getBestDataspace(displayDevice, &hdrDataSpace);
 
-    // respect hdrDataSpace only when there is modern HDR support
+    // respect hdrDataSpace only when there is no legacy HDR support
     const bool isHdr = hdrDataSpace != Dataspace::UNKNOWN &&
-        displayDevice->hasModernHdrSupport(hdrDataSpace);
+        !displayDevice->hasLegacyHdrSupport(hdrDataSpace);
     if (isHdr) {
         bestDataSpace = hdrDataSpace;
     }