Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41071ee7 authored by Leon Scroggins's avatar Leon Scroggins Committed by Android (Google) Code Review
Browse files

Merge "Update native getDisplayDecorationSupport API"

parents 4073ef7e e7c51c66
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -339,6 +339,7 @@ cc_defaults {
        "android.hardware.graphics.bufferqueue@2.0",
        "android.hardware.graphics.common@1.1",
        "android.hardware.graphics.common@1.2",
        "android.hardware.graphics.common-V3-ndk",
        "android.hidl.token@1.0-utils",
        "libbase",
        "libcutils",
+34 −8
Original line number Diff line number Diff line
@@ -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: {
+4 −2
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@

namespace android {

using aidl::android::hardware::graphics::common::DisplayDecorationSupport;
using gui::FocusRequest;
using gui::IRegionSamplingListener;
using gui::WindowInfo;
@@ -2239,8 +2240,9 @@ status_t SurfaceComposerClient::setGlobalShadowSettings(const half4& ambientColo
                                                                          lightRadius);
}

bool SurfaceComposerClient::getDisplayDecorationSupport(const sp<IBinder>& displayToken) {
    bool support = false;
std::optional<DisplayDecorationSupport> SurfaceComposerClient::getDisplayDecorationSupport(
        const sp<IBinder>& displayToken) {
    std::optional<DisplayDecorationSupport> support;
    ComposerService::getComposerService()->getDisplayDecorationSupport(displayToken, &support);
    return support;
}
+7 −3
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@
#include <unordered_set>
#include <vector>

#include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h>

namespace android {

struct client_cache_t;
@@ -533,15 +535,17 @@ public:
     * displayToken
     *      The token of the display.
     * outSupport
     *      An output parameter for whether the display supports
     *      An output parameter for whether/how the display supports
     *      DISPLAY_DECORATION layers.
     *
     * Returns NO_ERROR upon success. Otherwise,
     *      NAME_NOT_FOUND if the display is invalid, or
     *      BAD_VALUE      if the output parameter is invalid.
     */
    virtual status_t getDisplayDecorationSupport(const sp<IBinder>& displayToken,
                                                 bool* outSupport) const = 0;
    virtual status_t getDisplayDecorationSupport(
            const sp<IBinder>& displayToken,
            std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>*
                    outSupport) const = 0;

    /*
     * Sets the intended frame rate for a surface. See ANativeWindow_setFrameRate() for more info.
+7 −3
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@
#include <gui/WindowInfosListenerReporter.h>
#include <math/vec3.h>

#include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h>

namespace android {

class HdrCapabilities;
@@ -285,14 +287,16 @@ public:
                                            float lightPosY, float lightPosZ, float lightRadius);

    /*
     * Returns whether a display supports DISPLAY_DECORATION layers.
     * Returns whether and how a display supports DISPLAY_DECORATION layers.
     *
     * displayToken
     *      The token of the display.
     *
     * Returns whether a display supports DISPLAY_DECORATION layers.
     * Returns how a display supports DISPLAY_DECORATION layers, or nullopt if
     * it does not.
     */
    static bool getDisplayDecorationSupport(const sp<IBinder>& displayToken);
    static std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>
    getDisplayDecorationSupport(const sp<IBinder>& displayToken);

    // ------------------------------------------------------------------------
    // surface creation / destruction
Loading