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

Commit 7618b235 authored by Valerie Hau's avatar Valerie Hau
Browse files

Force send callbacks when layer is detached

Bug: 141706317
Test: build, boot, ASurfaceControlTest, SurfaceFlinger_test,
libsurfaceflinger_unittest, manual
Change-Id: Ib3566905a2e46cbbf88a1c80300744db03c3b7c7
parent 966888df
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -344,6 +344,11 @@ bool BufferStateLayer::setTransactionCompletedListeners(
    return willPresent;
}

void BufferStateLayer::forceSendCallbacks() {
    mFlinger->getTransactionCompletedThread().finalizePendingCallbackHandles(
            mCurrentState.callbackHandles);
}

bool BufferStateLayer::setTransparentRegionHint(const Region& transparent) {
    mCurrentState.transparentRegionHint = transparent;
    mCurrentState.modified = true;
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public:
    bool setApi(int32_t api) override;
    bool setSidebandStream(const sp<NativeHandle>& sidebandStream) override;
    bool setTransactionCompletedListeners(const std::vector<sp<CallbackHandle>>& handles) override;
    void forceSendCallbacks() override;

    // Override to ignore legacy layer state properties that are not used by BufferStateLayer
    bool setSize(uint32_t /*w*/, uint32_t /*h*/) override { return false; }
+1 −1
Original line number Diff line number Diff line
@@ -848,7 +848,7 @@ uint32_t Layer::doTransaction(uint32_t flags) {
        // inevitably waiting on a buffer to return. We recreate this semantic for BufferQueue
        // even though it is a little consistent. detachChildren is shortly slated for removal
        // by the hierarchy mirroring work so we don't need to worry about it too much.
        mDrawingState.callbackHandles = mCurrentState.callbackHandles;
        forceSendCallbacks();
        mCurrentState.callbackHandles = {};
        return flags;
    }
+1 −0
Original line number Diff line number Diff line
@@ -333,6 +333,7 @@ public:
            const std::vector<sp<CallbackHandle>>& /*handles*/) {
        return false;
    };
    virtual void forceSendCallbacks() {}
    virtual bool setBackgroundColor(const half3& color, float alpha, ui::Dataspace dataspace);
    virtual bool setColorSpaceAgnostic(const bool agnostic);
    bool setShadowRadius(float shadowRadius);