Add patch for default camera overriding
Useful on my Sony Xperia 5 II (KDDI), which for some reason has broken autofocus on official vendor after unlocking.
This commit is contained in:
parent
4207e6af29
commit
2bcc86538e
|
@ -1,7 +1,7 @@
|
|||
From ffc51e7cf3896389a5e015ea1774d59bb200d806 Mon Sep 17 00:00:00 2001
|
||||
From 8100be359a6806e589c0b8846e34daac00a450ed Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Tue, 19 Oct 2021 21:16:55 -0400
|
||||
Subject: [PATCH] APM: Restore R and Q behavior respectively for telephony
|
||||
Subject: [PATCH 1/2] APM: Restore R and Q behavior respectively for telephony
|
||||
audio
|
||||
|
||||
This conditionally reverts part of 51c9cc (S) and afd4ce (R) when the
|
||||
|
@ -34,7 +34,7 @@ Change-Id: I56d36d2aef4319935cb88a3e4771b23c6d5b2145
|
|||
2 files changed, 28 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
|
||||
index cc2d8e8cf4..8defaad32c 100644
|
||||
index e334532ebc..5a15e235e0 100644
|
||||
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
|
||||
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
|
||||
@@ -601,6 +601,11 @@ status_t AudioPolicyManager::updateCallRoutingInternal(
|
||||
|
@ -90,10 +90,10 @@ index cc2d8e8cf4..8defaad32c 100644
|
|||
// on other HW module, SinkMetaData of telephony input should handle it
|
||||
// assuming the device uses audio HAL V5.0 and above
|
||||
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
|
||||
index 98f96d1951..e8b19091d5 100644
|
||||
index 967aa10441..a1e875f559 100644
|
||||
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
|
||||
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
|
||||
@@ -827,6 +827,7 @@ protected:
|
||||
@@ -839,6 +839,7 @@ protected:
|
||||
SoundTriggerSessionCollection mSoundTriggerSessions;
|
||||
|
||||
sp<AudioPatch> mCallTxPatch;
|
||||
|
@ -102,5 +102,5 @@ index 98f96d1951..e8b19091d5 100644
|
|||
HwAudioOutputCollection mHwOutputs;
|
||||
SourceClientCollection mAudioSources;
|
||||
--
|
||||
2.33.1
|
||||
2.36.1
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
From f080834bc4eb8438750a89371c2cea59874ed698 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 1 Jun 2022 16:56:46 -0400
|
||||
Subject: [PATCH 2/2] camera: Implement property to override default camera
|
||||
|
||||
Complement to the frameworks/base patch.
|
||||
|
||||
Change-Id: I002bfa974bafc2cc01365eeea31c7a5dcb5a2028
|
||||
---
|
||||
.../common/CameraProviderManager.cpp | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
index 2f74df9770..5b7166d4c0 100644
|
||||
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <functional>
|
||||
#include <camera_metadata_hidden.h>
|
||||
#include <android-base/parseint.h>
|
||||
+#include <android-base/properties.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <hwbinder/IPCThreadState.h>
|
||||
@@ -208,6 +209,18 @@ std::vector<std::string> CameraProviderManager::getAPI1CompatibleCameraDeviceIds
|
||||
std::sort(systemDeviceIds.begin(), systemDeviceIds.end(), sortFunc);
|
||||
deviceIds.insert(deviceIds.end(), publicDeviceIds.begin(), publicDeviceIds.end());
|
||||
deviceIds.insert(deviceIds.end(), systemDeviceIds.begin(), systemDeviceIds.end());
|
||||
+
|
||||
+ // Default camera ID hack should match with android.hardware.camera2.CameraManager.sortCameraIds
|
||||
+ // Note that the alt primary camera may not be available here due to filterLogicalCameraIdsLocked()
|
||||
+ // in which case we will just ignore it.
|
||||
+ int altPrimaryCameraId = base::GetIntProperty("persist.sys.alt_primary_camera", -1);
|
||||
+
|
||||
+ if (altPrimaryCameraId > 0 && altPrimaryCameraId < (int) deviceIds.size()) {
|
||||
+ std::string origPrimary = deviceIds[0];
|
||||
+ deviceIds[0] = deviceIds[altPrimaryCameraId];
|
||||
+ deviceIds[altPrimaryCameraId] = origPrimary;
|
||||
+ }
|
||||
+
|
||||
return deviceIds;
|
||||
}
|
||||
|
||||
--
|
||||
2.36.1
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
From 70f7d35dda51036f04d31d507e4c30ee0a033ec5 Mon Sep 17 00:00:00 2001
|
||||
From a26d483d257bdb33553f43719cdad0b392fc6ea4 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Tue, 12 Oct 2021 21:37:22 -0400
|
||||
Subject: [PATCH 1/2] PackageParser: support glob matching for properties
|
||||
Subject: [PATCH 1/3] PackageParser: support glob matching for properties
|
||||
|
||||
Needed to make phh's vendor overlays work
|
||||
---
|
||||
|
@ -9,10 +9,10 @@ Needed to make phh's vendor overlays work
|
|||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
|
||||
index bbb0b8e30938..45ebe8e1aaaf 100644
|
||||
index 80058d31245c..0ea286c1591a 100644
|
||||
--- a/core/java/android/content/pm/PackageParser.java
|
||||
+++ b/core/java/android/content/pm/PackageParser.java
|
||||
@@ -2500,8 +2500,16 @@ public class PackageParser {
|
||||
@@ -2504,8 +2504,16 @@ public class PackageParser {
|
||||
for (int i = 0; i < propNames.length; i++) {
|
||||
// Check property value: make sure it is both set and equal to expected value
|
||||
final String currValue = SystemProperties.get(propNames[i]);
|
||||
|
@ -32,5 +32,5 @@ index bbb0b8e30938..45ebe8e1aaaf 100644
|
|||
}
|
||||
return true;
|
||||
--
|
||||
2.33.1
|
||||
2.36.1
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From 214f184c91b39047046f5cc14af7541e5fb1b458 Mon Sep 17 00:00:00 2001
|
||||
From 4182ca99bed1bed96178c382a75d4f747f206b1e Mon Sep 17 00:00:00 2001
|
||||
From: Danny Lin <danny@kdrag0n.dev>
|
||||
Date: Sat, 7 Nov 2020 23:47:30 -0800
|
||||
Subject: [PATCH 2/2] core: Use real security patch level property
|
||||
Subject: [PATCH 2/3] core: Use real security patch level property
|
||||
|
||||
The standard platform security patch level property may not reflect the
|
||||
real patch level due to SafetyNet hacks, so we need to check the custom
|
||||
|
@ -14,7 +14,7 @@ Change-Id: I18f8b6812335f132a935e0cfc04523cf693d1101
|
|||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
|
||||
index 95bcdf42f739..49ced75734d0 100755
|
||||
index f0fab3f64113..449336dd53ab 100755
|
||||
--- a/core/java/android/os/Build.java
|
||||
+++ b/core/java/android/os/Build.java
|
||||
@@ -306,7 +306,7 @@ public class Build {
|
||||
|
@ -27,5 +27,5 @@ index 95bcdf42f739..49ced75734d0 100755
|
|||
/**
|
||||
* The media performance class of the device or 0 if none.
|
||||
--
|
||||
2.33.1
|
||||
2.36.1
|
||||
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
From b2c3942e6eb0f899039f6be96f87b7b0727b41d3 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 1 Jun 2022 16:56:20 -0400
|
||||
Subject: [PATCH 3/3] Implement a persistent property to override the default
|
||||
primary camera (0)
|
||||
|
||||
Change-Id: I49b45d00bf71d7932591b3516d49a680e1b6568b
|
||||
---
|
||||
core/java/android/hardware/Camera.java | 6 ++++++
|
||||
core/java/android/hardware/camera2/CameraManager.java | 9 +++++++++
|
||||
2 files changed, 15 insertions(+)
|
||||
|
||||
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
|
||||
index 3bdd39f5d7d7..fff46f20342b 100644
|
||||
--- a/core/java/android/hardware/Camera.java
|
||||
+++ b/core/java/android/hardware/Camera.java
|
||||
@@ -45,6 +45,7 @@ import android.os.Message;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
+import android.os.SystemProperties;
|
||||
import android.renderscript.Allocation;
|
||||
import android.renderscript.Element;
|
||||
import android.renderscript.RSIllegalArgumentException;
|
||||
@@ -408,6 +409,11 @@ public class Camera {
|
||||
* @see #open(int)
|
||||
*/
|
||||
public static Camera open() {
|
||||
+ int altPrimaryCamera = SystemProperties.getInt("persist.sys.alt_primary_camera", -1);
|
||||
+ if (altPrimaryCamera > 0) {
|
||||
+ return new Camera(altPrimaryCamera);
|
||||
+ }
|
||||
+
|
||||
int numberOfCameras = getNumberOfCameras();
|
||||
CameraInfo cameraInfo = new CameraInfo();
|
||||
for (int i = 0; i < numberOfCameras; i++) {
|
||||
diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java
|
||||
index b7c5644df107..72b4b8e7799a 100644
|
||||
--- a/core/java/android/hardware/camera2/CameraManager.java
|
||||
+++ b/core/java/android/hardware/camera2/CameraManager.java
|
||||
@@ -1595,6 +1595,15 @@ public final class CameraManager {
|
||||
}
|
||||
}});
|
||||
|
||||
+ // HAXX: Allow overriding default primary camera (assumed to be camera 0) via property
|
||||
+ // Should match with libcameraservice/common/CameraProviderManager.cpp
|
||||
+ int altPrimaryCamera = SystemProperties.getInt("persist.sys.alt_primary_camera", -1);
|
||||
+ if (altPrimaryCamera > 0 && altPrimaryCamera < cameraIds.length) {
|
||||
+ String origPrimary = cameraIds[0];
|
||||
+ cameraIds[0] = cameraIds[altPrimaryCamera];
|
||||
+ cameraIds[altPrimaryCamera] = origPrimary;
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
public static boolean cameraStatusesContains(CameraStatus[] cameraStatuses, String id) {
|
||||
--
|
||||
2.36.1
|
||||
|
Loading…
Reference in New Issue