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

Commit 68026219 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5282916 from 6dbc3f6c to qt-release

Change-Id: I9d82cdcd60a6857aa1f977b2df0484a79956c544
parents 5454ff72 6dbc3f6c
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
@@ -599,17 +599,53 @@ bool Parcel::hasFileDescriptors() const
    return mHasFds;
}

void Parcel::updateWorkSourceRequestHeaderPosition() const {
    // Only update the request headers once. We only want to point
    // to the first headers read/written.
    if (!mRequestHeaderPresent) {
        mWorkSourceRequestHeaderPosition = dataPosition();
        mRequestHeaderPresent = true;
    }
}

// Write RPC headers.  (previously just the interface token)
status_t Parcel::writeInterfaceToken(const String16& interface)
{
    const IPCThreadState* threadState = IPCThreadState::self();
    writeInt32(threadState->getStrictModePolicy() | STRICT_MODE_PENALTY_GATHER);
    updateWorkSourceRequestHeaderPosition();
    writeInt32(threadState->shouldPropagateWorkSource() ?
            threadState->getCallingWorkSourceUid() : IPCThreadState::kUnsetWorkSource);
    // currently the interface identification token is just its name as a string
    return writeString16(interface);
}

bool Parcel::replaceCallingWorkSourceUid(uid_t uid)
{
    if (!mRequestHeaderPresent) {
        return false;
    }

    const size_t initialPosition = dataPosition();
    setDataPosition(mWorkSourceRequestHeaderPosition);
    status_t err = writeInt32(uid);
    setDataPosition(initialPosition);
    return err == NO_ERROR;
}

uid_t Parcel::readCallingWorkSourceUid()
{
    if (!mRequestHeaderPresent) {
        return IPCThreadState::kUnsetWorkSource;
    }

    const size_t initialPosition = dataPosition();
    setDataPosition(mWorkSourceRequestHeaderPosition);
    uid_t uid = readInt32();
    setDataPosition(initialPosition);
    return uid;
}

bool Parcel::checkInterface(IBinder* binder) const
{
    return enforceInterface(binder->getInterfaceDescriptor());
@@ -634,6 +670,7 @@ bool Parcel::enforceInterface(const String16& interface,
      threadState->setStrictModePolicy(strictPolicy);
    }
    // WorkSource.
    updateWorkSourceRequestHeaderPosition();
    int32_t workSource = readInt32();
    threadState->setCallingWorkSourceUidWithoutPropagation(workSource);
    // Interface descriptor.
@@ -2889,6 +2926,8 @@ void Parcel::initState()
    mAllowFds = true;
    mOwner = nullptr;
    mOpenAshmemSize = 0;
    mWorkSourceRequestHeaderPosition = 0;
    mRequestHeaderPresent = false;

    // racing multiple init leads only to multiple identical write
    if (gMaxFds == 0) {
+10 −0
Original line number Diff line number Diff line
@@ -395,6 +395,12 @@ public:
    static size_t       getGlobalAllocSize();
    static size_t       getGlobalAllocCount();

    bool                replaceCallingWorkSourceUid(uid_t uid);
    // Returns the work source provided by the caller. This can only be trusted for trusted calling
    // uid.
    uid_t               readCallingWorkSourceUid();
    void                readRequestHeaders() const;

private:
    typedef void        (*release_func)(Parcel* parcel,
                                        const uint8_t* data, size_t dataSize,
@@ -429,6 +435,7 @@ private:
    void                initState();
    void                scanForFds() const;
    status_t            validateReadData(size_t len) const;
    void                updateWorkSourceRequestHeaderPosition() const;
                        
    template<class T>
    status_t            readAligned(T *pArg) const;
@@ -477,6 +484,9 @@ private:
    mutable size_t      mNextObjectHint;
    mutable bool        mObjectsSorted;

    mutable bool        mRequestHeaderPresent;
    mutable size_t      mWorkSourceRequestHeaderPosition;

    mutable bool        mFdsKnown;
    mutable bool        mHasFds;
    bool                mAllowFds;
+9 −11
Original line number Diff line number Diff line
@@ -98,8 +98,8 @@ status_t layer_state_t::write(Parcel& output) const
    output.writeInt32(cachedBuffer.bufferId);
    output.writeParcelable(metadata);

    output.writeFloat(colorAlpha);
    output.writeUint32(static_cast<uint32_t>(colorDataspace));
    output.writeFloat(bgColorAlpha);
    output.writeUint32(static_cast<uint32_t>(bgColorDataspace));

    return NO_ERROR;
}
@@ -175,8 +175,8 @@ status_t layer_state_t::read(const Parcel& input)
    cachedBuffer.bufferId = input.readInt32();
    input.readParcelable(&metadata);

    colorAlpha = input.readFloat();
    colorDataspace = static_cast<ui::Dataspace>(input.readUint32());
    bgColorAlpha = input.readFloat();
    bgColorDataspace = static_cast<ui::Dataspace>(input.readUint32());

    return NO_ERROR;
}
@@ -390,13 +390,11 @@ void layer_state_t::merge(const layer_state_t& other) {
        what |= eCachedBufferChanged;
        cachedBuffer = other.cachedBuffer;
    }
    if (other.what & eColorAlphaChanged) {
        what |= eColorAlphaChanged;
        colorAlpha = other.colorAlpha;
    }
    if (other.what & eColorDataspaceChanged) {
        what |= eColorDataspaceChanged;
        colorDataspace = other.colorDataspace;
    if (other.what & eBackgroundColorChanged) {
        what |= eBackgroundColorChanged;
        color = other.color;
        bgColorAlpha = other.bgColorAlpha;
        bgColorDataspace = other.bgColorDataspace;
    }
    if (other.what & eMetadataChanged) {
        what |= eMetadataChanged;
+6 −19
Original line number Diff line number Diff line
@@ -678,31 +678,18 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setColor
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setColorAlpha(
        const sp<SurfaceControl>& sc, float alpha) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }

    s->what |= layer_state_t::eColorAlphaChanged;
    s->colorAlpha = alpha;

    registerSurfaceControlForCallback(sc);
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setColorDataspace(
        const sp<SurfaceControl>& sc, ui::Dataspace dataspace) {
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setBackgroundColor(
        const sp<SurfaceControl>& sc, const half3& color, float alpha, ui::Dataspace dataspace) {
    layer_state_t* s = getLayerState(sc);
    if (!s) {
        mStatus = BAD_INDEX;
        return *this;
    }

    s->what |= layer_state_t::eColorDataspaceChanged;
    s->colorDataspace = dataspace;
    s->what |= layer_state_t::eBackgroundColorChanged;
    s->color = color;
    s->bgColorAlpha = alpha;
    s->bgColorDataspace = dataspace;

    registerSurfaceControlForCallback(sc);
    return *this;
+9 −8
Original line number Diff line number Diff line
@@ -86,9 +86,8 @@ struct layer_state_t {
        eCornerRadiusChanged = 0x80000000,
        eFrameChanged = 0x1'00000000,
        eCachedBufferChanged = 0x2'00000000,
        eColorAlphaChanged = 0x4'00000000,
        eColorDataspaceChanged = 0x8'00000000,
        eMetadataChanged = 0x10'00000000,
        eBackgroundColorChanged = 0x4'00000000,
        eMetadataChanged = 0x8'00000000,
    };

    layer_state_t()
@@ -115,8 +114,8 @@ struct layer_state_t {
            surfaceDamageRegion(),
            api(-1),
            colorTransform(mat4()),
            colorAlpha(0),
            colorDataspace(ui::Dataspace::UNKNOWN) {
            bgColorAlpha(0),
            bgColorDataspace(ui::Dataspace::UNKNOWN) {
        matrix.dsdx = matrix.dtdy = 1.0f;
        matrix.dsdy = matrix.dtdx = 0.0f;
        hdrMetadata.validTypes = 0;
@@ -187,10 +186,12 @@ struct layer_state_t {

    cached_buffer_t cachedBuffer;

    float colorAlpha;
    ui::Dataspace colorDataspace;

    LayerMetadata metadata;

    // The following refer to the alpha, and dataspace, respectively of
    // the background color layer
    float bgColorAlpha;
    ui::Dataspace bgColorDataspace;
};

struct ComposerState {
Loading