From e7c51c66b971144cae653060c02589441cddb1ad Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Tue, 1 Feb 2022 15:53:54 -0500 Subject: 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 --- libs/gui/ISurfaceComposer.cpp | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'libs/gui/ISurfaceComposer.cpp') 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& displayToken, - bool* outSupport) const override { + status_t getDisplayDecorationSupport( + const sp& displayToken, + std::optional* 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(format); + outSupport->value().alphaInterpretation = + static_cast(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 displayToken; - status_t error = data.readNullableStrongBinder(&displayToken); + SAFE_PARCEL(data.readNullableStrongBinder, &displayToken); + std::optional 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(support.value().format)); + reply->writeInt32(static_cast(support.value().alphaInterpretation)); + } return error; } case SET_FRAME_RATE: { -- cgit v1.2.3-59-g8ed1b