Skip to content

Instantly share code, notes, and snippets.

@phhusson
Created May 14, 2020 17:36
Show Gist options
  • Save phhusson/b22e607e57455ff406290d6f71a8cdbe to your computer and use it in GitHub Desktop.
Save phhusson/b22e607e57455ff406290d6f71a8cdbe to your computer and use it in GitHub Desktop.
diff --git a/services/camera/libcameraservice/Android.bp b/services/camera/libcameraservice/Android.bp
index 1c1f5e6e45..6672163fca 100644
--- a/services/camera/libcameraservice/Android.bp
+++ b/services/camera/libcameraservice/Android.bp
@@ -107,6 +107,7 @@ cc_library_shared {
"[email protected]",
"[email protected]",
"[email protected]",
+ "[email protected]",
],
export_shared_lib_headers: [
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
index fdb5657500..6cd368ee5d 100644
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
@@ -21,6 +21,7 @@
#include "CameraProviderManager.h"
#include <android/hardware/camera/device/3.5/ICameraDevice.h>
+#include <vendor/samsung/hardware/camera/provider/3.0/ISehCameraProvider.h>
#include <algorithm>
#include <chrono>
@@ -1225,6 +1226,9 @@ status_t CameraProviderManager::ProviderInfo::initialize(
mMinorVersion = 4;
}
+ auto samsungCast = vendor::samsung::hardware::camera::provider::V3_0::ISehCameraProvider::castFrom(interface);
+ auto samsungProvider = samsungCast.isOk() ? static_cast<sp<vendor::samsung::hardware::camera::provider::V3_0::ISehCameraProvider>>(samsungCast) : nullptr;
+
// cameraDeviceStatusChange callbacks may be called (and causing new devices added)
// before setCallback returns
hardware::Return<Status> status = interface->setCallback(this);
@@ -1269,7 +1273,7 @@ status_t CameraProviderManager::ProviderInfo::initialize(
// Get initial list of camera devices, if any
std::vector<std::string> devices;
- hardware::Return<void> ret = interface->getCameraIdList([&status, this, &devices](
+ auto cb = [&status, this, &devices](
Status idStatus,
const hardware::hidl_vec<hardware::hidl_string>& cameraDeviceNames) {
status = idStatus;
@@ -1286,7 +1290,12 @@ status_t CameraProviderManager::ProviderInfo::initialize(
mProviderPublicCameraIds.push_back(id);
}
}
- } });
+ } };
+ hardware::Return<void> ret;
+ if(samsungProvider != nullptr)
+ ret = samsungProvider->sehGetCameraIdList(cb);
+ else
+ ret = interface->getCameraIdList(cb);
if (!ret.isOk()) {
ALOGE("%s: Transaction error in getting camera ID list from provider '%s': %s",
__FUNCTION__, mProviderName.c_str(), linked.description().c_str());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment