Eliminate the usage of ConfigStore in native/libs/gui.
Ideally modules above SurfaceFlinger should query ConfigStore through
ISurfaceComposer APIs. Previously Surface::getWideColorSupport directly
evaluate wide color support for built-in display, we don't want that, we should
align it with SurfaceFlinger.
This patch essentially creates an API to allow other modules to query whether a
given display is a wide color display. As a result, we must enforce that wide
color display board config together with the wide color modes returned from
hardware composer.
BUG: 123312783
Test: Build, flash and boot. Verify in logcat.
Test: SurfaceFlinger_test --gtest_filter=CredentialsTest.IsWideColorDisplay\*
Change-Id: I0a5e3cc404e5365343adb0c9efaee8c13cc49cfe
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index ad2dc14..a7e51e0 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -731,6 +731,26 @@
return remote()->transact(BnSurfaceComposer::UNCACHE_BUFFER, data, &reply);
}
+
+ virtual status_t isWideColorDisplay(const sp<IBinder>& token,
+ bool* outIsWideColorDisplay) const {
+ Parcel data, reply;
+ status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
+ if (error != NO_ERROR) {
+ return error;
+ }
+ error = data.writeStrongBinder(token);
+ if (error != NO_ERROR) {
+ return error;
+ }
+
+ error = remote()->transact(BnSurfaceComposer::IS_WIDE_COLOR_DISPLAY, data, &reply);
+ if (error != NO_ERROR) {
+ return error;
+ }
+ error = reply.readBool(outIsWideColorDisplay);
+ return error;
+ }
};
// Out-of-line virtual method definition to trigger vtable emission in this
@@ -1167,6 +1187,7 @@
CHECK_INTERFACE(ISurfaceComposer, data, reply);
bool result;
status_t error = getProtectedContentSupport(&result);
+ reply->writeInt32(error);
if (error == NO_ERROR) {
reply->writeBool(result);
}
@@ -1214,6 +1235,20 @@
return uncacheBuffer(token, bufferId);
}
+ case IS_WIDE_COLOR_DISPLAY: {
+ CHECK_INTERFACE(ISurfaceComposer, data, reply);
+ sp<IBinder> display = nullptr;
+ status_t error = data.readStrongBinder(&display);
+ if (error != NO_ERROR) {
+ return error;
+ }
+ bool result;
+ error = isWideColorDisplay(display, &result);
+ if (error == NO_ERROR) {
+ reply->writeBool(result);
+ }
+ return error;
+ }
default: {
return BBinder::onTransact(code, data, reply, flags);
}