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

Commit ecf3a150 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "ExternalCameraHAL: Check for empty native handle instead of null." into...

Merge "ExternalCameraHAL: Check for empty native handle instead of null." into main am: 7e4037cf am: b6452b7a am: a75bf4a7

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2787022



Change-Id: I8cc9bec724e89264483b8f2754af83e06e38dc0e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 51cc83a7 a75bf4a7
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -402,7 +402,10 @@ aidl::android::hardware::camera::common::Status importBufferImpl(
        buffer_handle_t buf,
        /*out*/ buffer_handle_t** outBufPtr) {
    using ::aidl::android::hardware::camera::common::Status;
    if (buf == nullptr && bufId == BUFFER_ID_NO_BUFFER) {
    // AIDL does not have null NativeHandles. It sends empty handles instead.
    // We check for when the buf is empty instead of when buf is null.
    bool isBufEmpty = buf == nullptr || (buf->numFds == 0 && buf->numInts == 0);
    if (isBufEmpty && bufId == BUFFER_ID_NO_BUFFER) {
        ALOGE("%s: bufferId %" PRIu64 " has null buffer handle!", __FUNCTION__, bufId);
        return Status::ILLEGAL_ARGUMENT;
    }