diff options
author | Speth Chang <spethchang@google.com> | 2023-08-25 07:33:38 +0000 |
---|---|---|
committer | Speth Chang <spethchang@google.com> | 2023-08-25 07:36:51 +0000 |
commit | 7fc592f1c05364882ae6b1356a148f54173eaf61 (patch) | |
tree | a0612547d6ab16369d83c0718bfd4460a5a87432 | |
parent | fac8478b0e69e5154cce9377a9f6b7a1732f68db (diff) | |
download | camera-7fc592f1c05364882ae6b1356a148f54173eaf61.tar.gz |
Fix thermal service and callback race
1. Fix lost thermal service in camera AIDL.
2. Add lock to prevent race between callback and destructor.
Bug: 291986991
Test: thermal notification
Test: CTS, GCA
Change-Id: I5431b2313993942542fefea9f522e04bd7f3457b
-rw-r--r-- | common/hal/aidl_service/aidl_camera_device_session.cc | 2 | ||||
-rw-r--r-- | common/hal/google_camera_hal/camera_device_session.cc | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/common/hal/aidl_service/aidl_camera_device_session.cc b/common/hal/aidl_service/aidl_camera_device_session.cc index 64acd2f..ed4978e 100644 --- a/common/hal/aidl_service/aidl_camera_device_session.cc +++ b/common/hal/aidl_service/aidl_camera_device_session.cc @@ -399,7 +399,7 @@ status_t AidlCameraDeviceSession::Initialize( std::string(aidl::android::hardware::thermal::IThermal::descriptor) + "/default"; if (AServiceManager_isDeclared(thermal_instance_name.c_str())) { - auto thermal_ = + thermal_ = aidl::android::hardware::thermal::IThermal::fromBinder(ndk::SpAIBinder( AServiceManager_waitForService(thermal_instance_name.c_str()))); if (!thermal_) { diff --git a/common/hal/google_camera_hal/camera_device_session.cc b/common/hal/google_camera_hal/camera_device_session.cc index 621fd6f..31b2721 100644 --- a/common/hal/google_camera_hal/camera_device_session.cc +++ b/common/hal/google_camera_hal/camera_device_session.cc @@ -640,6 +640,7 @@ void CameraDeviceSession::SetSessionCallback( } void CameraDeviceSession::NotifyThrottling(const Temperature& temperature) { + std::lock_guard lock(session_callback_lock_); switch (temperature.throttling_status) { case ThrottlingSeverity::kNone: case ThrottlingSeverity::kLight: |