summaryrefslogtreecommitdiff
path: root/libs/gui/ISurfaceComposer.cpp
diff options
context:
space:
mode:
author Leon Scroggins III <scroggo@google.com> 2022-02-01 15:53:54 -0500
committer Leon Scroggins III <scroggo@google.com> 2022-02-09 15:51:13 -0500
commite7c51c66b971144cae653060c02589441cddb1ad (patch)
tree408a088695870d44b16a2942f351c022b04c0014 /libs/gui/ISurfaceComposer.cpp
parent7c60b886d46e8bf76f19c00130b9bc3d28cd2f6d (diff)
Update native getDisplayDecorationSupport API
I27f119f927b23052c5fd8f068cbca75338fe7b91 adds new HAL APIs which provide more detailed info regarding DISPLAY_DECORATION support. Call the new API and plumb it up to SurfaceComposerClient. Remove reference to old DisplayCapability.DISPLAY_DECORATION. Bug: 216644902 Test: manual Change-Id: I961051c0a660b596039ac04b546040764ee20d34
Diffstat (limited to 'libs/gui/ISurfaceComposer.cpp')
-rw-r--r--libs/gui/ISurfaceComposer.cpp42
1 files changed, 34 insertions, 8 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index fb9ed22a33..75c5e26fb0 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -42,6 +42,8 @@
// ---------------------------------------------------------------------------
+using namespace aidl::android::hardware::graphics;
+
namespace android {
using gui::IDisplayEventConnection;
@@ -1201,8 +1203,9 @@ public:
return NO_ERROR;
}
- status_t getDisplayDecorationSupport(const sp<IBinder>& displayToken,
- bool* outSupport) const override {
+ status_t getDisplayDecorationSupport(
+ const sp<IBinder>& displayToken,
+ std::optional<common::DisplayDecorationSupport>* outSupport) const override {
Parcel data, reply;
status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
if (error != NO_ERROR) {
@@ -1225,7 +1228,26 @@ public:
ALOGE("getDisplayDecorationSupport: failed to read support: %d", error);
return error;
}
- *outSupport = support;
+
+ if (support) {
+ int32_t format, alphaInterpretation;
+ error = reply.readInt32(&format);
+ if (error != NO_ERROR) {
+ ALOGE("getDisplayDecorationSupport: failed to read format: %d", error);
+ return error;
+ }
+ error = reply.readInt32(&alphaInterpretation);
+ if (error != NO_ERROR) {
+ ALOGE("getDisplayDecorationSupport: failed to read alphaInterpretation: %d", error);
+ return error;
+ }
+ outSupport->emplace();
+ outSupport->value().format = static_cast<common::PixelFormat>(format);
+ outSupport->value().alphaInterpretation =
+ static_cast<common::AlphaInterpretation>(alphaInterpretation);
+ } else {
+ outSupport->reset();
+ }
return NO_ERROR;
}
@@ -2164,14 +2186,18 @@ status_t BnSurfaceComposer::onTransact(
case GET_DISPLAY_DECORATION_SUPPORT: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
sp<IBinder> displayToken;
- status_t error = data.readNullableStrongBinder(&displayToken);
+ SAFE_PARCEL(data.readNullableStrongBinder, &displayToken);
+ std::optional<common::DisplayDecorationSupport> support;
+ auto error = getDisplayDecorationSupport(displayToken, &support);
if (error != NO_ERROR) {
- ALOGE("getDisplayDecorationSupport: failed to read display token: %d", error);
+ ALOGE("getDisplayDecorationSupport failed with error %d", error);
return error;
}
- bool support = false;
- error = getDisplayDecorationSupport(displayToken, &support);
- reply->writeBool(support);
+ reply->writeBool(support.has_value());
+ if (support) {
+ reply->writeInt32(static_cast<int32_t>(support.value().format));
+ reply->writeInt32(static_cast<int32_t>(support.value().alphaInterpretation));
+ }
return error;
}
case SET_FRAME_RATE: {