Skip to content

Commit

Permalink
libcameraservice: HAX for depth sensor on ginkgo [2/2]
Browse files Browse the repository at this point in the history
 * miui camera uses logical id 61 as depth sensor on portrait mode
   but oss libcam maps it to physical id 2 which is wrong, our physical
   id of depth sensor is 20 so we must hack it this way

[ghostrider-reborn 2021-10-26]
 * updated for android 12

Change-Id: I57388d0e00fc21b99427e0c0b1ff9a39926b2243
Signed-off-by: Adithya R <[email protected]>
Signed-off-by: Joey Huab <[email protected]>
  • Loading branch information
adithya2306 authored and Claymore1297 committed Mar 16, 2022
1 parent 30fa442 commit 6281b79
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions services/camera/libcameraservice/device3/Camera3Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,20 @@ status_t Camera3Device::initialize(sp<CameraProviderManager> manager, const Stri
// Do not override characteristics for physical cameras
res = manager->getCameraCharacteristics(
physicalId, /*overrideForPerfClass*/false, &mPhysicalDeviceInfoMap[physicalId]);
// HACK for ginkgo - check camera id 20 for depth sensor
if (res != OK) {
SET_ERR_L("Could not retrieve camera %s characteristics: %s (%d)",
CLOGW("Could not retrieve camera %s characteristics: %s (%d)",
physicalId.c_str(), strerror(-res), res);
session->close();
return res;
physicalId = std::to_string(20); // TODO: Maybe make this a soong config?
CLOGW("Trying physical camera %s if available", physicalId.c_str());
res = manager->getCameraCharacteristics(
physicalId, false, &mPhysicalDeviceInfoMap[physicalId]);
if (res != OK) {
SET_ERR_L("Could not retrieve camera %s characteristics: %s (%d)",
physicalId.c_str(), strerror(-res), res);
session->close();
return res;
}
}

bool usePrecorrectArray =
Expand Down

0 comments on commit 6281b79

Please sign in to comment.