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

Commit c5d36684 authored by Ganesh Mahendran's avatar Ganesh Mahendran Committed by android-build-merger
Browse files

Merge changes I0ef88864,I7b892a22 am: ed1fa850 am: 04f84605

am: 16c3afac

Change-Id: I3944aa1e903f8b15100ce106ee6ec7e1fa878614
parents bf26c166 16c3afac
Loading
Loading
Loading
Loading
+66 −68
Original line number Diff line number Diff line
@@ -571,7 +571,7 @@ status_t IPCThreadState::transact(int32_t handle,
                                  uint32_t code, const Parcel& data,
                                  Parcel* reply, uint32_t flags)
{
    status_t err = data.errorCheck();
    status_t err;

    flags |= TF_ACCEPT_FDS;

@@ -582,11 +582,9 @@ status_t IPCThreadState::transact(int32_t handle,
            << indent << data << dedent << endl;
    }

    if (err == NO_ERROR) {
    LOG_ONEWAY(">>>> SEND from pid %d uid %d %s", getpid(), getuid(),
        (flags & TF_ONE_WAY) == 0 ? "READ REPLY" : "ONE WAY");
    err = writeTransactionData(BC_TRANSACTION, flags, handle, code, data, NULL);
    }

    if (err != NO_ERROR) {
        if (reply) reply->setError(err);
@@ -720,16 +718,6 @@ 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)
{
    uint32_t cmd;
@@ -1052,25 +1040,26 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
                "Not enough command data for brTRANSACTION");
            if (result != NO_ERROR) break;

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

                buffer.ipcSetDataReference(
                    reinterpret_cast<const uint8_t*>(tr.data.ptr.buffer),
                    tr.data_size,
                    reinterpret_cast<const binder_size_t*>(tr.data.ptr.offsets),
                    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;
                mCallingUid = tr.sender_euid;
                mLastTransactionBinderFlags = tr.flags;

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

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

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

            if (result != NO_ERROR)
                break;

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

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

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