SF: enable device-specific dataspace for color space agnostic surfaces

To reduce the DPU loading in color conversion, we enable device-specific
dataspace for color space agnostic surfaces. Since the type of surfaces
usually provide gray-level surfaces to users, it can be acceptable to
ignore the color conversion on them.

Bug: 134783740
Bug: 135140940
Test: Check ScreenDecorOverlays in expected dataspace
Test: Play HDR video on B1 and C2 and check dataspace
Change-Id: I7b11e11d2015eb5c8dfdc372e2c7ffcb40a2ac1d
diff --git a/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop b/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop
index decabd5..f18f33c 100644
--- a/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop
+++ b/services/surfaceflinger/sysprop/SurfaceFlingerProperties.sysprop
@@ -251,6 +251,20 @@
     prop_name: "ro.surface_flinger.wcg_composition_pixel_format"
 }
 
+# colorSpaceAgnosticDataspace specifies the data space that
+# SurfaceFlinger expects for surfaces which are color space agnostic.
+# The variable works only when useColorManagement is specified. If
+# unspecified, the data space follows what SurfaceFlinger expects for
+# surfaces when useColorManagement is specified.
+
+prop {
+    api_name: "color_space_agnostic_dataspace"
+    type: Long
+    scope: System
+    access: Readonly
+    prop_name: "ro.surface_flinger.color_space_agnostic_dataspace"
+}
+
 # Return the native panel primary data. The data includes red, green,
 # blue and white. The primary format is CIE 1931 XYZ color space.
 # If unspecified, the primaries is sRGB gamut by default.
diff --git a/services/surfaceflinger/sysprop/api/system-current.txt b/services/surfaceflinger/sysprop/api/system-current.txt
index 6ae3ac1..89323c2 100644
--- a/services/surfaceflinger/sysprop/api/system-current.txt
+++ b/services/surfaceflinger/sysprop/api/system-current.txt
@@ -2,6 +2,7 @@
 package android.sysprop {
 
   public final class SurfaceFlingerProperties {
+    method public static java.util.Optional<java.lang.Long> color_space_agnostic_dataspace();
     method public static java.util.Optional<java.lang.Long> default_composition_dataspace();
     method public static java.util.Optional<java.lang.Integer> default_composition_pixel_format();
     method public static java.util.List<java.lang.Double> display_primary_blue();