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

Commit a911b104 authored by chaviw's avatar chaviw
Browse files

Add synchronous transaction to wait for setInputWindow to complete (2/n)

Added InputWindowCommand syncInputWindows

This will allow the client to request SF to wait until setInputWindow
has completed on the InputDispatcher side.

Bug: 123041491
Test: Builds, no execution yet
Change-Id: Ibb5539455d20e4d612696ae7164ce84130bf91b4
parent 5f21a5e4
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -414,10 +414,13 @@ void InputWindowCommands::merge(const InputWindowCommands& other) {
            .insert(transferTouchFocusCommands.end(),
                    std::make_move_iterator(other.transferTouchFocusCommands.begin()),
                    std::make_move_iterator(other.transferTouchFocusCommands.end()));

    syncInputWindows |= other.syncInputWindows;
}

void InputWindowCommands::clear() {
    transferTouchFocusCommands.clear();
    syncInputWindows = false;
}

void InputWindowCommands::write(Parcel& output) const {
@@ -426,6 +429,8 @@ void InputWindowCommands::write(Parcel& output) const {
        output.writeStrongBinder(transferTouchFocusCommand.fromToken);
        output.writeStrongBinder(transferTouchFocusCommand.toToken);
    }

    output.writeBool(syncInputWindows);
}

void InputWindowCommands::read(const Parcel& input) {
@@ -437,6 +442,8 @@ void InputWindowCommands::read(const Parcel& input) {
        transferTouchFocusCommand.toToken = input.readStrongBinder();
        transferTouchFocusCommands.emplace_back(transferTouchFocusCommand);
    }

    syncInputWindows = input.readBool();
}

}; // namespace android
+5 −0
Original line number Diff line number Diff line
@@ -1083,6 +1083,11 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::transfer
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::syncInputWindows() {
    mInputWindowCommands.syncInputWindows = true;
    return *this;
}

#endif

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setColorTransform(
+1 −0
Original line number Diff line number Diff line
@@ -254,6 +254,7 @@ struct InputWindowCommands {
    };

    std::vector<TransferTouchFocusCommand> transferTouchFocusCommands;
    bool syncInputWindows;

    void merge(const InputWindowCommands& other);
    void clear();
+1 −0
Original line number Diff line number Diff line
@@ -378,6 +378,7 @@ public:
#ifndef NO_INPUT
        Transaction& setInputWindowInfo(const sp<SurfaceControl>& sc, const InputWindowInfo& info);
        Transaction& transferTouchFocus(const sp<IBinder>& fromToken, const sp<IBinder>& toToken);
        Transaction& syncInputWindows();
#endif

        // Set a color transform matrix on the given layer on the built-in display.
+4 −0
Original line number Diff line number Diff line
@@ -4180,6 +4180,10 @@ uint32_t SurfaceFlinger::addInputWindowCommands(const InputWindowCommands& input
        flags |= eTraversalNeeded;
    }

    if (inputWindowCommands.syncInputWindows) {
        flags |= eTraversalNeeded;
    }

    mPendingInputWindowCommands.merge(inputWindowCommands);
    return flags;
}