Update patch for default camera id in frameworks/av
This commit is contained in:
parent
2bcc86538e
commit
43a3af91c0
|
@ -1,4 +1,4 @@
|
||||||
From f080834bc4eb8438750a89371c2cea59874ed698 Mon Sep 17 00:00:00 2001
|
From 899e3cf94287d412a5a00274749575973075cd87 Mon Sep 17 00:00:00 2001
|
||||||
From: Peter Cai <peter@typeblog.net>
|
From: Peter Cai <peter@typeblog.net>
|
||||||
Date: Wed, 1 Jun 2022 16:56:46 -0400
|
Date: Wed, 1 Jun 2022 16:56:46 -0400
|
||||||
Subject: [PATCH 2/2] camera: Implement property to override default camera
|
Subject: [PATCH 2/2] camera: Implement property to override default camera
|
||||||
|
@ -7,11 +7,11 @@ Complement to the frameworks/base patch.
|
||||||
|
|
||||||
Change-Id: I002bfa974bafc2cc01365eeea31c7a5dcb5a2028
|
Change-Id: I002bfa974bafc2cc01365eeea31c7a5dcb5a2028
|
||||||
---
|
---
|
||||||
.../common/CameraProviderManager.cpp | 13 +++++++++++++
|
.../common/CameraProviderManager.cpp | 22 +++++++++++++++++++
|
||||||
1 file changed, 13 insertions(+)
|
1 file changed, 22 insertions(+)
|
||||||
|
|
||||||
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||||
index 2f74df9770..5b7166d4c0 100644
|
index 2f74df9770..d1326b6047 100644
|
||||||
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||||
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||||
@@ -33,6 +33,7 @@
|
@@ -33,6 +33,7 @@
|
||||||
|
@ -22,7 +22,23 @@ index 2f74df9770..5b7166d4c0 100644
|
||||||
#include <android-base/logging.h>
|
#include <android-base/logging.h>
|
||||||
#include <cutils/properties.h>
|
#include <cutils/properties.h>
|
||||||
#include <hwbinder/IPCThreadState.h>
|
#include <hwbinder/IPCThreadState.h>
|
||||||
@@ -208,6 +209,18 @@ std::vector<std::string> CameraProviderManager::getAPI1CompatibleCameraDeviceIds
|
@@ -142,6 +143,15 @@ std::vector<std::string> CameraProviderManager::getCameraDeviceIds() const {
|
||||||
|
deviceIds.push_back(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ int32_t altPrimaryCamera = property_get_int32("persist.sys.alt_primary_camera", 0);
|
||||||
|
+
|
||||||
|
+ if (altPrimaryCamera != 0 && deviceIds.size() > (size_t) altPrimaryCamera) {
|
||||||
|
+ const std::string origPrimary = deviceIds[0];
|
||||||
|
+ deviceIds[0] = deviceIds[altPrimaryCamera];
|
||||||
|
+ deviceIds[altPrimaryCamera] = origPrimary;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return deviceIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -208,6 +218,18 @@ std::vector<std::string> CameraProviderManager::getAPI1CompatibleCameraDeviceIds
|
||||||
std::sort(systemDeviceIds.begin(), systemDeviceIds.end(), sortFunc);
|
std::sort(systemDeviceIds.begin(), systemDeviceIds.end(), sortFunc);
|
||||||
deviceIds.insert(deviceIds.end(), publicDeviceIds.begin(), publicDeviceIds.end());
|
deviceIds.insert(deviceIds.end(), publicDeviceIds.begin(), publicDeviceIds.end());
|
||||||
deviceIds.insert(deviceIds.end(), systemDeviceIds.begin(), systemDeviceIds.end());
|
deviceIds.insert(deviceIds.end(), systemDeviceIds.begin(), systemDeviceIds.end());
|
||||||
|
|
Loading…
Reference in a new issue