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

Commit 3f335768 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "Revert "Make IEffect command more robust""

parents e90a530a 320bd569
Loading
Loading
Loading
Loading
+7 −18
Original line number Diff line number Diff line
@@ -85,15 +85,13 @@ public:
        data.writeInt32(size);

        status_t status = remote()->transact(COMMAND, data, &reply);
        if (status == NO_ERROR) {
            status = reply.readInt32();
        }
        if (status != NO_ERROR) {
            if (pReplySize != NULL)
                *pReplySize = 0;
            return status;
        }

        status = reply.readInt32();
        size = reply.readInt32();
        if (size != 0 && pReplyData != NULL && pReplySize != NULL) {
            reply.read(pReplyData, size);
@@ -157,9 +155,6 @@ status_t BnEffect::onTransact(
            char *cmd = NULL;
            if (cmdSize) {
                cmd = (char *)calloc(cmdSize, 1);
                if (cmd == NULL) { // fail the transaction
                    return NO_MEMORY;
                }
                data.read(cmd, cmdSize);
            }
            uint32_t replySize = data.readInt32();
@@ -167,14 +162,9 @@ status_t BnEffect::onTransact(
            char *resp = NULL;
            if (replySize) {
                resp = (char *)calloc(replySize, 1);
                if (resp == NULL) {
                    free(cmd);
                    return NO_MEMORY;
                }
            }
            status_t status = command(cmdCode, cmdSize, cmd, &replySz, resp);
            reply->writeInt32(status);
            if (status == NO_ERROR) {
            if (replySz < replySize) {
                replySize = replySz;
            }
@@ -182,7 +172,6 @@ status_t BnEffect::onTransact(
            if (replySize) {
                reply->write(resp, replySize);
            }
            }
            if (cmd) {
                free(cmd);
            }