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

Commit e7d92288 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Android (Google) Code Review
Browse files

Merge "Add synchronous transaction to wait for setInputWindow to complete (4/n)"

parents 7e32c880 95ef3c43
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -2952,6 +2952,10 @@ void SurfaceFlinger::updateInputFlinger() {
    if (mVisibleRegionsDirty || mInputInfoChanged) {
        mInputInfoChanged = false;
        updateInputWindowInfo();
    } else if (mInputWindowCommands.syncInputWindows) {
        // If the caller requested to sync input windows, but there are no
        // changes to input windows, notify immediately.
        setInputWindowsFinished();
    }

    executeInputWindowCommands();
@@ -3681,13 +3685,16 @@ void SurfaceFlinger::applyTransactionState(const Vector<ComposerState>& states,
        if (flags & eAnimation) {
            mAnimTransactionPending = true;
        }
        while (mTransactionPending) {

        mPendingSyncInputWindows = mPendingInputWindowCommands.syncInputWindows;
        while (mTransactionPending || mPendingSyncInputWindows) {
            status_t err = mTransactionCV.waitRelative(mStateLock, s2ns(5));
            if (CC_UNLIKELY(err != NO_ERROR)) {
                // just in case something goes wrong in SF, return to the
                // called after a few seconds.
                ALOGW_IF(err == TIMED_OUT, "setTransactionState timed out!");
                mTransactionPending = false;
                mPendingSyncInputWindows = false;
                break;
            }
        }
@@ -5657,7 +5664,12 @@ status_t SurfaceFlinger::captureScreenImplLocked(const RenderArea& renderArea,
    return NO_ERROR;
}

void SurfaceFlinger::setInputWindowsFinished() {}
void SurfaceFlinger::setInputWindowsFinished() {
    Mutex::Autolock _l(mStateLock);

    mPendingSyncInputWindows = false;
    mTransactionCV.broadcast();
}

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

+1 −0
Original line number Diff line number Diff line
@@ -1125,6 +1125,7 @@ private:
    ui::DisplayPrimaries mInternalDisplayPrimaries;

    sp<SetInputWindowsListener> mSetInputWindowsListener;
    bool mPendingSyncInputWindows GUARDED_BY(mStateLock);
};
}; // namespace android