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

Commit 7f2ed8bb authored by Robert Carr's avatar Robert Carr
Browse files

SurfaceFlinger: Ensure reparent triggers visible region calculation.

Following the recent CL there are still more errors. First is that we may
not set the transaction flags, leading to SurfaceFlinger failing to call
doTransaction. We fix this by calling setTransactionFlags from add/removeChild.
The second problem is that if mCurrentState.modified were not true, do transaction
would return early and fail to produce eVisibleRegions. We fix this with a refactoring
in doTransaction.

Test: Manual
Bug: 123333167
Change-Id: Iccd25244b6cb38a1fd90dc5165820d1100f40f4a
parent 0e875399
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -1078,13 +1078,18 @@ uint32_t Layer::doTransaction(uint32_t flags) {
    ATRACE_CALL();

    if (mLayerDetached) {
        return 0;
        return flags;
    }

    if (mChildrenChanged) {
        flags |= eVisibleRegion;
        mChildrenChanged = false;
    }

    pushPendingState();
    State c = getCurrentState();
    if (!applyPendingStates(&c)) {
        return 0;
        return flags;
    }

    flags = doTransactionResize(flags, &c);
@@ -1106,11 +1111,6 @@ uint32_t Layer::doTransaction(uint32_t flags) {
        mNeedsFiltering = (!getActiveTransform(c).preserveRects() || type >= ui::Transform::SCALE);
    }

    if (mChildrenChanged) {
        flags |= eVisibleRegion;
        mChildrenChanged = false;
    }

    // If the layer is hidden, signal and clear out all local sync points so
    // that transactions for layers depending on this layer's frames becoming
    // visible are not blocked
@@ -1634,6 +1634,7 @@ size_t Layer::getChildrenCount() const {

void Layer::addChild(const sp<Layer>& layer) {
    mChildrenChanged = true;
    setTransactionFlags(eTransactionNeeded);

    mCurrentChildren.add(layer);
    layer->setParent(this);
@@ -1641,6 +1642,7 @@ void Layer::addChild(const sp<Layer>& layer) {

ssize_t Layer::removeChild(const sp<Layer>& layer) {
    mChildrenChanged = true;
    setTransactionFlags(eTransactionNeeded);

    layer->setParent(nullptr);
    return mCurrentChildren.remove(layer);