Camera service: Switch to HIDL by default, add prop to disable
On camera service startup, use the HIDL provider codepath unless the
system property "camera.disable_treble" is set to true.
The system property is needed until the HALv1 implementation is
complete and the emulator can switch over, as well as for devices not
yet tested in passthrough mode.
Whether passthrough or separate-process HAL is used depends on the
services and libraries available on each device.
Test: Camera CTS on angler, bullhead, sailfish, ryu. HFR performance
test on sailfish. Basic operation of camera app.
Bug: 32991422
Change-Id: I3dd580cbcddd0df2e6b1e422920aa84270286e0a
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index f439590..f708654 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -18,12 +18,6 @@
#define ATRACE_TAG ATRACE_TAG_CAMERA
//#define LOG_NDEBUG 0
-#ifdef ENABLE_TREBLE
- #define USE_HIDL true
-#else
- #define USE_HIDL false
-#endif
-
#include <algorithm>
#include <climits>
#include <stdio.h>
@@ -197,10 +191,13 @@
notifier.noteResetFlashlight();
status_t res = INVALID_OPERATION;
- if (USE_HIDL) {
- res = enumerateProviders();
- } else {
+
+ bool disableTreble = property_get_bool("camera.disable_treble", false);
+ if (disableTreble) {
+ ALOGI("Treble disabled - using legacy path");
res = loadLegacyHalModule();
+ } else {
+ res = enumerateProviders();
}
if (res == OK) {
mInitialized = true;