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

Commit ea0090a0 authored by Martijn Coenen's avatar Martijn Coenen
Browse files

Revert "binder: send BC_REPLY and BC_FREE_BUFFER together"

This reverts commit 0494d6ab.

Change-Id: I115dd7cd3e11bb573e17b3859133e0cad1afef49
parent 0494d6ab
Loading
Loading
Loading
Loading
+62 −62
Original line number Original line Diff line number Diff line
@@ -718,6 +718,16 @@ IPCThreadState::~IPCThreadState()
{
{
}
}


status_t IPCThreadState::sendReply(const Parcel& reply, uint32_t flags)
{
    status_t err;
    status_t statusBuffer;
    err = writeTransactionData(BC_REPLY, flags, -1, 0, reply, &statusBuffer);
    if (err < NO_ERROR) return err;

    return waitForResponse(NULL, NULL);
}

status_t IPCThreadState::waitForResponse(Parcel *reply, status_t *acquireResult)
status_t IPCThreadState::waitForResponse(Parcel *reply, status_t *acquireResult)
{
{
    uint32_t cmd;
    uint32_t cmd;
@@ -1040,26 +1050,25 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
                "Not enough command data for brTRANSACTION");
                "Not enough command data for brTRANSACTION");
            if (result != NO_ERROR) break;
            if (result != NO_ERROR) break;


            Parcel reply;
            {
            Parcel buffer;
            Parcel buffer;
                const pid_t origPid = mCallingPid;
                const uid_t origUid = mCallingUid;
                const int32_t origStrictModePolicy = mStrictModePolicy;
                const int32_t origTransactionBinderFlags = mLastTransactionBinderFlags;

            buffer.ipcSetDataReference(
            buffer.ipcSetDataReference(
                reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer),
                reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer),
                tr.data_size,
                tr.data_size,
                reinterpret_cast<const binder_size_t*>(tr.data.ptr.offsets),
                reinterpret_cast<const binder_size_t*>(tr.data.ptr.offsets),
                tr.offsets_size/sizeof(binder_size_t), freeBuffer, this);
                tr.offsets_size/sizeof(binder_size_t), freeBuffer, this);


            const pid_t origPid = mCallingPid;
            const uid_t origUid = mCallingUid;
            const int32_t origStrictModePolicy = mStrictModePolicy;
            const int32_t origTransactionBinderFlags = mLastTransactionBinderFlags;

            mCallingPid = tr.sender_pid;
            mCallingPid = tr.sender_pid;
            mCallingUid = tr.sender_euid;
            mCallingUid = tr.sender_euid;
            mLastTransactionBinderFlags = tr.flags;
            mLastTransactionBinderFlags = tr.flags;


            //ALOGI(">>>> TRANSACT from pid %d uid %d\n", mCallingPid, mCallingUid);
            //ALOGI(">>>> TRANSACT from pid %d uid %d\n", mCallingPid, mCallingUid);


            Parcel reply;
            status_t error;
            status_t error;
            IF_LOG_TRANSACTIONS() {
            IF_LOG_TRANSACTIONS() {
                TextOutput::Bundle _b(alog);
                TextOutput::Bundle _b(alog);
@@ -1094,9 +1103,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
            if ((tr.flags & TF_ONE_WAY) == 0) {
            if ((tr.flags & TF_ONE_WAY) == 0) {
                LOG_ONEWAY("Sending reply to %d!", mCallingPid);
                LOG_ONEWAY("Sending reply to %d!", mCallingPid);
                if (error < NO_ERROR) reply.setError(error);
                if (error < NO_ERROR) reply.setError(error);

                sendReply(reply, 0);
                    status_t statusBuffer;
                    result = writeTransactionData(BC_REPLY, 0, -1, 0, reply, &statusBuffer);
            } else {
            } else {
                LOG_ONEWAY("NOT sending reply to %d!", mCallingPid);
                LOG_ONEWAY("NOT sending reply to %d!", mCallingPid);
            }
            }
@@ -1105,13 +1112,6 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
            mCallingUid = origUid;
            mCallingUid = origUid;
            mStrictModePolicy = origStrictModePolicy;
            mStrictModePolicy = origStrictModePolicy;
            mLastTransactionBinderFlags = origTransactionBinderFlags;
            mLastTransactionBinderFlags = origTransactionBinderFlags;
            }

            if (result != NO_ERROR)
                break;

            if ((tr.flags & TF_ONE_WAY) == 0)
                waitForResponse(NULL, NULL);


            IF_LOG_TRANSACTIONS() {
            IF_LOG_TRANSACTIONS() {
                TextOutput::Bundle _b(alog);
                TextOutput::Bundle _b(alog);
+1 −0
Original line number Original line Diff line number Diff line
@@ -93,6 +93,7 @@ private:
                                IPCThreadState();
                                IPCThreadState();
                                ~IPCThreadState();
                                ~IPCThreadState();


            status_t            sendReply(const Parcel& reply, uint32_t flags);
            status_t            waitForResponse(Parcel *reply,
            status_t            waitForResponse(Parcel *reply,
                                                status_t *acquireResult=NULL);
                                                status_t *acquireResult=NULL);
            status_t            talkWithDriver(bool doReceive=true);
            status_t            talkWithDriver(bool doReceive=true);