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

Commit 6bb31e5d authored by Vishnu Nair's avatar Vishnu Nair Committed by Automerger Merge Worker
Browse files

Merge "SF: Fix duplicate callbacks from mirrored layers" into sc-v2-dev am:...

Merge "SF: Fix duplicate callbacks from mirrored layers" into sc-v2-dev am: f2cf7639 am: a1fd5044

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/16358662

Change-Id: I7e0001d176358f8c21ad54ee0fed10d8fa272aa5
parents 772b3277 a1fd5044
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -796,7 +796,7 @@ void BufferLayer::updateCloneBufferInfo() {
    wp<Layer> tmpTouchableRegionCrop = mDrawingState.touchableRegionCrop;
    WindowInfo tmpInputInfo = mDrawingState.inputInfo;

    mDrawingState = clonedFrom->mDrawingState;
    cloneDrawingState(clonedFrom.get());

    mDrawingState.touchableRegionCrop = tmpTouchableRegionCrop;
    mDrawingState.zOrderRelativeOf = tmpZOrderRelativeOf;
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ BufferStateLayer::~BufferStateLayer() {
    // one of the layers, in this case the original layer, needs to handle the deletion. The
    // original layer and the clone should be removed at the same time so there shouldn't be any
    // issue with the clone layer trying to use the texture.
    if (mBufferInfo.mBuffer != nullptr && !isClone()) {
    if (mBufferInfo.mBuffer != nullptr) {
        callReleaseBufferCallback(mDrawingState.releaseBufferListener,
                                  mBufferInfo.mBuffer->getBuffer(), mBufferInfo.mFrameNumber,
                                  mBufferInfo.mFence,
+9 −3
Original line number Diff line number Diff line
@@ -2416,8 +2416,7 @@ Region Layer::getVisibleRegion(const DisplayDevice* display) const {
}

void Layer::setInitialValuesForClone(const sp<Layer>& clonedFrom) {
    // copy drawing state from cloned layer
    mDrawingState = clonedFrom->mDrawingState;
    cloneDrawingState(clonedFrom.get());
    mClonedFrom = clonedFrom;
}

@@ -2452,7 +2451,7 @@ void Layer::updateClonedDrawingState(std::map<sp<Layer>, sp<Layer>>& clonedLayer
    // since we may be able to pull out other children that are still alive.
    if (isClonedFromAlive()) {
        sp<Layer> clonedFrom = getClonedFrom();
        mDrawingState = clonedFrom->mDrawingState;
        cloneDrawingState(clonedFrom.get());
        clonedLayersMap.emplace(clonedFrom, this);
    }

@@ -2615,6 +2614,13 @@ bool Layer::setDropInputMode(gui::DropInputMode mode) {
    return true;
}

void Layer::cloneDrawingState(const Layer* from) {
    mDrawingState = from->mDrawingState;
    // Skip callback info since they are not applicable for cloned layers.
    mDrawingState.releaseBufferListener = nullptr;
    mDrawingState.callbackHandles = {};
}

// ---------------------------------------------------------------------------

std::ostream& operator<<(std::ostream& stream, const Layer::FrameRate& rate) {
+1 −0
Original line number Diff line number Diff line
@@ -922,6 +922,7 @@ protected:
    bool isClone() { return mClonedFrom != nullptr; }
    bool isClonedFromAlive() { return getClonedFrom() != nullptr; }

    void cloneDrawingState(const Layer* from);
    void updateClonedDrawingState(std::map<sp<Layer>, sp<Layer>>& clonedLayersMap);
    void updateClonedChildren(const sp<Layer>& mirrorRoot,
                              std::map<sp<Layer>, sp<Layer>>& clonedLayersMap);