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

Commit 21a3067d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix drag and drop (1/3)"

parents f93562ff 273171bd
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -75,7 +75,8 @@ public:

    virtual void setTransactionState(const Vector<ComposerState>& state,
                                     const Vector<DisplayState>& displays, uint32_t flags,
                                     const sp<IBinder>& applyToken) {
                                     const sp<IBinder>& applyToken,
                                     const InputWindowCommands& commands) {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());

@@ -91,6 +92,7 @@ public:

        data.writeUint32(flags);
        data.writeStrongBinder(applyToken);
        commands.write(data);
        remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply);
    }

@@ -750,7 +752,9 @@ status_t BnSurfaceComposer::onTransact(

            uint32_t stateFlags = data.readUint32();
            sp<IBinder> applyToken = data.readStrongBinder();
            setTransactionState(state, displays, stateFlags, applyToken);
            InputWindowCommands inputWindowCommands;
            inputWindowCommands.read(data);
            setTransactionState(state, displays, stateFlags, applyToken, inputWindowCommands);
            return NO_ERROR;
        }
        case BOOT_FINISHED: {
+32 −0
Original line number Diff line number Diff line
@@ -379,4 +379,36 @@ void layer_state_t::merge(const layer_state_t& other) {
    }
}

// ------------------------------- InputWindowCommands ----------------------------------------

void InputWindowCommands::merge(const InputWindowCommands& other) {
    transferTouchFocusCommands
            .insert(transferTouchFocusCommands.end(),
                    std::make_move_iterator(other.transferTouchFocusCommands.begin()),
                    std::make_move_iterator(other.transferTouchFocusCommands.end()));
}

void InputWindowCommands::clear() {
    transferTouchFocusCommands.clear();
}

void InputWindowCommands::write(Parcel& output) const {
    output.writeUint32(static_cast<uint32_t>(transferTouchFocusCommands.size()));
    for (const auto& transferTouchFocusCommand : transferTouchFocusCommands) {
        output.writeStrongBinder(transferTouchFocusCommand.fromToken);
        output.writeStrongBinder(transferTouchFocusCommand.toToken);
    }
}

void InputWindowCommands::read(const Parcel& input) {
    size_t count = input.readUint32();
    transferTouchFocusCommands.clear();
    for (size_t i = 0; i < count; i++) {
        TransferTouchFocusCommand transferTouchFocusCommand;
        transferTouchFocusCommand.fromToken = input.readStrongBinder();
        transferTouchFocusCommand.toToken = input.readStrongBinder();
        transferTouchFocusCommands.emplace_back(transferTouchFocusCommand);
    }
}

}; // namespace android
+15 −2
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ SurfaceComposerClient::Transaction::Transaction(const Transaction& other) :
    mEarlyWakeup(other.mEarlyWakeup) {
    mDisplayStates = other.mDisplayStates;
    mComposerStates = other.mComposerStates;
    mInputWindowCommands = other.mInputWindowCommands;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::merge(Transaction&& other) {
@@ -199,6 +200,8 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::merge(Tr
    }
    other.mListenerCallbacks.clear();

    mInputWindowCommands.merge(other.mInputWindowCommands);

    return *this;
}

@@ -265,8 +268,8 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous) {
    mEarlyWakeup = false;

    sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance());

    sf->setTransactionState(composerStates, displayStates, flags, applyToken);
    sf->setTransactionState(composerStates, displayStates, flags, applyToken, mInputWindowCommands);
    mInputWindowCommands.clear();
    mStatus = NO_ERROR;
    return NO_ERROR;
}
@@ -804,6 +807,16 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setInput
    s->what |= layer_state_t::eInputInfoChanged;
    return *this;
}

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::transferTouchFocus(
        const sp<IBinder>& fromToken, const sp<IBinder>& toToken) {
    InputWindowCommands::TransferTouchFocusCommand transferTouchFocusCommand;
    transferTouchFocusCommand.fromToken = fromToken;
    transferTouchFocusCommand.toToken = toToken;
    mInputWindowCommands.transferTouchFocusCommands.emplace_back(transferTouchFocusCommand);
    return *this;
}

#endif

SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::destroySurface(
+3 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ struct ComposerState;
struct DisplayState;
struct DisplayInfo;
struct DisplayStatInfo;
struct InputWindowCommands;
class LayerDebugInfo;
class HdrCapabilities;
class IDisplayEventConnection;
@@ -125,7 +126,8 @@ public:
    /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */
    virtual void setTransactionState(const Vector<ComposerState>& state,
                                     const Vector<DisplayState>& displays, uint32_t flags,
                                     const sp<IBinder>& applyToken) = 0;
                                     const sp<IBinder>& applyToken,
                                     const InputWindowCommands& inputWindowCommands) = 0;

    /* signal that we're done booting.
     * Requires ACCESS_SURFACE_FLINGER permission
+14 −0
Original line number Diff line number Diff line
@@ -228,6 +228,20 @@ struct DisplayState {
    status_t read(const Parcel& input);
};

struct InputWindowCommands {
    struct TransferTouchFocusCommand {
        sp<IBinder> fromToken;
        sp<IBinder> toToken;
    };

    std::vector<TransferTouchFocusCommand> transferTouchFocusCommands;

    void merge(const InputWindowCommands& other);
    void clear();
    void write(Parcel& output) const;
    void read(const Parcel& input);
};

static inline int compare_type(const ComposerState& lhs, const ComposerState& rhs) {
    if (lhs.client < rhs.client) return -1;
    if (lhs.client > rhs.client) return 1;
Loading