Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions services/camera/libcameraservice/CameraService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <android-base/parseint.h>
#include <android_companion_virtualdevice_flags.h>
#include <android/companion/virtualnative/IVirtualDeviceManagerNative.h>
#include <android-base/properties.h>
#include <binder/ActivityManager.h>
#include <binder/AppOpsManager.h>
#include <binder/IPCThreadState.h>
Expand Down Expand Up @@ -120,6 +121,7 @@ namespace android {
using namespace camera3;
using namespace camera3::SessionConfigurationUtils;

using base::SetProperty;
using binder::Status;
using companion::virtualnative::IVirtualDeviceManagerNative;
using frameworks::cameraservice::service::V2_0::implementation::HidlCameraService;
Expand Down Expand Up @@ -4386,6 +4388,15 @@ status_t CameraService::BasicClient::startCameraOps() {

mOpsActive = true;

// Configure miui camera mode
if (strcmp(mClientPackageName.c_str(), "com.android.camera") == 0) {
SetProperty("sys.camera.miui.apk", "1");
ALOGI("Enabling miui camera mode");
} else {
SetProperty("sys.camera.miui.apk", "0");
ALOGI("Disabling miui camera mode");
}

// Transition device availability listeners from PRESENT -> NOT_AVAILABLE
sCameraService->updateStatus(StatusInternal::NOT_AVAILABLE, mCameraIdStr);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#define CLOGE(fmt, ...) ALOGE("Camera %s: %s: " fmt, mId.c_str(), __FUNCTION__, \
##__VA_ARGS__)

#define CLOGW(fmt, ...) ALOGW("Camera %s: %s: " fmt, mId.c_str(), __FUNCTION__, \
##__VA_ARGS__)

// Convenience macros for transitioning to the error state
#define SET_ERR(fmt, ...) setErrorState( \
"%s: " fmt, __FUNCTION__, \
Expand Down Expand Up @@ -184,10 +187,19 @@ status_t HidlCamera3Device::initialize(sp<CameraProviderManager> manager,
physicalId, /*overrideForPerfClass*/false, &mPhysicalDeviceInfoMap[physicalId],
hardware::ICameraService::ROTATION_OVERRIDE_NONE);
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;
// HACK for ginkgo - check camera id 20 for depth sensor
physicalId = "20";
CLOGW("Trying physical camera %s if available", physicalId.c_str());
res = manager->getCameraCharacteristics(
physicalId, false, &mPhysicalDeviceInfoMap[physicalId], true);
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