Skip to content

Commit

Permalink
exynos9820-common: cameraprovider: disable 3rd front cam on beyondx
Browse files Browse the repository at this point in the history
* This breaks snap front cam and is not present in hardware anyways
* Also merge samsung_camera.h into SamsungCameraProvider.h,
  we can't overlay this header anyways

Change-Id: I2681fbdbab88c02a3cd38b5d76beac91635ff05a
  • Loading branch information
Linux4 committed Jul 20, 2021
1 parent 3b89cec commit 72b7eda
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 28 deletions.
7 changes: 7 additions & 0 deletions BoardConfigPlatform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := $(PLATFORM_PATH)/hardware/bluetoo
BOARD_CUSTOM_BT_CONFIG := $(PLATFORM_PATH)/hardware/bluetooth/libbt_vndcfg.txt
BOARD_HAVE_BLUETOOTH_BCM := true

### CAMERA
SOONG_CONFIG_NAMESPACES += exynos9820CameraVars
SOONG_CONFIG_exynos9820CameraVars += \
exynos9820_model

SOONG_CONFIG_exynos9820CameraVars_exynos9820_model := $(TARGET_DEVICE)

### HIDL
DEVICE_MANIFEST_FILE += $(PLATFORM_PATH)/manifest.xml
DEVICE_MATRIX_FILE := $(PLATFORM_PATH)/compatibility_matrix.xml
Expand Down
22 changes: 21 additions & 1 deletion hardware/interfaces/camera/provider/Android.bp
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
soong_config_module_type {
name: "exynos9820_model",
module_type: "cc_defaults",
config_namespace: "exynos9820CameraVars",
value_variables: ["exynos9820_model"],
properties: ["cppflags"],
}

exynos9820_model {
name: "exynos9820_model_defaults",
soong_config_variables: {
exynos9820_model: {
cppflags: ["-DEXYNOS9820_MODEL_%s"],
},
},
}

cc_defaults {
name: "samsung_camera_service_2_5_defaults",
defaults: ["hidl_defaults"],
defaults: [
"hidl_defaults",
"exynos9820_model_defaults",
],
proprietary: true,
relative_install_path: "hw",
srcs: [
Expand Down
25 changes: 24 additions & 1 deletion hardware/interfaces/camera/provider/SamsungCameraProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@
#define LOG_TAG "SamsungCameraProvider@2.5"

#include "SamsungCameraProvider.h"
#include "samsung_camera.h"

#include <algorithm>

using ::android::NO_ERROR;
using ::android::OK;

using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;

const int kMaxCameraIdLen = 16;

SamsungCameraProvider::SamsungCameraProvider() : LegacyCameraProviderImpl_2_5() {
Expand Down Expand Up @@ -58,4 +61,24 @@ SamsungCameraProvider::SamsungCameraProvider() : LegacyCameraProviderImpl_2_5()
}
}

Return<void> SamsungCameraProvider::getCameraIdList(
ICameraProvider::getCameraIdList_cb _hidl_cb) {
std::vector<hidl_string> deviceNameList;
for (auto const& deviceNamePair : mCameraDeviceNames) {
int id = std::stoi(deviceNamePair.first);
if (id >= mNumberOfLegacyCameras || std::find(mDisabledIDs.begin(), mDisabledIDs.end(), id) != mDisabledIDs.end()) {
// External camera devices must be reported through the device status change callback,
// not in this list.
// Linux4: Also skip disabled camera IDs.
continue;
}
if (mCameraStatusMap[deviceNamePair.first] == CAMERA_DEVICE_STATUS_PRESENT) {
deviceNameList.push_back(deviceNamePair.second);
}
}
hidl_vec<hidl_string> hidlDeviceNameList(deviceNameList);
_hidl_cb(::android::hardware::camera::common::V1_0::Status::OK, hidlDeviceNameList);
return Void();
}

SamsungCameraProvider::~SamsungCameraProvider() {}
13 changes: 13 additions & 0 deletions hardware/interfaces/camera/provider/SamsungCameraProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,25 @@

#include "LegacyCameraProviderImpl_2_5.h"

#define SAMSUNG_CAMERA_DEBUG

using ::android::hardware::camera::provider::V2_5::ICameraProvider;
using ::android::hardware::camera::provider::V2_5::implementation::LegacyCameraProviderImpl_2_5;
using ::android::hardware::Return;

class SamsungCameraProvider : public LegacyCameraProviderImpl_2_5 {
public:
SamsungCameraProvider();
~SamsungCameraProvider();

Return<void> getCameraIdList(ICameraProvider::getCameraIdList_cb _hidl_cb);
private:
std::vector<int> mExtraIDs = { -1, 50, 52, 54, 56, 58 };
#ifdef EXYNOS9820_MODEL_beyondx
std::vector<int> mDisabledIDs = { 5 };
#else
std::vector<int> mDisabledIDs = { };
#endif
};

#endif // SAMSUNG_CAMERA_PROVIDER_H
26 changes: 0 additions & 26 deletions hardware/interfaces/camera/provider/samsung_camera.h

This file was deleted.

0 comments on commit 72b7eda

Please sign in to comment.