parent
eb831a8f3b
commit
a898fa0bea
@ -1,62 +0,0 @@
|
||||
From 9d5b1f22e00167bd6f75fde20ace1c1d1e964318 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 1 Jun 2022 16:56:46 -0400
|
||||
Subject: [PATCH 4/5] camera: Implement property to override default camera
|
||||
|
||||
Complement to the frameworks/base patch.
|
||||
|
||||
Change-Id: I002bfa974bafc2cc01365eeea31c7a5dcb5a2028
|
||||
---
|
||||
.../common/CameraProviderManager.cpp | 22 +++++++++++++++++++
|
||||
1 file changed, 22 insertions(+)
|
||||
|
||||
diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
index abaea6639f..59b59f44fb 100644
|
||||
--- a/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
+++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp
|
||||
@@ -36,6 +36,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>
|
||||
@@ -205,6 +206,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;
|
||||
}
|
||||
|
||||
@@ -271,6 +281,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.37.2
|
||||
|
@ -1,59 +0,0 @@
|
||||
From bd9fc170c2125e142f19805cceaaabe354ba6da8 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Cai <peter@typeblog.net>
|
||||
Date: Wed, 1 Jun 2022 16:56:20 -0400
|
||||
Subject: [PATCH 4/5] 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 d6d3a97687b5..c86c909a4109 100644
|
||||
--- a/core/java/android/hardware/camera2/CameraManager.java
|
||||
+++ b/core/java/android/hardware/camera2/CameraManager.java
|
||||
@@ -1723,6 +1723,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.37.2
|
||||
|
@ -1,73 +0,0 @@
|
||||
From dbb30694c2cce4a5fb70ea6a8c5594bcca7cba4d Mon Sep 17 00:00:00 2001
|
||||
From: Danny Lin <danny@kdrag0n.dev>
|
||||
Date: Sun, 10 Oct 2021 03:38:23 -0700
|
||||
Subject: [PATCH 5/5] Fix Personal/Work profile tab colors in All Apps
|
||||
|
||||
The default AOSP colors are broken and result in poor contrast, among
|
||||
other issues.
|
||||
|
||||
Change-Id: Id7824bc08cac0aad055f41c0b617e15300af05d4
|
||||
---
|
||||
res/color-night-v31/all_apps_tab_text.xml | 6 +++---
|
||||
.../all_apps_tabs_background.xml | 18 ++++++++++++++++++
|
||||
res/color-v31/all_apps_tab_text.xml | 6 +++---
|
||||
3 files changed, 24 insertions(+), 6 deletions(-)
|
||||
create mode 100644 res/color-night-v31/all_apps_tabs_background.xml
|
||||
|
||||
diff --git a/res/color-night-v31/all_apps_tab_text.xml b/res/color-night-v31/all_apps_tab_text.xml
|
||||
index 83237b49e5..eaac621cfc 100644
|
||||
--- a/res/color-night-v31/all_apps_tab_text.xml
|
||||
+++ b/res/color-night-v31/all_apps_tab_text.xml
|
||||
@@ -14,6 +14,6 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
- <item android:color="@android:color/system_neutral1_50" android:state_selected="true"/>
|
||||
- <item android:color="@android:color/system_neutral2_700"/>
|
||||
-</selector>
|
||||
\ No newline at end of file
|
||||
+ <item android:color="?android:textColorPrimaryInverse" android:state_selected="true"/>
|
||||
+ <item android:color="?android:textColorSecondary"/>
|
||||
+</selector>
|
||||
diff --git a/res/color-night-v31/all_apps_tabs_background.xml b/res/color-night-v31/all_apps_tabs_background.xml
|
||||
new file mode 100644
|
||||
index 0000000000..fc8a4d7d79
|
||||
--- /dev/null
|
||||
+++ b/res/color-night-v31/all_apps_tabs_background.xml
|
||||
@@ -0,0 +1,18 @@
|
||||
+<?xml version="1.0" encoding="utf-8"?>
|
||||
+<!-- Copyright (C) 2021 The Android Open Source Project
|
||||
+
|
||||
+ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
+ you may not use this file except in compliance with the License.
|
||||
+ You may obtain a copy of the License at
|
||||
+
|
||||
+ http://www.apache.org/licenses/LICENSE-2.0
|
||||
+
|
||||
+ Unless required by applicable law or agreed to in writing, software
|
||||
+ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
+ See the License for the specific language governing permissions and
|
||||
+ limitations under the License.
|
||||
+-->
|
||||
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
+ <item android:color="@android:color/system_neutral1_800" />
|
||||
+</selector>
|
||||
diff --git a/res/color-v31/all_apps_tab_text.xml b/res/color-v31/all_apps_tab_text.xml
|
||||
index c3520a7ab5..d133a31a2d 100644
|
||||
--- a/res/color-v31/all_apps_tab_text.xml
|
||||
+++ b/res/color-v31/all_apps_tab_text.xml
|
||||
@@ -14,6 +14,6 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
- <item android:color="@android:color/system_neutral1_900" android:state_selected="true"/>
|
||||
- <item android:color="@android:color/system_neutral2_700"/>
|
||||
-</selector>
|
||||
\ No newline at end of file
|
||||
+ <item android:color="?android:textColorPrimary" android:state_selected="true"/>
|
||||
+ <item android:color="?android:textColorSecondary"/>
|
||||
+</selector>
|
||||
--
|
||||
2.37.2
|
||||
|
@ -0,0 +1,37 @@
|
||||
From 8ebb9654981aea1a79a4145eda7c55d2f5a02d1c Mon Sep 17 00:00:00 2001
|
||||
From: Danny Lin <danny@kdrag0n.dev>
|
||||
Date: Tue, 5 Oct 2021 22:40:58 -0700
|
||||
Subject: [PATCH 5/5] Add permission for launcher preview rendering
|
||||
|
||||
Change-Id: Ie707dcd98161e8f5993b0504295fddc3f395cd20
|
||||
---
|
||||
AndroidManifest.xml | 1 +
|
||||
privapp_whitelist_com.android.wallpaper.xml | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
|
||||
index 26f4fce0..40281cf9 100755
|
||||
--- a/AndroidManifest.xml
|
||||
+++ b/AndroidManifest.xml
|
||||
@@ -8,6 +8,7 @@
|
||||
<uses-permission android:name="android.permission.CHANGE_OVERLAY_PACKAGES"/>
|
||||
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER_COMPONENT" />
|
||||
+ <uses-permission android:name="android.permission.BIND_WALLPAPER" />
|
||||
<uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
|
||||
<uses-permission android:name="android.permission.MODIFY_DAY_NIGHT_MODE" />
|
||||
<uses-permission android:name="android.permission.CUSTOMIZE_SYSTEM_UI" />
|
||||
diff --git a/privapp_whitelist_com.android.wallpaper.xml b/privapp_whitelist_com.android.wallpaper.xml
|
||||
index e3f3b658..47133be8 100644
|
||||
--- a/privapp_whitelist_com.android.wallpaper.xml
|
||||
+++ b/privapp_whitelist_com.android.wallpaper.xml
|
||||
@@ -20,5 +20,6 @@
|
||||
<permission name="android.permission.MODIFY_DAY_NIGHT_MODE"/>
|
||||
<permission name="android.permission.CHANGE_OVERLAY_PACKAGES"/>
|
||||
<permission name="android.permission.WRITE_SECURE_SETTINGS" />
|
||||
+ <permission name="android.permission.BIND_WALLPAPER"/>
|
||||
</privapp-permissions>
|
||||
</permissions>
|
||||
--
|
||||
2.39.2
|
||||
|
Loading…
Reference in new issue