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

Commit bbe8bbf8 authored by Peiyong Lin's avatar Peiyong Lin Committed by Android (Google) Code Review
Browse files

Merge "[ComposerService] Add API to query protected content support."

parents ae691837 3c2791e8
Loading
Loading
Loading
Loading
+23 −2
Original line number Diff line number Diff line
@@ -681,6 +681,18 @@ public:
        result = reply.readUint64Vector(&outStats->component_3_sample);
        return result;
    }

    virtual status_t getProtectedContentSupport(bool* outSupported) const {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        remote()->transact(BnSurfaceComposer::GET_PROTECTED_CONTENT_SUPPORT, data, &reply);
        bool result;
        status_t err = reply.readBool(&result);
        if (err == NO_ERROR) {
            *outSupported = result;
        }
        return err;
    }
};

// Out-of-line virtual method definition to trigger vtable emission in this
@@ -1017,7 +1029,7 @@ status_t BnSurfaceComposer::onTransact(
                reply->writeInt32(static_cast<int32_t>(wideColorGamutDataspace));
                reply->writeInt32(static_cast<int32_t>(wideColorGamutPixelFormat));
            }
            return NO_ERROR;
            return error;
        }
        case GET_COLOR_MANAGEMENT: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
@@ -1026,7 +1038,7 @@ status_t BnSurfaceComposer::onTransact(
            if (error == NO_ERROR) {
                reply->writeBool(result);
            }
            return result;
            return error;
        }
        case GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
@@ -1110,6 +1122,15 @@ status_t BnSurfaceComposer::onTransact(
            }
            return result;
        }
        case GET_PROTECTED_CONTENT_SUPPORT: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            bool result;
            status_t error = getProtectedContentSupport(&result);
            if (error == NO_ERROR) {
                reply->writeBool(result);
            }
            return error;
        }
        default: {
            return BBinder::onTransact(code, data, reply, flags);
        }
+7 −0
Original line number Diff line number Diff line
@@ -309,6 +309,12 @@ public:
    virtual status_t getDisplayedContentSample(const sp<IBinder>& display, uint64_t maxFrames,
                                               uint64_t timestamp,
                                               DisplayedFrameStats* outStats) const = 0;

    /*
     * Gets whether SurfaceFlinger can support protected content in GPU composition.
     * Requires the ACCESS_SURFACE_FLINGER permission.
     */
    virtual status_t getProtectedContentSupport(bool* outSupported) const = 0;
};

// ----------------------------------------------------------------------------
@@ -350,6 +356,7 @@ public:
        GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES,
        SET_DISPLAY_CONTENT_SAMPLING_ENABLED,
        GET_DISPLAYED_CONTENT_SAMPLE,
        GET_PROTECTED_CONTENT_SUPPORT,
    };

    virtual status_t onTransact(uint32_t code, const Parcel& data,
+2 −1
Original line number Diff line number Diff line
@@ -655,7 +655,8 @@ public:
        return NO_ERROR;
    }

    virtual status_t getColorManagement(bool* /*outGetColorManagement*/) const { return NO_ERROR; }
    status_t getColorManagement(bool* /*outGetColorManagement*/) const override { return NO_ERROR; }
    status_t getProtectedContentSupport(bool* /*outSupported*/) const override { return NO_ERROR; }

protected:
    IBinder* onAsBinder() override { return nullptr; }
+10 −1
Original line number Diff line number Diff line
@@ -1153,6 +1153,14 @@ status_t SurfaceFlinger::getDisplayedContentSample(const sp<IBinder>& displayTok
                                                     outStats);
}

status_t SurfaceFlinger::getProtectedContentSupport(bool* outSupported) const {
    if (!outSupported) {
        return BAD_VALUE;
    }
    *outSupported = getRenderEngine().supportsProtectedContent();
    return NO_ERROR;
}

status_t SurfaceFlinger::enableVSyncInjections(bool enable) {
    postMessageSync(new LambdaMessage([&] {
        Mutex::Autolock _l(mStateLock);
@@ -5004,7 +5012,8 @@ status_t SurfaceFlinger::CheckTransactCodeCredentials(uint32_t code) {
        case SET_TRANSACTION_STATE:
        case CREATE_CONNECTION:
        case GET_COLOR_MANAGEMENT:
        case GET_COMPOSITION_PREFERENCE: {
        case GET_COMPOSITION_PREFERENCE:
        case GET_PROTECTED_CONTENT_SUPPORT: {
            return OK;
        }
        case CAPTURE_LAYERS:
+1 −0
Original line number Diff line number Diff line
@@ -457,6 +457,7 @@ private:
    status_t getDisplayedContentSample(const sp<IBinder>& display, uint64_t maxFrames,
                                       uint64_t timestamp,
                                       DisplayedFrameStats* outStats) const override;
    status_t getProtectedContentSupport(bool* outSupported) const override;

    /* ------------------------------------------------------------------------
     * DeathRecipient interface