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

Commit 12ecd082 authored by Melody Hsu's avatar Melody Hsu
Browse files

[legacy sf flag] - setInitialValuesForClone

Removing legacy SurfaceFlinger frontend flag makes
Layer#setInitialValuesForClone a no-op. The method can be
removed and createClone can be cleaned up.

Bug: b/330785038
Test: presubmit
Change-Id: I912e5dd0e0723e5d1b5d1f0080bf23e06281dba8
parent 9af30706
Loading
Loading
Loading
Loading
+2 −16
Original line number Diff line number Diff line
@@ -2614,19 +2614,6 @@ Region Layer::getVisibleRegion(const DisplayDevice* display) const {
    return outputLayer ? outputLayer->getState().visibleRegion : Region();
}

void Layer::setInitialValuesForClone(const sp<Layer>& clonedFrom, uint32_t mirrorRootId) {
    if (mFlinger->mLayerLifecycleManagerEnabled) return;
    mSnapshot->path.id = clonedFrom->getSequence();
    mSnapshot->path.mirrorRootIds.emplace_back(mirrorRootId);

    cloneDrawingState(clonedFrom.get());
    mClonedFrom = clonedFrom;
    mPremultipliedAlpha = clonedFrom->mPremultipliedAlpha;
    mPotentialCursor = clonedFrom->mPotentialCursor;
    mProtectedByApp = clonedFrom->mProtectedByApp;
    updateCloneBufferInfo();
}

void Layer::updateCloneBufferInfo() {
    if (!isClone() || !isClonedFromAlive()) {
        return;
@@ -2726,7 +2713,7 @@ void Layer::updateClonedChildren(const sp<Layer>& mirrorRoot,
        }
        sp<Layer> clonedChild = clonedLayersMap[child];
        if (clonedChild == nullptr) {
            clonedChild = child->createClone(mirrorRoot->getSequence());
            clonedChild = child->createClone();
            clonedLayersMap[child] = clonedChild;
        }
        addChildToDrawing(clonedChild);
@@ -3696,11 +3683,10 @@ Rect Layer::computeBufferCrop(const State& s) {
    }
}

sp<Layer> Layer::createClone(uint32_t mirrorRootId) {
sp<Layer> Layer::createClone() {
    surfaceflinger::LayerCreationArgs args(mFlinger.get(), nullptr, mName + " (Mirror)", 0,
                                           LayerMetadata());
    sp<Layer> layer = mFlinger->getFactory().createBufferStateLayer(args);
    layer->setInitialValuesForClone(sp<Layer>::fromExisting(this), mirrorRootId);
    return layer;
}

+1 −2
Original line number Diff line number Diff line
@@ -250,7 +250,7 @@ public:
    // true if this layer is visible, false otherwise
    virtual bool isVisible() const;

    virtual sp<Layer> createClone(uint32_t mirrorRoot);
    virtual sp<Layer> createClone();

    // Set a 2x2 transformation matrix on the layer. This transform
    // will be applied after parent transforms, but before any final
@@ -976,7 +976,6 @@ protected:
    friend class TransactionFrameTracerTest;
    friend class TransactionSurfaceFrameTest;

    virtual void setInitialValuesForClone(const sp<Layer>& clonedFrom, uint32_t mirrorRootId);
    void preparePerFrameCompositionState();
    void preparePerFrameBufferCompositionState();
    void preparePerFrameEffectsCompositionState();
+2 −2
Original line number Diff line number Diff line
@@ -5928,7 +5928,7 @@ status_t SurfaceFlinger::mirrorLayer(const LayerCreationArgs& args,
            return result;
        }

        mirrorLayer->setClonedChild(mirrorFrom->createClone(mirrorLayer->getSequence()));
        mirrorLayer->setClonedChild(mirrorFrom->createClone());
    }

    outResult.layerId = mirrorLayer->sequence;
@@ -9183,7 +9183,7 @@ bool SurfaceFlinger::commitMirrorDisplays(VsyncId vsyncId) {
                Mutex::Autolock lock(mStateLock);
                createEffectLayer(mirrorArgs, &unused, &childMirror);
                MUTEX_ALIAS(mStateLock, childMirror->mFlinger->mStateLock);
                childMirror->setClonedChild(layer->createClone(childMirror->getSequence()));
                childMirror->setClonedChild(layer->createClone());
                childMirror->reparent(mirrorDisplay.rootHandle);
            }
            // lock on mStateLock needs to be released before binder handle gets destroyed
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public:
    MOCK_CONST_METHOD0(getType, const char*());
    MOCK_METHOD0(getFrameSelectionPriority, int32_t());
    MOCK_CONST_METHOD0(isVisible, bool());
    MOCK_METHOD1(createClone, sp<Layer>(uint32_t));
    MOCK_METHOD0(createClone, sp<Layer>());
    MOCK_CONST_METHOD0(getFrameRateForLayerTree, FrameRate());
    MOCK_CONST_METHOD0(getDefaultFrameRateCompatibility, scheduler::FrameRateCompatibility());
    MOCK_CONST_METHOD0(getOwnerUid, uid_t());