Conditionally expose EGL_ANDROID_get_frame_timestamps extension

Expose EGL_ANDROID_get_frame_timestamps extension
if service.sf.present_timestamp sysprop is true, and
we use ANGLE egl.

On cuttlefish we disabled service.sf.present_timestamp,
this further disables VK_GOOGLE_display_timing extension.
ANGLE's eglSurfaceAttrib(EGL_TIMESTAMPS_ANDROID) requires
both EGL_ANDROID_get_frame_timestamps and
VK_GOOGLE_display_timing extension to work:
https://chromium-review.googlesource.com/c/angle/angle/+/3753396.
Android EGL Wrapper's eglSurfaceAttrib() implementation
forwards the call to ANGLE. Therefore, we need to make ANGLE
and Android EGL Wrapper report consistent results:
only expose EGL_ANDROID_get_frame_timestamps in Android
EGL Wrapper if service.sf.present_timestamp sysprop is true.
That way we won't have Android EGL Wrapper claiming the
EGL_ANDROID_get_frame_timestamps extension
is supported first, but then the subsequent call of
eglSurfaceAttrib(EGL_TIMESTAMPS_ANDROID) to ANGLE fails.

Bug: b/269060366
Test: m;
cts-tradefed run commandAndExit cts
-m CtsDeqpTestCases --abi x86 --skip-preconditions
--skip-all-system-status-check --module-arg
'CtsDeqpTestCases:deqp-use-angle:vulkan'
--module-arg
'CtsDeqpTestCases:include-filter:dEQP-EGL.functional.get_frame_timestamps*';

Change-Id: Id96d0c749c80ba54aa1e48dba85817efab8b7eea
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
index 0b755aa..c2c856e 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -322,6 +322,16 @@
 
         mExtensionString = gBuiltinExtensionString;
 
+        // b/269060366 Conditionally enabled EGL_ANDROID_get_frame_timestamps extension if the
+        // device's present timestamps are reliable (which may not be the case on emulators).
+        if (cnx->useAngle) {
+            if (android::base::GetBoolProperty("service.sf.present_timestamp", false)) {
+                mExtensionString.append("EGL_ANDROID_get_frame_timestamps");
+            }
+        } else {
+            mExtensionString.append("EGL_ANDROID_get_frame_timestamps");
+        }
+
         hasColorSpaceSupport = findExtension(disp.queryString.extensions, "EGL_KHR_gl_colorspace");
 
         // Note: CDD requires that devices supporting wide color and/or HDR color also support
@@ -361,6 +371,7 @@
                     findExtension(disp.queryString.extensions, "EGL_KHR_image_gl_colorspace")) {
                     mExtensionString.append("EGL_EXT_image_gl_colorspace ");
                 }
+
                 if (findExtension(disp.queryString.extensions, ext.c_str(), len)) {
                     mExtensionString.append(ext + " ");
                 }