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

Commit ed876385 authored by Emilian Peev's avatar Emilian Peev
Browse files

camera2 vndk: Improve error handling

Check for binder status when removing the camera
service listener.
Additionally check for any invalid extended availability
callbacks.

Bug: 247615866
Test: adb shell
/data/nativetest64/vendor/ACameraNdkVendorTest/ACameraNdkVendorTest

Change-Id: Ia043934288d8c5e5584034a08de24c998468039d
parent 16575d71
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -165,7 +165,10 @@ CameraManagerGlobal::~CameraManagerGlobal() {
    Mutex::Autolock _l(mLock);
    if (mCameraService != nullptr) {
        mCameraService->unlinkToDeath(mDeathNotifier);
        mCameraService->removeListener(mCameraServiceListener);
        auto stat = mCameraService->removeListener(mCameraServiceListener);
        if (!stat.isOk()) {
            ALOGE("Failed to remove listener to camera service %s", stat.description().c_str());
        }
    }
    mDeathNotifier.clear();
    if (mCbLooper != nullptr) {
@@ -475,6 +478,10 @@ void CameraManagerGlobal::CallbackHandler::onMessageReceivedInternal(
                ALOGE("%s: Cannot find camera callback fp!", __FUNCTION__);
                return;
            }
            if (cb == nullptr) {
                // Physical camera callback is null
                return;
            }
            found = msg->findPointer(kContextKey, &context);
            if (!found) {
                ALOGE("%s: Cannot find callback context!", __FUNCTION__);