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

Commit 9d8e8aa6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "libbinder: assert freeze notification result" into main

parents 02f0983a 606039cf
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -635,14 +635,15 @@ void IPCThreadState::clearCaller()
    mCallingUid = getuid();
}

void IPCThreadState::flushCommands() {
status_t IPCThreadState::flushCommands() {
    if (mProcess->mDriverFD < 0)
        return;
        return -EBADF;

    if (status_t res = talkWithDriver(false); res != OK) {
        // TODO: we may want to abort for some of these cases
        ALOGW("1st call to talkWithDriver returned error in flushCommands: %s",
              statusToString(res).c_str());
        return res;
    }

    // The flush could have caused post-write refcount decrements to have
@@ -653,11 +654,14 @@ void IPCThreadState::flushCommands() {
            // TODO: we may want to abort for some of these cases
            ALOGW("2nd call to talkWithDriver returned error in flushCommands: %s",
                  statusToString(res).c_str());
            return res;
        }
    }
    if (mOut.dataSize() > 0) {
        ALOGW("mOut.dataSize() > 0 after flushCommands()");
    }

    return NO_ERROR;
}

bool IPCThreadState::flushIfNeeded()
@@ -1030,7 +1034,11 @@ status_t IPCThreadState::addFrozenStateChangeCallback(int32_t handle, BpBinder*
    mOut.writeInt32(BC_REQUEST_FREEZE_NOTIFICATION);
    mOut.writeInt32((int32_t)handle);
    mOut.writePointer((uintptr_t)proxy);
    flushCommands();

    if (status_t res = flushCommands(); res != OK) {
        LOG_ALWAYS_FATAL("%s(%d): %s", __func__, handle, statusToString(res).c_str());
    }

    return NO_ERROR;
}

@@ -1043,7 +1051,11 @@ status_t IPCThreadState::removeFrozenStateChangeCallback(int32_t handle, BpBinde
    mOut.writeInt32(BC_CLEAR_FREEZE_NOTIFICATION);
    mOut.writeInt32((int32_t)handle);
    mOut.writePointer((uintptr_t)proxy);
    flushCommands();

    if (status_t res = flushCommands(); res != OK) {
        LOG_ALWAYS_FATAL("%s(%d): %s", __func__, handle, statusToString(res).c_str());
    }

    return NO_ERROR;
}

+1 −1
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ public:
    // For main functions - dangerous for libraries to use
    LIBBINDER_EXPORTED status_t setupPolling(int* fd);
    LIBBINDER_EXPORTED status_t handlePolledCommands();
    LIBBINDER_EXPORTED void flushCommands();
    LIBBINDER_EXPORTED status_t flushCommands();
    LIBBINDER_EXPORTED bool flushIfNeeded();

    // Adds the current thread into the binder threadpool.