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

Commit e163dbc7 authored by Robert Carr's avatar Robert Carr
Browse files

SurfaceFlinger: Peek in current state for transform hint

Imagine a sequence like this:
1. Apply transaction to rotate display
2. Create surface
3. Transaction to rotate display processed

From a client perspective we executed 2 after 1 and would expect it
to observe the new transform hint, but it may not due so
due to the waiting for current->drawing state swap. Since we hold
the lock on the binder thread we can peek in the current state and
return the most recent hint.

Bug: 184584284
Test: Existing tests pass
Change-Id: Ic4927f517757c3c3dcfc1570e66b40ed370496de
parent a7e6c7c5
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -3267,8 +3267,12 @@ status_t SurfaceFlinger::addClientLayer(const sp<Client>& client, const sp<IBind
            }
        }

        if (const auto display = getDefaultDisplayDeviceLocked()) {
            lbc->updateTransformHint(display->getTransformHint());
        if (const auto token = getInternalDisplayTokenLocked()) {
            const ssize_t index = mCurrentState.displays.indexOfKey(token);
            if (index >= 0) {
                const DisplayDeviceState& state = mCurrentState.displays.valueAt(index);
                lbc->updateTransformHint(ui::Transform::toRotationFlags(state.orientation));
            }
        }
        if (outTransformHint) {
            *outTransformHint = lbc->getTransformHint();