Camera: Save the HIDL instances regardless of device version
It seems the lazy Hal interface caching was inserted after the
logical camera physical device query that requires support
for HIDL version 3.5. Devices that support older HIDL interfaces
will not be cached correctly and the lazy Hal functionality will
not work as expected.
Move the interface caching just before the unrelated device version
check.
Bug: 261568606
Test: Successful build
Change-Id: I6a676e5a63272c17482f1d066b78d6d4283b2b93
diff --git a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
index fec7f05..468b644 100644
--- a/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
+++ b/services/camera/libcameraservice/common/hidl/HidlProviderInfo.cpp
@@ -692,6 +692,11 @@
mTorchStrengthLevel = 0;
+ if (!kEnableLazyHal) {
+ // Save HAL reference indefinitely
+ mSavedInterface = interface;
+ }
+
queryPhysicalCameraIds();
// Get physical camera characteristics if applicable
@@ -752,13 +757,6 @@
}
}
}
-
- if (!kEnableLazyHal) {
- // Save HAL reference indefinitely
- mSavedInterface = interface;
- }
-
-
}
status_t HidlProviderInfo::HidlDeviceInfo3::setTorchMode(bool enabled) {