lineage-20
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
From 4891f5c311d7854b4d7b8357290ed08b866240d9 Mon Sep 17 00:00:00 2001
|
||||
From: Arian <arian.kulmer@web.de>
|
||||
Date: Sun, 4 Jun 2023 14:34:32 +0200
|
||||
Subject: [PATCH] Revert "sepolicy:qcc: switch to platform app"
|
||||
|
||||
---
|
||||
generic/private/file.te | 6 +-----
|
||||
generic/private/qcc_app.te | 14 +++++++++-----
|
||||
generic/private/seapp_contexts | 6 +-----
|
||||
3 files changed, 11 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/generic/private/file.te b/generic/private/file.te
|
||||
index 79a0416e..c9db4fcf 100644
|
||||
--- a/generic/private/file.te
|
||||
+++ b/generic/private/file.te
|
||||
@@ -24,16 +24,12 @@
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-#
|
||||
-# Changes from Qualcomm Innovation Center are provided under the following license:
|
||||
-# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
-# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
|
||||
type vendor_seemp_data_file, core_data_file_type, data_file_type, file_type;
|
||||
type vendor_dpmd_socket, file_type, coredomain_socket;
|
||||
type vendor_dpmd_data_file, file_type, data_file_type, core_data_file_type;
|
||||
type vendor_dpmwrapper_socket, file_type, coredomain_socket, mlstrustedobject;
|
||||
-type vendor_qcc_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
|
||||
+type vendor_qcc_data_file, file_type, data_file_type, core_data_file_type;
|
||||
type vendor_qcc_app_socket, file_type, mlstrustedobject, coredomain_socket;
|
||||
type vendor_sys_sxrauxd_data_file, file_type, data_file_type, core_data_file_type;
|
||||
type vendor_sys_sxrauxd_socket, file_type, coredomain_socket;
|
||||
diff --git a/generic/private/qcc_app.te b/generic/private/qcc_app.te
|
||||
index 014400ce..9bca53a0 100644
|
||||
--- a/generic/private/qcc_app.te
|
||||
+++ b/generic/private/qcc_app.te
|
||||
@@ -30,10 +30,11 @@
|
||||
# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
|
||||
+typeattribute vendor_qcc_app mlstrustedsubject;
|
||||
+
|
||||
app_domain(vendor_qcc_app)
|
||||
net_domain(vendor_qcc_app)
|
||||
binder_use(vendor_qcc_app)
|
||||
-hal_client_domain(vendor_qcc_app, vendor_qccsyshal);
|
||||
|
||||
allow vendor_qcc_app radio_service:service_manager find;
|
||||
# for vendor_perf_service
|
||||
@@ -49,10 +50,13 @@ unix_socket_connect(vendor_qcc_app, vendor_dpmtcm, vendor_tcmd)
|
||||
# allow access to mediadrmserver for qdmastats/wvstats
|
||||
allow vendor_qcc_app mediadrmserver_service:service_manager find;
|
||||
|
||||
-# allow vendor_qcc_app to access app_data_file
|
||||
-# necessary for read and write /data/user_de/0/data subdirectory.
|
||||
-allow vendor_qcc_app app_data_file:dir create_dir_perms;
|
||||
-allow vendor_qcc_app app_data_file:file create_file_perms;
|
||||
+# allow vendor_qcc_app to access system_app_data_file
|
||||
+# necessary for read and write /data/user_de/0/com.---.qti.qdma subdirectory.
|
||||
+allow vendor_qcc_app system_data_file:dir search;
|
||||
+allow vendor_qcc_app system_app_data_file:dir create_dir_perms;
|
||||
+allow vendor_qcc_app system_app_data_file:file create_file_perms;
|
||||
+
|
||||
+allow vendor_qcc_app user_profile_root_file:dir search;
|
||||
|
||||
# allow cgroup access
|
||||
allow vendor_qcc_app cgroup:file rw_file_perms;
|
||||
diff --git a/generic/private/seapp_contexts b/generic/private/seapp_contexts
|
||||
index bdb1f72c..9132b4ef 100644
|
||||
--- a/generic/private/seapp_contexts
|
||||
+++ b/generic/private/seapp_contexts
|
||||
@@ -24,10 +24,6 @@
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-#
|
||||
-# Changes from Qualcomm Innovation Center are provided under the following license:
|
||||
-# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
-# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
|
||||
#Add new domain for DataServices
|
||||
# Needed for CNEService , uceShimService and other connectivity services
|
||||
@@ -51,7 +47,7 @@ user=_app seinfo=platform name=com.qualcomm.wfd.service:wfd_service domain=vendo
|
||||
user=_app seinfo=platform name=com.qualcomm.wfd.client domain=vendor_wfd_app type=app_data_file levelfrom=all
|
||||
|
||||
#Add new domain for QCC
|
||||
-user=_app seinfo=platform name=com.qti.qcc domain=vendor_qcc_app type=app_data_file levelFrom=all
|
||||
+user=system seinfo=platform name=com.qti.qcc isPrivApp=true domain=vendor_qcc_app type=system_app_data_file
|
||||
#Add new domain for QCCLMTP
|
||||
user=system seinfo=platform name=com.qualcomm.qti.qcclmtp isPrivApp=true domain=vendor_qcc_lmtp_app type=system_app_data_file
|
||||
#Add new domain for QCCNetstat
|
||||
@@ -0,0 +1,43 @@
|
||||
From 7381bc84b63f27e923a4478707f738d20e628645 Mon Sep 17 00:00:00 2001
|
||||
From: Fenglin Wu <quic_fenglinw@quicinc.com>
|
||||
Date: Thu, 23 Jun 2022 16:40:50 +0800
|
||||
Subject: [PATCH] sepolicy_vndr: update sepolicy for health HAL service
|
||||
|
||||
Add label for QTI health AIDL HAL service and add policy for it to
|
||||
access power supply devices.
|
||||
|
||||
Change-Id: I17d6c274e3e5fc76ca07019fe2e404c7c5171e57
|
||||
---
|
||||
qva/vendor/common/file_contexts | 1 +
|
||||
qva/vendor/common/hal_health.te | 7 +++++++
|
||||
2 files changed, 8 insertions(+)
|
||||
create mode 100644 qva/vendor/common/hal_health.te
|
||||
|
||||
diff --git a/qva/vendor/common/file_contexts b/qva/vendor/common/file_contexts
|
||||
index b076001cb..d0088e5a4 100644
|
||||
--- a/qva/vendor/common/file_contexts
|
||||
+++ b/qva/vendor/common/file_contexts
|
||||
@@ -105,6 +105,7 @@
|
||||
/(vendor|system/vendor)/bin/hw/vendor\.qti\.hardware\.soter@1\.0-service u:object_r:vendor_hal_soter_qti_exec:s0
|
||||
/vendor/bin/hw/vendor\.qti\.hardware\.vibrator@1\.[0-3]-service u:object_r:hal_vibrator_default_exec:s0
|
||||
/vendor/bin/hw/vendor\.qti\.hardware\.vibrator\.service u:object_r:hal_vibrator_default_exec:s0
|
||||
+/vendor/bin/hw/android\.hardware\.health-service\.qti u:object_r:hal_health_default_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/vendor\.qti\.power\.pasrmanager\@1\.0-service u:object_r:vendor_hal_pasrmanager_qti_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/vendor\.qti\.memory\.pasrmanager\@1\.0-service u:object_r:vendor_pasrmanager_memory_qti_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/vendor\.qti\.psiclient\@1\.0-service u:object_r:vendor_psiservice_exec:s0
|
||||
diff --git a/qva/vendor/common/hal_health.te b/qva/vendor/common/hal_health.te
|
||||
new file mode 100644
|
||||
index 000000000..13e48238a
|
||||
--- /dev/null
|
||||
+++ b/qva/vendor/common/hal_health.te
|
||||
@@ -0,0 +1,7 @@
|
||||
+# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
+# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
+
|
||||
+allow hal_health vendor_sysfs_battery_supply:{file lnk_file} r_file_perms;
|
||||
+allow hal_health vendor_sysfs_battery_supply:dir r_dir_perms;
|
||||
+allow hal_health vendor_sysfs_usb_supply:{file lnk_file} r_file_perms;
|
||||
+allow hal_health vendor_sysfs_usb_supply:dir r_dir_perms;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
25
device/xiaomi/sm8450-common/0001-fix-build.patch
Normal file
25
device/xiaomi/sm8450-common/0001-fix-build.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
From f46c758ba07baed14622b342b09b2df5a51a2984 Mon Sep 17 00:00:00 2001
|
||||
From: kuailexs <952415538@qq.com>
|
||||
Date: Mon, 22 Apr 2024 22:39:39 +0800
|
||||
Subject: [PATCH] fix build
|
||||
|
||||
---
|
||||
gps/android/2.1/service.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gps/android/2.1/service.cpp b/gps/android/2.1/service.cpp
|
||||
index 22cc0f2..7579a06 100644
|
||||
--- a/gps/android/2.1/service.cpp
|
||||
+++ b/gps/android/2.1/service.cpp
|
||||
@@ -53,7 +53,7 @@ typedef const void* (*gnssAutoPowerHandler)(void);
|
||||
void initializeGnssPowerHandler() {
|
||||
|
||||
void * handle = nullptr;
|
||||
- const char* error = nullptr;
|
||||
+ //const char* error = nullptr;
|
||||
gnssAutoPowerHandler getter = nullptr;
|
||||
|
||||
getter = (gnssAutoPowerHandler) dlGetSymFromLib(handle, GNSS_POWER_LIBNAME,
|
||||
--
|
||||
2.25.1
|
||||
|
||||
22
frameworks/av/966aae39fb309ed56c3836926623c5ce858ce077.patch
Normal file
22
frameworks/av/966aae39fb309ed56c3836926623c5ce858ce077.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
From 966aae39fb309ed56c3836926623c5ce858ce077 Mon Sep 17 00:00:00 2001
|
||||
From: Arian <arian.kulmer@web.de>
|
||||
Date: Wed, 15 Mar 2023 11:15:25 +0100
|
||||
Subject: [PATCH] SessionConfigurationUtils: Allow privileged camera apps to create raw streams for raw capable cameras
|
||||
|
||||
Change-Id: I4e82027917e458e1472464e7317bb1968ff7ee2c
|
||||
---
|
||||
|
||||
diff --git a/services/camera/libcameraservice/utils/SessionConfigurationUtils.cpp b/services/camera/libcameraservice/utils/SessionConfigurationUtils.cpp
|
||||
index eb45fbe..7e80052 100644
|
||||
--- a/services/camera/libcameraservice/utils/SessionConfigurationUtils.cpp
|
||||
+++ b/services/camera/libcameraservice/utils/SessionConfigurationUtils.cpp
|
||||
@@ -198,7 +198,8 @@
|
||||
auto entry = info.find(ANDROID_REQUEST_AVAILABLE_CAPABILITIES);
|
||||
for (size_t i = 0; i < entry.count; ++i) {
|
||||
uint8_t capability = entry.data.u8[i];
|
||||
- if (capability == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA) {
|
||||
+ if (capability == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA ||
|
||||
+ capability == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW) {
|
||||
isLogicalCamera = true;
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
From d019a2cf56c0c25c2e99caa79c42e18c4e18ae00 Mon Sep 17 00:00:00 2001
|
||||
From: Vala Zadeh <quic_vzadeh@quicinc.com>
|
||||
Date: Wed, 18 May 2022 16:57:43 -0700
|
||||
Subject: [PATCH 1/2] Add 5G Ultra Wideband icon carrier config keys
|
||||
|
||||
Change-Id: Idc6da92fb41a780d01c961d676f61ae4b91d2a7b
|
||||
CRs-Fixed: 3218447
|
||||
---
|
||||
.../telephony/CarrierConfigManager.java | 84 +++++++++++++++++++
|
||||
1 file changed, 84 insertions(+)
|
||||
|
||||
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
|
||||
index 7cb2cc398c46..570ee2aa8628 100644
|
||||
--- a/telephony/java/android/telephony/CarrierConfigManager.java
|
||||
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
|
||||
@@ -10038,6 +10038,81 @@ public class CarrierConfigManager {
|
||||
public static final String KEY_AUTO_DATA_SWITCH_RAT_SIGNAL_SCORE_BUNDLE =
|
||||
"auto_data_switch_rat_signal_score_string_bundle";
|
||||
|
||||
+ /**
|
||||
+ * Determines the SIB2 value for showing the 5G Ultra Wideband icon.
|
||||
+ * The rest of the NR Ultra Wideband configs will be considere only if this value is 1. A value
|
||||
+ * of 0 means the other NR Ultra Wideband configs will not be considered.
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String KEY_NR_ULTRA_WIDEBAND_ICON_SIB2_VALUE =
|
||||
+ "5g_ultra_wideband_icon_sib2_value";
|
||||
+
|
||||
+ /**
|
||||
+ * Determines the minimum aggregate bandwidth for showing the 5G Ultra Wideband icon.
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String KEY_NR_ULTRA_WIDEBAND_ICON_MIN_BANDWIDTH_VALUE =
|
||||
+ "5g_ultra_wideband_icon_min_bandwidth_value";
|
||||
+
|
||||
+ /**
|
||||
+ * Determines the minimum aggregate bandwidth mode for which the 5G Ultra Wideband icon will be
|
||||
+ * shown. The following modes are allowed: NONE, CONNECTED, IDLE, CONNECTED_AND_IDLE
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String KEY_NR_ULTRA_WIDEBAND_ICON_MIN_BANDWIDTH_MODE =
|
||||
+ "5g_ultra_wideband_icon_min_bandwidth_mode";
|
||||
+
|
||||
+ /**
|
||||
+ * Determines the 5G Ultra Wideband icon refresh timer type (key) and the refresh timer value
|
||||
+ * (value) in seconds.
|
||||
+ * The following types are allowed for the type: SCG_TO_MCG, IDLE_TO_CONNECT, IDLE
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String KEY_NR_ULTRA_WIDEBAND_ICON_REFRESH_TIMER_MAP =
|
||||
+ "5g_ultra_wideband_icon_refresh_timer_map";
|
||||
+
|
||||
+ /**
|
||||
+ * Determines the mode in which the 5G Ultra Wideband icon will be shown for 5G NSA bands.
|
||||
+ * The following modes are allowed: NONE, CONNECTED, IDLE, CONNECTED_AND_IDLE
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String KEY_NR_ULTRA_WIDEBAND_ICON_NSA_BAND_MODE =
|
||||
+ "5g_ultra_wideband_icon_nsa_band_mode";
|
||||
+
|
||||
+ /**
|
||||
+ * Determines the list of 5G NSA bands for which 5G Ultra Wideband icons must be shown.
|
||||
+ * For each list entry, the allowed values are either enabled (show the 5G Ultra Wideband icon)
|
||||
+ * or disabled (do not show the 5G Ultra Wideband icon).
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String KEY_NR_ULTRA_WIDEBAND_ICON_NSA_BAND_ARRAY =
|
||||
+ "5g_ultra_wideband_icon_nsa_band_array";
|
||||
+
|
||||
+ /**
|
||||
+ * Determines the mode in which the 5G Ultra Wideband icon will be shown for 5G SA bands.
|
||||
+ * The following modes are allowed: NONE, CONNECTED, IDLE, CONNECTED_AND_IDLE
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String KEY_NR_ULTRA_WIDEBAND_ICON_SA_BAND_MODE =
|
||||
+ "5g_ultra_wideband_icon_sa_band_mode";
|
||||
+
|
||||
+ /**
|
||||
+ * Determines the list of 5G SA bands for which 5G Ultra Wideband icons must be shown.
|
||||
+ * For each list entry, the allowed values are either enabled (show the 5G Ultra Wideband icon)
|
||||
+ * or disabled (do not show the 5G Ultra Wideband icon).
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String KEY_NR_ULTRA_WIDEBAND_ICON_SA_BAND_ARRAY =
|
||||
+ "5g_ultra_wideband_icon_sa_band_array";
|
||||
+
|
||||
/** The default value for every variable. */
|
||||
private static final PersistableBundle sDefaults;
|
||||
|
||||
@@ -10671,6 +10746,15 @@ public class CarrierConfigManager {
|
||||
"enterprise:0", "default:1", "mms:2", "supl:2", "dun:2", "hipri:3", "fota:2",
|
||||
"ims:2", "cbs:2", "ia:2", "emergency:2", "mcx:3", "xcap:3"
|
||||
});
|
||||
+ sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_SIB2_VALUE, -1);
|
||||
+ sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_MIN_BANDWIDTH_VALUE, 0);
|
||||
+ sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_MIN_BANDWIDTH_MODE, 0);
|
||||
+ sDefaults.putPersistableBundle(KEY_NR_ULTRA_WIDEBAND_ICON_REFRESH_TIMER_MAP,
|
||||
+ PersistableBundle.EMPTY);
|
||||
+ sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_NSA_BAND_MODE, 0);
|
||||
+ sDefaults.putIntArray(KEY_NR_ULTRA_WIDEBAND_ICON_SA_BAND_ARRAY, new int[]{});
|
||||
+ sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_SA_BAND_MODE, 0);
|
||||
+ sDefaults.putIntArray(KEY_NR_ULTRA_WIDEBAND_ICON_NSA_BAND_ARRAY, new int[]{});
|
||||
|
||||
// Do not modify the priority unless you know what you are doing. This will have significant
|
||||
// impacts on the order of data network setup.
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From 3d887846df2b6ff5c4330118a81d99708607032c Mon Sep 17 00:00:00 2001
|
||||
From: Vala Zadeh <quic_vzadeh@quicinc.com>
|
||||
Date: Wed, 22 Jun 2022 16:39:27 -0700
|
||||
Subject: [PATCH 2/2] Fix default values for 5G Ultra Wideband icon carrier
|
||||
config keys
|
||||
|
||||
Change-Id: Ie143a0489163177d3be3e0de280bc3ed0d017437
|
||||
CRs-Fixed: 3218447
|
||||
---
|
||||
.../java/android/telephony/CarrierConfigManager.java | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
|
||||
index 570ee2aa8628..c09eaab59da5 100644
|
||||
--- a/telephony/java/android/telephony/CarrierConfigManager.java
|
||||
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
|
||||
@@ -10746,14 +10746,14 @@ public class CarrierConfigManager {
|
||||
"enterprise:0", "default:1", "mms:2", "supl:2", "dun:2", "hipri:3", "fota:2",
|
||||
"ims:2", "cbs:2", "ia:2", "emergency:2", "mcx:3", "xcap:3"
|
||||
});
|
||||
- sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_SIB2_VALUE, -1);
|
||||
- sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_MIN_BANDWIDTH_VALUE, 0);
|
||||
- sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_MIN_BANDWIDTH_MODE, 0);
|
||||
+ sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_SIB2_VALUE, Integer.MAX_VALUE);
|
||||
+ sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_MIN_BANDWIDTH_VALUE, Integer.MAX_VALUE);
|
||||
+ sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_MIN_BANDWIDTH_MODE, Integer.MAX_VALUE);
|
||||
sDefaults.putPersistableBundle(KEY_NR_ULTRA_WIDEBAND_ICON_REFRESH_TIMER_MAP,
|
||||
PersistableBundle.EMPTY);
|
||||
- sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_NSA_BAND_MODE, 0);
|
||||
+ sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_NSA_BAND_MODE, Integer.MAX_VALUE);
|
||||
sDefaults.putIntArray(KEY_NR_ULTRA_WIDEBAND_ICON_SA_BAND_ARRAY, new int[]{});
|
||||
- sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_SA_BAND_MODE, 0);
|
||||
+ sDefaults.putInt(KEY_NR_ULTRA_WIDEBAND_ICON_SA_BAND_MODE, Integer.MAX_VALUE);
|
||||
sDefaults.putIntArray(KEY_NR_ULTRA_WIDEBAND_ICON_NSA_BAND_ARRAY, new int[]{});
|
||||
|
||||
// Do not modify the priority unless you know what you are doing. This will have significant
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From 4ae78da655484f99715fa8ad7550d2086ee19871 Mon Sep 17 00:00:00 2001
|
||||
From: wbs306 <wbs306@gmail.com>
|
||||
Date: Thu, 27 Oct 2022 20:58:17 +0800
|
||||
Subject: [PATCH] Camera: Expose aux camera if packagename is null
|
||||
|
||||
In case of the pacckage name not being found properly
|
||||
the name would always be found in the excludelist, even
|
||||
if the list is empty. This leads to denying aux camera
|
||||
access in some cases where it is not intended to be
|
||||
blocked.
|
||||
|
||||
Change-Id: I75c620ab876ebabf71c740e04004e4120edd93ae
|
||||
---
|
||||
|
||||
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
|
||||
index 7193b93..3f82ea7 100644
|
||||
--- a/core/java/android/hardware/Camera.java
|
||||
+++ b/core/java/android/hardware/Camera.java
|
||||
@@ -276,6 +276,8 @@
|
||||
* if the package name does not falls in this bucket
|
||||
*/
|
||||
String packageName = ActivityThread.currentOpPackageName();
|
||||
+ if (packageName == null)
|
||||
+ return true;
|
||||
List<String> packageList = new ArrayList<>(Arrays.asList(
|
||||
SystemProperties.get("vendor.camera.aux.packagelist", ",").split(",")));
|
||||
List<String> packageExcludelist = new ArrayList<>(Arrays.asList(
|
||||
26
frameworks/opt/telephony/001-d18b2cb.diff
Normal file
26
frameworks/opt/telephony/001-d18b2cb.diff
Normal file
@@ -0,0 +1,26 @@
|
||||
From d18b2cba982f64c4098ebc063ff0caeb82f9b16a Mon Sep 17 00:00:00 2001
|
||||
From: Avinash Nalluri <quic_analluri@quicinc.com>
|
||||
Date: Mon, 24 Jan 2022 12:21:45 -0800
|
||||
Subject: [PATCH] Disable proguard for CellularNetworkServiceProvider
|
||||
|
||||
It prevents the CellularNetworkServiceProvider class
|
||||
gets shrunk by the ProGuard so that the class methods
|
||||
are accessible at run time.
|
||||
|
||||
Change-Id: Idb34c1dcd5ca0d449b0202bea774c68dab3b0ee8
|
||||
CRs-Fixed: 3115662
|
||||
---
|
||||
|
||||
diff --git a/proguard.flags b/proguard.flags
|
||||
index ebc8922..e930de0 100644
|
||||
--- a/proguard.flags
|
||||
+++ b/proguard.flags
|
||||
@@ -27,3 +27,8 @@
|
||||
-keepclassmembers class * {
|
||||
@**.UnsupportedAppUsage *;
|
||||
}
|
||||
+
|
||||
+# Keep CellularNetworkServiceProvider members
|
||||
+-keepclasseswithmembers class com.android.internal.telephony.CellularNetworkService$CellularNetworkServiceProvider {
|
||||
+*;
|
||||
+}
|
||||
62
frameworks/opt/telephony/002-dd06504.diff
Normal file
62
frameworks/opt/telephony/002-dd06504.diff
Normal file
@@ -0,0 +1,62 @@
|
||||
From dd06504666b2183f8dbff45e4fbff5305ad70dae Mon Sep 17 00:00:00 2001
|
||||
From: Sneh Bansal <snehb@codeaurora.org>
|
||||
Date: Tue, 09 Mar 2021 15:51:47 +0530
|
||||
Subject: [PATCH] Add provision to override CellularNetworkService
|
||||
|
||||
- Add a default constructor
|
||||
- Change access specifier of some members to protected
|
||||
- Make SST's registration managers accessible to its derived classes.
|
||||
|
||||
Change-Id: Iff2d36075a79721bd71754ff37999289494bafff
|
||||
CRs-Fixed: 2838720
|
||||
---
|
||||
|
||||
diff --git a/src/java/com/android/internal/telephony/CellularNetworkService.java b/src/java/com/android/internal/telephony/CellularNetworkService.java
|
||||
index 4253905..5f19b7f 100644
|
||||
--- a/src/java/com/android/internal/telephony/CellularNetworkService.java
|
||||
+++ b/src/java/com/android/internal/telephony/CellularNetworkService.java
|
||||
@@ -109,7 +109,7 @@
|
||||
TelephonyManager.NETWORK_TYPE_TD_SCDMA}));
|
||||
}
|
||||
|
||||
- private class CellularNetworkServiceProvider extends NetworkServiceProvider {
|
||||
+ protected class CellularNetworkServiceProvider extends NetworkServiceProvider {
|
||||
|
||||
private final Map<Message, NetworkServiceCallback> mCallbackMap = new HashMap<>();
|
||||
|
||||
@@ -117,6 +117,12 @@
|
||||
|
||||
private final Phone mPhone;
|
||||
|
||||
+ protected CellularNetworkServiceProvider() {
|
||||
+ super(SubscriptionManager.DEFAULT_SIM_SLOT_INDEX);
|
||||
+ mHandler = null;
|
||||
+ mPhone = null;
|
||||
+ }
|
||||
+
|
||||
CellularNetworkServiceProvider(int slotId) {
|
||||
super(slotId);
|
||||
|
||||
@@ -236,7 +242,8 @@
|
||||
return availableServices;
|
||||
}
|
||||
|
||||
- private NetworkRegistrationInfo getRegistrationStateFromResult(Object result, int domain) {
|
||||
+ protected NetworkRegistrationInfo getRegistrationStateFromResult(Object result,
|
||||
+ int domain) {
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
diff --git a/src/java/com/android/internal/telephony/ServiceStateTracker.java b/src/java/com/android/internal/telephony/ServiceStateTracker.java
|
||||
index 3ed4578..9210a21 100755
|
||||
--- a/src/java/com/android/internal/telephony/ServiceStateTracker.java
|
||||
+++ b/src/java/com/android/internal/telephony/ServiceStateTracker.java
|
||||
@@ -614,7 +614,7 @@
|
||||
private String mCurrentCarrier = null;
|
||||
|
||||
private final AccessNetworksManager mAccessNetworksManager;
|
||||
- private final SparseArray<NetworkRegistrationManager> mRegStateManagers = new SparseArray<>();
|
||||
+ protected final SparseArray<NetworkRegistrationManager> mRegStateManagers = new SparseArray<>();
|
||||
|
||||
/* Last known TAC/LAC */
|
||||
private int mLastKnownAreaCode = CellInfo.UNAVAILABLE;
|
||||
35
frameworks/opt/telephony/003-7f1ca2e.diff
Normal file
35
frameworks/opt/telephony/003-7f1ca2e.diff
Normal file
@@ -0,0 +1,35 @@
|
||||
From 7f1ca2eae8ace66efca12c4b47614f6b2f0915fa Mon Sep 17 00:00:00 2001
|
||||
From: Mengjun Leng <quic_mengjunl@quicinc.com>
|
||||
Date: Wed, 12 Oct 2022 10:28:16 +0800
|
||||
Subject: [PATCH] Make a few members of DSM overridable and accessible
|
||||
|
||||
Changes the API updateDataEnabledAndNotify as protected.
|
||||
Changes the member variable mPhone as protected.
|
||||
|
||||
Change-Id: I48d23c2c6229d44922ba5ba9927cfa03de367a9f
|
||||
CRs-Fixed: 3310431
|
||||
---
|
||||
|
||||
diff --git a/src/java/com/android/internal/telephony/data/DataSettingsManager.java b/src/java/com/android/internal/telephony/data/DataSettingsManager.java
|
||||
index c593f88..6347ed8 100644
|
||||
--- a/src/java/com/android/internal/telephony/data/DataSettingsManager.java
|
||||
+++ b/src/java/com/android/internal/telephony/data/DataSettingsManager.java
|
||||
@@ -78,7 +78,7 @@
|
||||
/** Event for initializing DataSettingsManager. */
|
||||
private static final int EVENT_INITIALIZE = 11;
|
||||
|
||||
- private final Phone mPhone;
|
||||
+ protected final Phone mPhone;
|
||||
private final ContentResolver mResolver;
|
||||
private final SettingsObserver mSettingsObserver;
|
||||
private final String mLogTag;
|
||||
@@ -332,7 +332,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private void updateDataEnabledAndNotify(@TelephonyManager.DataEnabledChangedReason int reason) {
|
||||
+ protected void updateDataEnabledAndNotify(
|
||||
+ @TelephonyManager.DataEnabledChangedReason int reason) {
|
||||
updateDataEnabledAndNotify(reason, mPhone.getContext().getOpPackageName());
|
||||
}
|
||||
|
||||
39
frameworks/opt/telephony/004-c73da56.diff
Normal file
39
frameworks/opt/telephony/004-c73da56.diff
Normal file
@@ -0,0 +1,39 @@
|
||||
From c73da56d5ceb5e23d723387c96cd331fd9de11d6 Mon Sep 17 00:00:00 2001
|
||||
From: Mengjun Leng <quic_mengjunl@quicinc.com>
|
||||
Date: Thu, 17 Nov 2022 16:20:34 +0800
|
||||
Subject: [PATCH] Reset data activity after traffic status poll stops
|
||||
|
||||
After default route moves to other network, the data activity is still
|
||||
kept as a stale state. Once there is any active link, the stale state is
|
||||
propagated to upper layer.
|
||||
|
||||
Change-Id: I75879d53a94a548c7b87a8516014672935a01704
|
||||
CRs-Fixed: 3339456
|
||||
---
|
||||
|
||||
diff --git a/src/java/com/android/internal/telephony/data/LinkBandwidthEstimator.java b/src/java/com/android/internal/telephony/data/LinkBandwidthEstimator.java
|
||||
index c225b3f..f5ba0d9 100644
|
||||
--- a/src/java/com/android/internal/telephony/data/LinkBandwidthEstimator.java
|
||||
+++ b/src/java/com/android/internal/telephony/data/LinkBandwidthEstimator.java
|
||||
@@ -441,6 +441,7 @@
|
||||
return;
|
||||
}
|
||||
mIsOnDefaultRoute = isOnDefaultRoute;
|
||||
+ logd("mIsOnDefaultRoute " + mIsOnDefaultRoute);
|
||||
handleTrafficStatsPollConditionChanged();
|
||||
}
|
||||
|
||||
@@ -465,6 +466,13 @@
|
||||
if (mScreenOn && mIsOnDefaultRoute && mIsOnActiveData) {
|
||||
updateDataRatCellIdentityBandwidth();
|
||||
handleTrafficStatsPoll();
|
||||
+ } else {
|
||||
+ logd("Traffic status poll stopped");
|
||||
+ if (mDataActivity != TelephonyManager.DATA_ACTIVITY_NONE) {
|
||||
+ mDataActivity = TelephonyManager.DATA_ACTIVITY_NONE;
|
||||
+ mLinkBandwidthEstimatorCallbacks.forEach(callback -> callback.invokeFromExecutor(
|
||||
+ () -> callback.onDataActivityChanged(mDataActivity)));
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
106
frameworks/opt/telephony/005-9e34e75.diff
Normal file
106
frameworks/opt/telephony/005-9e34e75.diff
Normal file
@@ -0,0 +1,106 @@
|
||||
From 9e34e75de76288987a641e054297ff6fce6abfbb Mon Sep 17 00:00:00 2001
|
||||
From: Sandeep Gutta <sangutta@codeaurora.org>
|
||||
Date: Wed, 06 Feb 2019 15:25:00 +0530
|
||||
Subject: [PATCH] Start using inject framework support
|
||||
|
||||
- Start using inject mechanism to invoke vendor specific code.
|
||||
- Add the inject support for the classes extended in vendor space.
|
||||
|
||||
Change-Id: I35b9761c15aebc32f48107bbe6b3bcec9a1eb670
|
||||
CRs-Fixed: 2394018
|
||||
---
|
||||
|
||||
diff --git a/src/java/com/android/internal/telephony/PhoneFactory.java b/src/java/com/android/internal/telephony/PhoneFactory.java
|
||||
index 3361b74..ef5f9db 100644
|
||||
--- a/src/java/com/android/internal/telephony/PhoneFactory.java
|
||||
+++ b/src/java/com/android/internal/telephony/PhoneFactory.java
|
||||
@@ -172,9 +172,11 @@
|
||||
networkModes[i] = RILConstants.PREFERRED_NETWORK_MODE;
|
||||
|
||||
Rlog.i(LOG_TAG, "Network Mode set to " + Integer.toString(networkModes[i]));
|
||||
- sCommandsInterfaces[i] = new RIL(context,
|
||||
- RadioAccessFamily.getRafFromNetworkType(networkModes[i]),
|
||||
- cdmaSubscription, i);
|
||||
+ sCommandsInterfaces[i] = TelephonyComponentFactory.getInstance().inject(
|
||||
+ RIL.class.getName()).
|
||||
+ makeRIL(context,
|
||||
+ RadioAccessFamily.getRafFromNetworkType(networkModes[i]),
|
||||
+ cdmaSubscription, i);
|
||||
}
|
||||
|
||||
if (numPhones > 0) {
|
||||
@@ -271,8 +273,11 @@
|
||||
|
||||
for (int i = 0; i < numPhones; i++) {
|
||||
sTelephonyNetworkFactories[i] = new TelephonyNetworkFactory(
|
||||
- Looper.myLooper(), sPhones[i]);
|
||||
+ Looper.myLooper(), sPhones[i], sPhoneSwitcher);
|
||||
}
|
||||
+ TelephonyComponentFactory.getInstance().inject(
|
||||
+ TelephonyComponentFactory.class.getName()).
|
||||
+ makeExtTelephonyClasses(context, sPhones, sCommandsInterfaces);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,7 +304,9 @@
|
||||
|
||||
int cdmaSubscription = CdmaSubscriptionSourceManager.getDefault(context);
|
||||
for (int i = prevActiveModemCount; i < activeModemCount; i++) {
|
||||
- sCommandsInterfaces[i] = new RIL(context, RadioAccessFamily.getRafFromNetworkType(
|
||||
+ sCommandsInterfaces[i] = TelephonyComponentFactory.getInstance().inject(
|
||||
+ RIL.class.getName()).
|
||||
+ makeRIL(context, RadioAccessFamily.getRafFromNetworkType(
|
||||
RILConstants.PREFERRED_NETWORK_MODE),
|
||||
cdmaSubscription, i);
|
||||
sPhones[i] = createPhone(context, i);
|
||||
@@ -308,7 +315,7 @@
|
||||
sPhones[i].createImsPhone();
|
||||
}
|
||||
sTelephonyNetworkFactories[i] = new TelephonyNetworkFactory(
|
||||
- Looper.myLooper(), sPhones[i]);
|
||||
+ Looper.myLooper(), sPhones[i], sPhoneSwitcher);
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/java/com/android/internal/telephony/TelephonyComponentFactory.java b/src/java/com/android/internal/telephony/TelephonyComponentFactory.java
|
||||
index dcbd2d5..c694999 100644
|
||||
--- a/src/java/com/android/internal/telephony/TelephonyComponentFactory.java
|
||||
+++ b/src/java/com/android/internal/telephony/TelephonyComponentFactory.java
|
||||
@@ -481,6 +481,15 @@
|
||||
return new LinkBandwidthEstimator(phone, mTelephonyFacade);
|
||||
}
|
||||
|
||||
+ public RIL makeRIL(Context context, int preferredNetworkType,
|
||||
+ int cdmaSubscription, Integer instanceId) {
|
||||
+ return new RIL(context, preferredNetworkType, cdmaSubscription, instanceId);
|
||||
+ }
|
||||
+
|
||||
+ public void makeExtTelephonyClasses(Context context,
|
||||
+ Phone[] phones, CommandsInterface[] commandsInterfaces) {
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Create a new data network controller instance. The instance is per-SIM. On multi-sim devices,
|
||||
* there will be multiple {@link DataNetworkController} instances.
|
||||
diff --git a/src/java/com/android/internal/telephony/data/TelephonyNetworkFactory.java b/src/java/com/android/internal/telephony/data/TelephonyNetworkFactory.java
|
||||
index 85f0ae1..4b6352d 100644
|
||||
--- a/src/java/com/android/internal/telephony/data/TelephonyNetworkFactory.java
|
||||
+++ b/src/java/com/android/internal/telephony/data/TelephonyNetworkFactory.java
|
||||
@@ -95,7 +95,7 @@
|
||||
public final Handler mInternalHandler;
|
||||
|
||||
|
||||
- public TelephonyNetworkFactory(Looper looper, Phone phone) {
|
||||
+ public TelephonyNetworkFactory(Looper looper, Phone phone, PhoneSwitcher phoneSwitcher) {
|
||||
super(looper, phone.getContext(), "TelephonyNetworkFactory[" + phone.getPhoneId()
|
||||
+ "]", null);
|
||||
mPhone = phone;
|
||||
@@ -107,7 +107,7 @@
|
||||
setCapabilityFilter(makeNetworkFilter(mSubscriptionController, mPhone.getPhoneId()));
|
||||
setScoreFilter(TELEPHONY_NETWORK_SCORE);
|
||||
|
||||
- mPhoneSwitcher = PhoneSwitcher.getInstance();
|
||||
+ mPhoneSwitcher = phoneSwitcher;
|
||||
LOG_TAG = "TelephonyNetworkFactory[" + mPhone.getPhoneId() + "]";
|
||||
|
||||
mPhoneSwitcher.registerForActivePhoneSwitch(mInternalHandler, EVENT_ACTIVE_PHONE_SWITCH,
|
||||
25
frameworks/opt/telephony/006-3952581.diff
Normal file
25
frameworks/opt/telephony/006-3952581.diff
Normal file
@@ -0,0 +1,25 @@
|
||||
From 395258167060762d433c15b79ca4f90a97b2c5cd Mon Sep 17 00:00:00 2001
|
||||
From: Sandeep Gutta <sangutta@codeaurora.org>
|
||||
Date: Fri, 03 Jul 2020 22:43:33 +0530
|
||||
Subject: [PATCH] Skip sending duplicate requests
|
||||
|
||||
Code fix to avoid sending duplicate SIM ON/OFF requests
|
||||
during device power-up.
|
||||
|
||||
Change-Id: Id7b496f09306712555e5f9f3828e739a26cb5aee
|
||||
CRs-Fixed: 2670662
|
||||
---
|
||||
|
||||
diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
|
||||
index ff8412f..f8d35b6 100644
|
||||
--- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java
|
||||
+++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
|
||||
@@ -4669,7 +4669,7 @@
|
||||
updateUiTtyMode(ttyMode);
|
||||
}
|
||||
|
||||
- private void reapplyUiccAppsEnablementIfNeeded(int retries) {
|
||||
+ protected void reapplyUiccAppsEnablementIfNeeded(int retries) {
|
||||
UiccSlot slot = mUiccController.getUiccSlotForPhone(mPhoneId);
|
||||
|
||||
// If no card is present or we don't have mUiccApplicationsEnabled yet, do nothing.
|
||||
42
frameworks/opt/telephony/007-11f6271.diff
Normal file
42
frameworks/opt/telephony/007-11f6271.diff
Normal file
@@ -0,0 +1,42 @@
|
||||
From 11f62715d87ab7251d3ff064bd9adf1d30965a20 Mon Sep 17 00:00:00 2001
|
||||
From: Sneh Bansal <snehb@codeaurora.org>
|
||||
Date: Fri, 19 Jan 2018 17:18:32 +0530
|
||||
Subject: [PATCH] Enable vendor Telephony plugin: MSIM Changes
|
||||
|
||||
MSIM Changes that are needed to enable vendor telephony framework.
|
||||
|
||||
CRs-Fixed: 2172757
|
||||
Change-Id: I80a46de96c34d5e2a4ce952830f6beb862522de5
|
||||
---
|
||||
|
||||
diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java
|
||||
index ff34cbe..eb8367b 100644
|
||||
--- a/src/java/com/android/internal/telephony/SubscriptionController.java
|
||||
+++ b/src/java/com/android/internal/telephony/SubscriptionController.java
|
||||
@@ -123,7 +123,7 @@
|
||||
*/
|
||||
public class SubscriptionController extends ISub.Stub {
|
||||
private static final String LOG_TAG = "SubscriptionController";
|
||||
- private static final boolean DBG = false;
|
||||
+ protected static final boolean DBG = false;
|
||||
private static final boolean VDBG = Rlog.isLoggable(LOG_TAG, Log.VERBOSE);
|
||||
private static final boolean DBG_CACHE = false;
|
||||
private static final int DEPRECATED_SETTING = -1;
|
||||
@@ -2963,7 +2963,7 @@
|
||||
}
|
||||
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
||||
- private void broadcastDefaultDataSubIdChanged(int subId) {
|
||||
+ protected void broadcastDefaultDataSubIdChanged(int subId) {
|
||||
// Broadcast an Intent for default data sub change
|
||||
if (DBG) logdl("[broadcastDefaultDataSubIdChanged] subId=" + subId);
|
||||
Intent intent = new Intent(TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED);
|
||||
@@ -4784,7 +4784,7 @@
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
- private void setGlobalSetting(String name, int value) {
|
||||
+ protected void setGlobalSetting(String name, int value) {
|
||||
Settings.Global.putInt(mContext.getContentResolver(), name, value);
|
||||
if (name == Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION) {
|
||||
invalidateDefaultDataSubIdCaches();
|
||||
620
hardware/xiaomi/0001-Add-dummy-sensors-sub-HAL.patch
Normal file
620
hardware/xiaomi/0001-Add-dummy-sensors-sub-HAL.patch
Normal file
@@ -0,0 +1,620 @@
|
||||
From 2843c0313a8b5f82fa54b344f3f01cc668db4fe5 Mon Sep 17 00:00:00 2001
|
||||
From: Cosmin Tanislav <demonsingur@gmail.com>
|
||||
Date: Wed, 16 Feb 2022 22:14:58 +0200
|
||||
Subject: [PATCH 01/10] Add dummy sensors sub HAL
|
||||
|
||||
Change-Id: Ie20ed775344990de3e16e2eefba1754d831027fb
|
||||
---
|
||||
sensors/Android.bp | 30 ++++++
|
||||
sensors/Sensor.cpp | 192 ++++++++++++++++++++++++++++++++++++++
|
||||
sensors/Sensor.h | 87 +++++++++++++++++
|
||||
sensors/SensorsSubHal.cpp | 160 +++++++++++++++++++++++++++++++
|
||||
sensors/SensorsSubHal.h | 95 +++++++++++++++++++
|
||||
5 files changed, 564 insertions(+)
|
||||
create mode 100644 sensors/Sensor.cpp
|
||||
create mode 100644 sensors/Sensor.h
|
||||
create mode 100644 sensors/SensorsSubHal.cpp
|
||||
create mode 100644 sensors/SensorsSubHal.h
|
||||
|
||||
diff --git a/sensors/Android.bp b/sensors/Android.bp
|
||||
index c897399..d9b1ddc 100644
|
||||
--- a/sensors/Android.bp
|
||||
+++ b/sensors/Android.bp
|
||||
@@ -4,6 +4,36 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
+cc_library_shared {
|
||||
+ name: "sensors.xiaomi",
|
||||
+ defaults: ["hidl_defaults"],
|
||||
+ srcs: [
|
||||
+ "Sensor.cpp",
|
||||
+ "SensorsSubHal.cpp",
|
||||
+ ],
|
||||
+ shared_libs: [
|
||||
+ "android.hardware.sensors@1.0",
|
||||
+ "android.hardware.sensors@2.0",
|
||||
+ "android.hardware.sensors@2.0-ScopedWakelock",
|
||||
+ "android.hardware.sensors@2.1",
|
||||
+ "libcutils",
|
||||
+ "libfmq",
|
||||
+ "libhardware",
|
||||
+ "libhidlbase",
|
||||
+ "liblog",
|
||||
+ "libpower",
|
||||
+ "libutils",
|
||||
+ ],
|
||||
+ static_libs: [
|
||||
+ "android.hardware.sensors@1.0-convert",
|
||||
+ "android.hardware.sensors@2.X-multihal",
|
||||
+ ],
|
||||
+ cflags: [
|
||||
+ "-DLOG_TAG=\"sensors.xiaomi\"",
|
||||
+ ],
|
||||
+ vendor: true,
|
||||
+}
|
||||
+
|
||||
cc_library_shared {
|
||||
name: "sensors.udfps",
|
||||
defaults: ["hidl_defaults"],
|
||||
diff --git a/sensors/Sensor.cpp b/sensors/Sensor.cpp
|
||||
new file mode 100644
|
||||
index 0000000..446a7e9
|
||||
--- /dev/null
|
||||
+++ b/sensors/Sensor.cpp
|
||||
@@ -0,0 +1,192 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2019 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.
|
||||
+ */
|
||||
+
|
||||
+#include "Sensor.h"
|
||||
+
|
||||
+#include <hardware/sensors.h>
|
||||
+#include <utils/SystemClock.h>
|
||||
+
|
||||
+#include <cmath>
|
||||
+
|
||||
+namespace android {
|
||||
+namespace hardware {
|
||||
+namespace sensors {
|
||||
+namespace V2_1 {
|
||||
+namespace subhal {
|
||||
+namespace implementation {
|
||||
+
|
||||
+using ::android::hardware::sensors::V1_0::MetaDataEventType;
|
||||
+using ::android::hardware::sensors::V1_0::OperationMode;
|
||||
+using ::android::hardware::sensors::V1_0::Result;
|
||||
+using ::android::hardware::sensors::V1_0::SensorFlagBits;
|
||||
+using ::android::hardware::sensors::V1_0::SensorStatus;
|
||||
+using ::android::hardware::sensors::V2_1::Event;
|
||||
+using ::android::hardware::sensors::V2_1::SensorInfo;
|
||||
+using ::android::hardware::sensors::V2_1::SensorType;
|
||||
+
|
||||
+Sensor::Sensor(int32_t sensorHandle, ISensorsEventCallback* callback)
|
||||
+ : mIsEnabled(false),
|
||||
+ mSamplingPeriodNs(0),
|
||||
+ mLastSampleTimeNs(0),
|
||||
+ mCallback(callback),
|
||||
+ mMode(OperationMode::NORMAL) {
|
||||
+ mSensorInfo.sensorHandle = sensorHandle;
|
||||
+ mSensorInfo.vendor = "The LineageOS Project";
|
||||
+ mSensorInfo.version = 1;
|
||||
+ constexpr float kDefaultMaxDelayUs = 1000 * 1000;
|
||||
+ mSensorInfo.maxDelay = kDefaultMaxDelayUs;
|
||||
+ mSensorInfo.fifoReservedEventCount = 0;
|
||||
+ mSensorInfo.fifoMaxEventCount = 0;
|
||||
+ mSensorInfo.requiredPermission = "";
|
||||
+ mSensorInfo.flags = 0;
|
||||
+ mRunThread = std::thread(startThread, this);
|
||||
+}
|
||||
+
|
||||
+Sensor::~Sensor() {
|
||||
+ // Ensure that lock is unlocked before calling mRunThread.join() or a
|
||||
+ // deadlock will occur.
|
||||
+ {
|
||||
+ std::unique_lock<std::mutex> lock(mRunMutex);
|
||||
+ mStopThread = true;
|
||||
+ mIsEnabled = false;
|
||||
+ mWaitCV.notify_all();
|
||||
+ }
|
||||
+ mRunThread.join();
|
||||
+}
|
||||
+
|
||||
+const SensorInfo& Sensor::getSensorInfo() const {
|
||||
+ return mSensorInfo;
|
||||
+}
|
||||
+
|
||||
+void Sensor::batch(int32_t samplingPeriodNs) {
|
||||
+ samplingPeriodNs =
|
||||
+ std::clamp(samplingPeriodNs, mSensorInfo.minDelay * 1000, mSensorInfo.maxDelay * 1000);
|
||||
+
|
||||
+ if (mSamplingPeriodNs != samplingPeriodNs) {
|
||||
+ mSamplingPeriodNs = samplingPeriodNs;
|
||||
+ // Wake up the 'run' thread to check if a new event should be generated now
|
||||
+ mWaitCV.notify_all();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void Sensor::activate(bool enable) {
|
||||
+ if (mIsEnabled != enable) {
|
||||
+ std::unique_lock<std::mutex> lock(mRunMutex);
|
||||
+ mIsEnabled = enable;
|
||||
+ mWaitCV.notify_all();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+Result Sensor::flush() {
|
||||
+ // Only generate a flush complete event if the sensor is enabled and if the sensor is not a
|
||||
+ // one-shot sensor.
|
||||
+ if (!mIsEnabled || (mSensorInfo.flags & static_cast<uint32_t>(SensorFlagBits::ONE_SHOT_MODE))) {
|
||||
+ return Result::BAD_VALUE;
|
||||
+ }
|
||||
+
|
||||
+ // Note: If a sensor supports batching, write all of the currently batched events for the sensor
|
||||
+ // to the Event FMQ prior to writing the flush complete event.
|
||||
+ Event ev;
|
||||
+ ev.sensorHandle = mSensorInfo.sensorHandle;
|
||||
+ ev.sensorType = SensorType::META_DATA;
|
||||
+ ev.u.meta.what = MetaDataEventType::META_DATA_FLUSH_COMPLETE;
|
||||
+ std::vector<Event> evs{ev};
|
||||
+ mCallback->postEvents(evs, isWakeUpSensor());
|
||||
+
|
||||
+ return Result::OK;
|
||||
+}
|
||||
+
|
||||
+void Sensor::startThread(Sensor* sensor) {
|
||||
+ sensor->run();
|
||||
+}
|
||||
+
|
||||
+void Sensor::run() {
|
||||
+ std::unique_lock<std::mutex> runLock(mRunMutex);
|
||||
+ constexpr int64_t kNanosecondsInSeconds = 1000 * 1000 * 1000;
|
||||
+
|
||||
+ while (!mStopThread) {
|
||||
+ if (!mIsEnabled || mMode == OperationMode::DATA_INJECTION) {
|
||||
+ mWaitCV.wait(runLock, [&] {
|
||||
+ return ((mIsEnabled && mMode == OperationMode::NORMAL) || mStopThread);
|
||||
+ });
|
||||
+ } else {
|
||||
+ timespec curTime;
|
||||
+ clock_gettime(CLOCK_REALTIME, &curTime);
|
||||
+ int64_t now = (curTime.tv_sec * kNanosecondsInSeconds) + curTime.tv_nsec;
|
||||
+ int64_t nextSampleTime = mLastSampleTimeNs + mSamplingPeriodNs;
|
||||
+
|
||||
+ if (now >= nextSampleTime) {
|
||||
+ mLastSampleTimeNs = now;
|
||||
+ nextSampleTime = mLastSampleTimeNs + mSamplingPeriodNs;
|
||||
+ mCallback->postEvents(readEvents(), isWakeUpSensor());
|
||||
+ }
|
||||
+
|
||||
+ mWaitCV.wait_for(runLock, std::chrono::nanoseconds(nextSampleTime - now));
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+bool Sensor::isWakeUpSensor() {
|
||||
+ return mSensorInfo.flags & static_cast<uint32_t>(SensorFlagBits::WAKE_UP);
|
||||
+}
|
||||
+
|
||||
+std::vector<Event> Sensor::readEvents() {
|
||||
+ std::vector<Event> events;
|
||||
+ Event event;
|
||||
+ event.sensorHandle = mSensorInfo.sensorHandle;
|
||||
+ event.sensorType = mSensorInfo.type;
|
||||
+ event.timestamp = ::android::elapsedRealtimeNano();
|
||||
+ event.u.vec3.x = 0;
|
||||
+ event.u.vec3.y = 0;
|
||||
+ event.u.vec3.z = 0;
|
||||
+ event.u.vec3.status = SensorStatus::ACCURACY_HIGH;
|
||||
+ events.push_back(event);
|
||||
+ return events;
|
||||
+}
|
||||
+
|
||||
+void Sensor::setOperationMode(OperationMode mode) {
|
||||
+ if (mMode != mode) {
|
||||
+ std::unique_lock<std::mutex> lock(mRunMutex);
|
||||
+ mMode = mode;
|
||||
+ mWaitCV.notify_all();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+bool Sensor::supportsDataInjection() const {
|
||||
+ return mSensorInfo.flags & static_cast<uint32_t>(SensorFlagBits::DATA_INJECTION);
|
||||
+}
|
||||
+
|
||||
+Result Sensor::injectEvent(const Event& event) {
|
||||
+ Result result = Result::OK;
|
||||
+ if (event.sensorType == SensorType::ADDITIONAL_INFO) {
|
||||
+ // When in OperationMode::NORMAL, SensorType::ADDITIONAL_INFO is used to push operation
|
||||
+ // environment data into the device.
|
||||
+ } else if (!supportsDataInjection()) {
|
||||
+ result = Result::INVALID_OPERATION;
|
||||
+ } else if (mMode == OperationMode::DATA_INJECTION) {
|
||||
+ mCallback->postEvents(std::vector<Event>{event}, isWakeUpSensor());
|
||||
+ } else {
|
||||
+ result = Result::BAD_VALUE;
|
||||
+ }
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+} // namespace implementation
|
||||
+} // namespace subhal
|
||||
+} // namespace V2_1
|
||||
+} // namespace sensors
|
||||
+} // namespace hardware
|
||||
+} // namespace android
|
||||
diff --git a/sensors/Sensor.h b/sensors/Sensor.h
|
||||
new file mode 100644
|
||||
index 0000000..7923820
|
||||
--- /dev/null
|
||||
+++ b/sensors/Sensor.h
|
||||
@@ -0,0 +1,87 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2019 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.
|
||||
+ */
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#include <android/hardware/sensors/2.1/types.h>
|
||||
+
|
||||
+#include <condition_variable>
|
||||
+#include <memory>
|
||||
+#include <mutex>
|
||||
+#include <thread>
|
||||
+#include <vector>
|
||||
+
|
||||
+using ::android::hardware::sensors::V1_0::OperationMode;
|
||||
+using ::android::hardware::sensors::V1_0::Result;
|
||||
+using ::android::hardware::sensors::V2_1::Event;
|
||||
+using ::android::hardware::sensors::V2_1::SensorInfo;
|
||||
+using ::android::hardware::sensors::V2_1::SensorType;
|
||||
+
|
||||
+namespace android {
|
||||
+namespace hardware {
|
||||
+namespace sensors {
|
||||
+namespace V2_1 {
|
||||
+namespace subhal {
|
||||
+namespace implementation {
|
||||
+
|
||||
+class ISensorsEventCallback {
|
||||
+ public:
|
||||
+ virtual ~ISensorsEventCallback(){};
|
||||
+ virtual void postEvents(const std::vector<Event>& events, bool wakeup) = 0;
|
||||
+};
|
||||
+
|
||||
+class Sensor {
|
||||
+ public:
|
||||
+ Sensor(int32_t sensorHandle, ISensorsEventCallback* callback);
|
||||
+ virtual ~Sensor();
|
||||
+
|
||||
+ const SensorInfo& getSensorInfo() const;
|
||||
+ void batch(int32_t samplingPeriodNs);
|
||||
+ virtual void activate(bool enable);
|
||||
+ Result flush();
|
||||
+
|
||||
+ void setOperationMode(OperationMode mode);
|
||||
+ bool supportsDataInjection() const;
|
||||
+ Result injectEvent(const Event& event);
|
||||
+
|
||||
+ protected:
|
||||
+ void run();
|
||||
+ virtual std::vector<Event> readEvents();
|
||||
+ static void startThread(Sensor* sensor);
|
||||
+
|
||||
+ bool isWakeUpSensor();
|
||||
+
|
||||
+ bool mIsEnabled;
|
||||
+ int64_t mSamplingPeriodNs;
|
||||
+ int64_t mLastSampleTimeNs;
|
||||
+ SensorInfo mSensorInfo;
|
||||
+
|
||||
+ std::atomic_bool mStopThread;
|
||||
+ std::condition_variable mWaitCV;
|
||||
+ std::mutex mRunMutex;
|
||||
+ std::thread mRunThread;
|
||||
+
|
||||
+ ISensorsEventCallback* mCallback;
|
||||
+
|
||||
+ OperationMode mMode;
|
||||
+};
|
||||
+
|
||||
+} // namespace implementation
|
||||
+} // namespace subhal
|
||||
+} // namespace V2_1
|
||||
+} // namespace sensors
|
||||
+} // namespace hardware
|
||||
+} // namespace android
|
||||
diff --git a/sensors/SensorsSubHal.cpp b/sensors/SensorsSubHal.cpp
|
||||
new file mode 100644
|
||||
index 0000000..6cbcb56
|
||||
--- /dev/null
|
||||
+++ b/sensors/SensorsSubHal.cpp
|
||||
@@ -0,0 +1,160 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2019 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.
|
||||
+ */
|
||||
+
|
||||
+#include "SensorsSubHal.h"
|
||||
+
|
||||
+#include <android/hardware/sensors/2.1/types.h>
|
||||
+#include <log/log.h>
|
||||
+
|
||||
+using ::android::hardware::sensors::V2_1::implementation::ISensorsSubHal;
|
||||
+using ::android::hardware::sensors::V2_1::subhal::implementation::SensorsSubHal;
|
||||
+
|
||||
+namespace android {
|
||||
+namespace hardware {
|
||||
+namespace sensors {
|
||||
+namespace V2_1 {
|
||||
+namespace subhal {
|
||||
+namespace implementation {
|
||||
+
|
||||
+using ::android::hardware::Void;
|
||||
+using ::android::hardware::sensors::V2_0::implementation::ScopedWakelock;
|
||||
+
|
||||
+SensorsSubHal::SensorsSubHal() : mCallback(nullptr), mNextHandle(1) {}
|
||||
+
|
||||
+Return<void> SensorsSubHal::getSensorsList_2_1(ISensors::getSensorsList_2_1_cb _hidl_cb) {
|
||||
+ std::vector<SensorInfo> sensors;
|
||||
+ for (const auto& sensor : mSensors) {
|
||||
+ sensors.push_back(sensor.second->getSensorInfo());
|
||||
+ }
|
||||
+ _hidl_cb(sensors);
|
||||
+ return Void();
|
||||
+}
|
||||
+
|
||||
+Return<Result> SensorsSubHal::setOperationMode(OperationMode mode) {
|
||||
+ for (auto sensor : mSensors) {
|
||||
+ sensor.second->setOperationMode(mode);
|
||||
+ }
|
||||
+ mCurrentOperationMode = mode;
|
||||
+ return Result::OK;
|
||||
+}
|
||||
+
|
||||
+Return<Result> SensorsSubHal::activate(int32_t sensorHandle, bool enabled) {
|
||||
+ auto sensor = mSensors.find(sensorHandle);
|
||||
+ if (sensor != mSensors.end()) {
|
||||
+ sensor->second->activate(enabled);
|
||||
+ return Result::OK;
|
||||
+ }
|
||||
+ return Result::BAD_VALUE;
|
||||
+}
|
||||
+
|
||||
+Return<Result> SensorsSubHal::batch(int32_t sensorHandle, int64_t samplingPeriodNs,
|
||||
+ int64_t /* maxReportLatencyNs */) {
|
||||
+ auto sensor = mSensors.find(sensorHandle);
|
||||
+ if (sensor != mSensors.end()) {
|
||||
+ sensor->second->batch(samplingPeriodNs);
|
||||
+ return Result::OK;
|
||||
+ }
|
||||
+ return Result::BAD_VALUE;
|
||||
+}
|
||||
+
|
||||
+Return<Result> SensorsSubHal::flush(int32_t sensorHandle) {
|
||||
+ auto sensor = mSensors.find(sensorHandle);
|
||||
+ if (sensor != mSensors.end()) {
|
||||
+ return sensor->second->flush();
|
||||
+ }
|
||||
+ return Result::BAD_VALUE;
|
||||
+}
|
||||
+
|
||||
+Return<Result> SensorsSubHal::injectSensorData_2_1(const Event& event) {
|
||||
+ auto sensor = mSensors.find(event.sensorHandle);
|
||||
+ if (sensor != mSensors.end()) {
|
||||
+ return sensor->second->injectEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ return Result::BAD_VALUE;
|
||||
+}
|
||||
+
|
||||
+Return<void> SensorsSubHal::registerDirectChannel(const SharedMemInfo& /* mem */,
|
||||
+ ISensors::registerDirectChannel_cb _hidl_cb) {
|
||||
+ _hidl_cb(Result::INVALID_OPERATION, -1 /* channelHandle */);
|
||||
+ return Return<void>();
|
||||
+}
|
||||
+
|
||||
+Return<Result> SensorsSubHal::unregisterDirectChannel(int32_t /* channelHandle */) {
|
||||
+ return Result::INVALID_OPERATION;
|
||||
+}
|
||||
+
|
||||
+Return<void> SensorsSubHal::configDirectReport(int32_t /* sensorHandle */,
|
||||
+ int32_t /* channelHandle */, RateLevel /* rate */,
|
||||
+ ISensors::configDirectReport_cb _hidl_cb) {
|
||||
+ _hidl_cb(Result::INVALID_OPERATION, 0 /* reportToken */);
|
||||
+ return Return<void>();
|
||||
+}
|
||||
+
|
||||
+Return<void> SensorsSubHal::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& args) {
|
||||
+ if (fd.getNativeHandle() == nullptr || fd->numFds < 1) {
|
||||
+ ALOGE("%s: missing fd for writing", __FUNCTION__);
|
||||
+ return Void();
|
||||
+ }
|
||||
+
|
||||
+ FILE* out = fdopen(dup(fd->data[0]), "w");
|
||||
+
|
||||
+ if (args.size() != 0) {
|
||||
+ fprintf(out,
|
||||
+ "Note: sub-HAL %s currently does not support args. Input arguments are "
|
||||
+ "ignored.\n",
|
||||
+ getName().c_str());
|
||||
+ }
|
||||
+
|
||||
+ std::ostringstream stream;
|
||||
+ stream << "Available sensors:" << std::endl;
|
||||
+ for (auto sensor : mSensors) {
|
||||
+ SensorInfo info = sensor.second->getSensorInfo();
|
||||
+ stream << "Name: " << info.name << std::endl;
|
||||
+ stream << "Min delay: " << info.minDelay << std::endl;
|
||||
+ stream << "Flags: " << info.flags << std::endl;
|
||||
+ }
|
||||
+ stream << std::endl;
|
||||
+
|
||||
+ fprintf(out, "%s", stream.str().c_str());
|
||||
+
|
||||
+ fclose(out);
|
||||
+ return Return<void>();
|
||||
+}
|
||||
+
|
||||
+Return<Result> SensorsSubHal::initialize(const sp<IHalProxyCallback>& halProxyCallback) {
|
||||
+ mCallback = halProxyCallback;
|
||||
+ setOperationMode(OperationMode::NORMAL);
|
||||
+ return Result::OK;
|
||||
+}
|
||||
+
|
||||
+void SensorsSubHal::postEvents(const std::vector<Event>& events, bool wakeup) {
|
||||
+ ScopedWakelock wakelock = mCallback->createScopedWakelock(wakeup);
|
||||
+ mCallback->postEvents(events, std::move(wakelock));
|
||||
+}
|
||||
+
|
||||
+} // namespace implementation
|
||||
+} // namespace subhal
|
||||
+} // namespace V2_1
|
||||
+} // namespace sensors
|
||||
+} // namespace hardware
|
||||
+} // namespace android
|
||||
+
|
||||
+ISensorsSubHal* sensorsHalGetSubHal_2_1(uint32_t* version) {
|
||||
+ static SensorsSubHal subHal;
|
||||
+ *version = SUB_HAL_2_1_VERSION;
|
||||
+ return &subHal;
|
||||
+}
|
||||
diff --git a/sensors/SensorsSubHal.h b/sensors/SensorsSubHal.h
|
||||
new file mode 100644
|
||||
index 0000000..7ac9ac2
|
||||
--- /dev/null
|
||||
+++ b/sensors/SensorsSubHal.h
|
||||
@@ -0,0 +1,95 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2019 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.
|
||||
+ */
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#include <vector>
|
||||
+
|
||||
+#include "Sensor.h"
|
||||
+#include "V2_1/SubHal.h"
|
||||
+
|
||||
+namespace android {
|
||||
+namespace hardware {
|
||||
+namespace sensors {
|
||||
+namespace V2_1 {
|
||||
+namespace subhal {
|
||||
+namespace implementation {
|
||||
+
|
||||
+using ::android::hardware::sensors::V1_0::OperationMode;
|
||||
+using ::android::hardware::sensors::V1_0::RateLevel;
|
||||
+using ::android::hardware::sensors::V1_0::Result;
|
||||
+using ::android::hardware::sensors::V1_0::SharedMemInfo;
|
||||
+using ::android::hardware::sensors::V2_1::Event;
|
||||
+using ::android::hardware::sensors::V2_1::implementation::IHalProxyCallback;
|
||||
+using ::android::hardware::sensors::V2_1::implementation::ISensorsSubHal;
|
||||
+
|
||||
+class SensorsSubHal : public ISensorsSubHal, public ISensorsEventCallback {
|
||||
+ public:
|
||||
+ SensorsSubHal();
|
||||
+
|
||||
+ Return<void> getSensorsList_2_1(ISensors::getSensorsList_2_1_cb _hidl_cb);
|
||||
+ Return<Result> injectSensorData_2_1(const Event& event);
|
||||
+ Return<Result> initialize(const sp<IHalProxyCallback>& halProxyCallback);
|
||||
+
|
||||
+ virtual Return<Result> setOperationMode(OperationMode mode);
|
||||
+
|
||||
+ OperationMode getOperationMode() const { return mCurrentOperationMode; }
|
||||
+
|
||||
+ Return<Result> activate(int32_t sensorHandle, bool enabled);
|
||||
+
|
||||
+ Return<Result> batch(int32_t sensorHandle, int64_t samplingPeriodNs,
|
||||
+ int64_t maxReportLatencyNs);
|
||||
+
|
||||
+ Return<Result> flush(int32_t sensorHandle);
|
||||
+
|
||||
+ Return<void> registerDirectChannel(const SharedMemInfo& mem,
|
||||
+ ISensors::registerDirectChannel_cb _hidl_cb);
|
||||
+
|
||||
+ Return<Result> unregisterDirectChannel(int32_t channelHandle);
|
||||
+
|
||||
+ Return<void> configDirectReport(int32_t sensorHandle, int32_t channelHandle, RateLevel rate,
|
||||
+ ISensors::configDirectReport_cb _hidl_cb);
|
||||
+
|
||||
+ Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& args);
|
||||
+
|
||||
+ const std::string getName() { return "FakeSubHal"; }
|
||||
+
|
||||
+ void postEvents(const std::vector<Event>& events, bool wakeup) override;
|
||||
+
|
||||
+ protected:
|
||||
+ template <class SensorType>
|
||||
+ void AddSensor() {
|
||||
+ std::shared_ptr<SensorType> sensor =
|
||||
+ std::make_shared<SensorType>(mNextHandle++ /* sensorHandle */, this /* callback */);
|
||||
+ mSensors[sensor->getSensorInfo().sensorHandle] = sensor;
|
||||
+ }
|
||||
+
|
||||
+ std::map<int32_t, std::shared_ptr<Sensor>> mSensors;
|
||||
+
|
||||
+ sp<IHalProxyCallback> mCallback;
|
||||
+
|
||||
+ private:
|
||||
+ OperationMode mCurrentOperationMode = OperationMode::NORMAL;
|
||||
+
|
||||
+ int32_t mNextHandle;
|
||||
+};
|
||||
+
|
||||
+} // namespace implementation
|
||||
+} // namespace subhal
|
||||
+} // namespace V2_1
|
||||
+} // namespace sensors
|
||||
+} // namespace hardware
|
||||
+} // namespace android
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From e6f404fece4e39b5be00a7e82632b245cd007b2c Mon Sep 17 00:00:00 2001
|
||||
From: Cosmin Tanislav <demonsingur@gmail.com>
|
||||
Date: Thu, 17 Feb 2022 01:04:37 +0200
|
||||
Subject: [PATCH 02/10] sensors: Make sensor batch function virtual
|
||||
|
||||
Change-Id: I2de1e919234c4893b0b70390c0189cae38dbbe6c
|
||||
---
|
||||
sensors/Sensor.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sensors/Sensor.h b/sensors/Sensor.h
|
||||
index 7923820..6643083 100644
|
||||
--- a/sensors/Sensor.h
|
||||
+++ b/sensors/Sensor.h
|
||||
@@ -49,7 +49,7 @@ class Sensor {
|
||||
virtual ~Sensor();
|
||||
|
||||
const SensorInfo& getSensorInfo() const;
|
||||
- void batch(int32_t samplingPeriodNs);
|
||||
+ virtual void batch(int32_t samplingPeriodNs);
|
||||
virtual void activate(bool enable);
|
||||
Result flush();
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 1088f413cc85c735acc652d1b69252a2c1ea2bba Mon Sep 17 00:00:00 2001
|
||||
From: Cosmin Tanislav <demonsingur@gmail.com>
|
||||
Date: Thu, 17 Feb 2022 01:04:44 +0200
|
||||
Subject: [PATCH 03/10] sensors: Make sensor run function virtual
|
||||
|
||||
Change-Id: Ie50900903bbf4a302baff084f229c37c5c324742
|
||||
---
|
||||
sensors/Sensor.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sensors/Sensor.h b/sensors/Sensor.h
|
||||
index 6643083..8a7153a 100644
|
||||
--- a/sensors/Sensor.h
|
||||
+++ b/sensors/Sensor.h
|
||||
@@ -58,7 +58,7 @@ class Sensor {
|
||||
Result injectEvent(const Event& event);
|
||||
|
||||
protected:
|
||||
- void run();
|
||||
+ virtual void run();
|
||||
virtual std::vector<Event> readEvents();
|
||||
static void startThread(Sensor* sensor);
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From b856ada4457b884c2890d4ddfbf415c51765787f Mon Sep 17 00:00:00 2001
|
||||
From: Cosmin Tanislav <demonsingur@gmail.com>
|
||||
Date: Thu, 17 Feb 2022 01:06:04 +0200
|
||||
Subject: [PATCH 04/10] sensors: Make sensor flush function virtual
|
||||
|
||||
Change-Id: I46532fc726d9e0c2073100ff1f6008fcde9e821c
|
||||
---
|
||||
sensors/Sensor.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sensors/Sensor.h b/sensors/Sensor.h
|
||||
index 8a7153a..3c508c5 100644
|
||||
--- a/sensors/Sensor.h
|
||||
+++ b/sensors/Sensor.h
|
||||
@@ -51,7 +51,7 @@ class Sensor {
|
||||
const SensorInfo& getSensorInfo() const;
|
||||
virtual void batch(int32_t samplingPeriodNs);
|
||||
virtual void activate(bool enable);
|
||||
- Result flush();
|
||||
+ virtual Result flush();
|
||||
|
||||
void setOperationMode(OperationMode mode);
|
||||
bool supportsDataInjection() const;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From 012799cb2f69ca2e8a8a6e34b3b191c653da1ae6 Mon Sep 17 00:00:00 2001
|
||||
From: Cosmin Tanislav <demonsingur@gmail.com>
|
||||
Date: Sun, 20 Feb 2022 00:51:21 +0200
|
||||
Subject: [PATCH 05/10] sensors: Make sensor set mode operation function
|
||||
virtual
|
||||
|
||||
Change-Id: I62c94a6ad250417162cfc9eaca8cb490ce650d9c
|
||||
---
|
||||
sensors/Sensor.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sensors/Sensor.h b/sensors/Sensor.h
|
||||
index 3c508c5..7666cb4 100644
|
||||
--- a/sensors/Sensor.h
|
||||
+++ b/sensors/Sensor.h
|
||||
@@ -53,7 +53,7 @@ class Sensor {
|
||||
virtual void activate(bool enable);
|
||||
virtual Result flush();
|
||||
|
||||
- void setOperationMode(OperationMode mode);
|
||||
+ virtual void setOperationMode(OperationMode mode);
|
||||
bool supportsDataInjection() const;
|
||||
Result injectEvent(const Event& event);
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
From 4fe1ac6fb8fe97b2698d09f425627771abbd0625 Mon Sep 17 00:00:00 2001
|
||||
From: Cosmin Tanislav <demonsingur@gmail.com>
|
||||
Date: Thu, 17 Feb 2022 01:08:50 +0200
|
||||
Subject: [PATCH 06/10] sensors: Move one shot sensor out of main class
|
||||
|
||||
Change-Id: Ib7ac0c55409f2dc7f8fb114167e9f4b2e8859223
|
||||
---
|
||||
sensors/Sensor.cpp | 9 ++++++++-
|
||||
sensors/Sensor.h | 9 +++++++++
|
||||
2 files changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sensors/Sensor.cpp b/sensors/Sensor.cpp
|
||||
index 446a7e9..2b8e1aa 100644
|
||||
--- a/sensors/Sensor.cpp
|
||||
+++ b/sensors/Sensor.cpp
|
||||
@@ -93,7 +93,7 @@ void Sensor::activate(bool enable) {
|
||||
Result Sensor::flush() {
|
||||
// Only generate a flush complete event if the sensor is enabled and if the sensor is not a
|
||||
// one-shot sensor.
|
||||
- if (!mIsEnabled || (mSensorInfo.flags & static_cast<uint32_t>(SensorFlagBits::ONE_SHOT_MODE))) {
|
||||
+ if (!mIsEnabled) {
|
||||
return Result::BAD_VALUE;
|
||||
}
|
||||
|
||||
@@ -184,6 +184,13 @@ Result Sensor::injectEvent(const Event& event) {
|
||||
return result;
|
||||
}
|
||||
|
||||
+OneShotSensor::OneShotSensor(int32_t sensorHandle, ISensorsEventCallback* callback)
|
||||
+ : Sensor(sensorHandle, callback) {
|
||||
+ mSensorInfo.minDelay = -1;
|
||||
+ mSensorInfo.maxDelay = 0;
|
||||
+ mSensorInfo.flags |= SensorFlagBits::ONE_SHOT_MODE;
|
||||
+}
|
||||
+
|
||||
} // namespace implementation
|
||||
} // namespace subhal
|
||||
} // namespace V2_1
|
||||
diff --git a/sensors/Sensor.h b/sensors/Sensor.h
|
||||
index 7666cb4..b7cd4a5 100644
|
||||
--- a/sensors/Sensor.h
|
||||
+++ b/sensors/Sensor.h
|
||||
@@ -79,6 +79,15 @@ class Sensor {
|
||||
OperationMode mMode;
|
||||
};
|
||||
|
||||
+class OneShotSensor : public Sensor {
|
||||
+ public:
|
||||
+ OneShotSensor(int32_t sensorHandle, ISensorsEventCallback* callback);
|
||||
+
|
||||
+ virtual void batch(int32_t /* samplingPeriodNs */) override {}
|
||||
+
|
||||
+ virtual Result flush() override { return Result::BAD_VALUE; }
|
||||
+};
|
||||
+
|
||||
} // namespace implementation
|
||||
} // namespace subhal
|
||||
} // namespace V2_1
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From ae334ea8a2706737212c9e00ff6279cd836af640 Mon Sep 17 00:00:00 2001
|
||||
From: Cosmin Tanislav <demonsingur@gmail.com>
|
||||
Date: Sat, 19 Feb 2022 23:34:29 +0200
|
||||
Subject: [PATCH 07/10] sensors: Fix locking around setOperationMode and
|
||||
activate
|
||||
|
||||
Change-Id: I9a09f45f012662c8f92fa40da3a4b9dd691a1b2c
|
||||
---
|
||||
sensors/Sensor.cpp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/sensors/Sensor.cpp b/sensors/Sensor.cpp
|
||||
index 2b8e1aa..dcf5b75 100644
|
||||
--- a/sensors/Sensor.cpp
|
||||
+++ b/sensors/Sensor.cpp
|
||||
@@ -83,8 +83,8 @@ void Sensor::batch(int32_t samplingPeriodNs) {
|
||||
}
|
||||
|
||||
void Sensor::activate(bool enable) {
|
||||
+ std::lock_guard<std::mutex> lock(mRunMutex);
|
||||
if (mIsEnabled != enable) {
|
||||
- std::unique_lock<std::mutex> lock(mRunMutex);
|
||||
mIsEnabled = enable;
|
||||
mWaitCV.notify_all();
|
||||
}
|
||||
@@ -158,8 +158,8 @@ std::vector<Event> Sensor::readEvents() {
|
||||
}
|
||||
|
||||
void Sensor::setOperationMode(OperationMode mode) {
|
||||
+ std::lock_guard<std::mutex> lock(mRunMutex);
|
||||
if (mMode != mode) {
|
||||
- std::unique_lock<std::mutex> lock(mRunMutex);
|
||||
mMode = mode;
|
||||
mWaitCV.notify_all();
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
239
hardware/xiaomi/0008-sensors-Add-udfps-long-press-sensor.patch
Normal file
239
hardware/xiaomi/0008-sensors-Add-udfps-long-press-sensor.patch
Normal file
@@ -0,0 +1,239 @@
|
||||
From 2ab6db384c58652b61c1ff70fc9901b0d4202734 Mon Sep 17 00:00:00 2001
|
||||
From: Cosmin Tanislav <demonsingur@gmail.com>
|
||||
Date: Sun, 20 Feb 2022 19:34:44 +0200
|
||||
Subject: [PATCH 08/10] sensors: Add udfps long press sensor
|
||||
|
||||
Co-authored-by: LuK1337 <priv.luk@gmail.com>
|
||||
Change-Id: Ie78d7729201836bacd65a57f76e22adb61159192
|
||||
---
|
||||
sensors/Sensor.cpp | 142 ++++++++++++++++++++++++++++++++++++++
|
||||
sensors/Sensor.h | 26 +++++++
|
||||
sensors/SensorsSubHal.cpp | 4 +-
|
||||
3 files changed, 171 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sensors/Sensor.cpp b/sensors/Sensor.cpp
|
||||
index dcf5b75..2982513 100644
|
||||
--- a/sensors/Sensor.cpp
|
||||
+++ b/sensors/Sensor.cpp
|
||||
@@ -17,10 +17,41 @@
|
||||
#include "Sensor.h"
|
||||
|
||||
#include <hardware/sensors.h>
|
||||
+#include <log/log.h>
|
||||
#include <utils/SystemClock.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
+namespace {
|
||||
+
|
||||
+static bool readFpState(int fd, int& screenX, int& screenY) {
|
||||
+ char buffer[512];
|
||||
+ int state = 0;
|
||||
+ int rc;
|
||||
+
|
||||
+ rc = lseek(fd, 0, SEEK_SET);
|
||||
+ if (rc) {
|
||||
+ ALOGE("failed to seek: %d", rc);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ rc = read(fd, &buffer, sizeof(buffer));
|
||||
+ if (rc < 0) {
|
||||
+ ALOGE("failed to read state: %d", rc);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ rc = sscanf(buffer, "%d,%d,%d", &screenX, &screenY, &state);
|
||||
+ if (rc < 0) {
|
||||
+ ALOGE("failed to parse fp state: %d", rc);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return state > 0;
|
||||
+}
|
||||
+
|
||||
+} // anonymous namespace
|
||||
+
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace sensors {
|
||||
@@ -191,6 +222,117 @@ OneShotSensor::OneShotSensor(int32_t sensorHandle, ISensorsEventCallback* callba
|
||||
mSensorInfo.flags |= SensorFlagBits::ONE_SHOT_MODE;
|
||||
}
|
||||
|
||||
+UdfpsSensor::UdfpsSensor(int32_t sensorHandle, ISensorsEventCallback* callback)
|
||||
+ : OneShotSensor(sensorHandle, callback) {
|
||||
+ mSensorInfo.name = "UDFPS Sensor";
|
||||
+ mSensorInfo.type =
|
||||
+ static_cast<SensorType>(static_cast<int32_t>(SensorType::DEVICE_PRIVATE_BASE) + 1);
|
||||
+ mSensorInfo.typeAsString = "org.lineageos.sensor.udfps";
|
||||
+ mSensorInfo.maxRange = 2048.0f;
|
||||
+ mSensorInfo.resolution = 1.0f;
|
||||
+ mSensorInfo.power = 0;
|
||||
+ mSensorInfo.flags |= SensorFlagBits::WAKE_UP;
|
||||
+
|
||||
+ int rc;
|
||||
+
|
||||
+ rc = pipe(mWaitPipeFd);
|
||||
+ if (rc < 0) {
|
||||
+ mWaitPipeFd[0] = -1;
|
||||
+ mWaitPipeFd[1] = -1;
|
||||
+ ALOGE("failed to open wait pipe: %d", rc);
|
||||
+ }
|
||||
+
|
||||
+ mPollFd = open("/sys/devices/virtual/touch/touch_dev/fod_press_status", O_RDONLY);
|
||||
+ if (mPollFd < 0) {
|
||||
+ ALOGE("failed to open poll fd: %d", mPollFd);
|
||||
+ }
|
||||
+
|
||||
+ if (mWaitPipeFd[0] < 0 || mWaitPipeFd[1] < 0 || mPollFd < 0) {
|
||||
+ mStopThread = true;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ mPolls[0] = {
|
||||
+ .fd = mWaitPipeFd[0],
|
||||
+ .events = POLLIN,
|
||||
+ };
|
||||
+
|
||||
+ mPolls[1] = {
|
||||
+ .fd = mPollFd,
|
||||
+ .events = POLLERR | POLLPRI,
|
||||
+ };
|
||||
+}
|
||||
+
|
||||
+UdfpsSensor::~UdfpsSensor() {
|
||||
+ interruptPoll();
|
||||
+}
|
||||
+
|
||||
+void UdfpsSensor::activate(bool enable) {
|
||||
+ std::lock_guard<std::mutex> lock(mRunMutex);
|
||||
+
|
||||
+ if (mIsEnabled != enable) {
|
||||
+ mIsEnabled = enable;
|
||||
+
|
||||
+ interruptPoll();
|
||||
+ mWaitCV.notify_all();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void UdfpsSensor::setOperationMode(OperationMode mode) {
|
||||
+ Sensor::setOperationMode(mode);
|
||||
+ interruptPoll();
|
||||
+}
|
||||
+
|
||||
+void UdfpsSensor::run() {
|
||||
+ std::unique_lock<std::mutex> runLock(mRunMutex);
|
||||
+
|
||||
+ while (!mStopThread) {
|
||||
+ if (!mIsEnabled || mMode == OperationMode::DATA_INJECTION) {
|
||||
+ mWaitCV.wait(runLock, [&] {
|
||||
+ return ((mIsEnabled && mMode == OperationMode::NORMAL) || mStopThread);
|
||||
+ });
|
||||
+ } else {
|
||||
+ // Cannot hold lock while polling.
|
||||
+ runLock.unlock();
|
||||
+ int rc = poll(mPolls, 2, -1);
|
||||
+ runLock.lock();
|
||||
+
|
||||
+ if (rc < 0) {
|
||||
+ ALOGE("failed to poll: %d", rc);
|
||||
+ mStopThread = true;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (mPolls[1].revents == mPolls[1].events && readFpState(mPollFd, mScreenX, mScreenY)) {
|
||||
+ mIsEnabled = false;
|
||||
+ mCallback->postEvents(readEvents(), isWakeUpSensor());
|
||||
+ } else if (mPolls[0].revents == mPolls[0].events) {
|
||||
+ char buf;
|
||||
+ read(mWaitPipeFd[0], &buf, sizeof(buf));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+std::vector<Event> UdfpsSensor::readEvents() {
|
||||
+ std::vector<Event> events;
|
||||
+ Event event;
|
||||
+ event.sensorHandle = mSensorInfo.sensorHandle;
|
||||
+ event.sensorType = mSensorInfo.type;
|
||||
+ event.timestamp = ::android::elapsedRealtimeNano();
|
||||
+ event.u.data[0] = mScreenX;
|
||||
+ event.u.data[1] = mScreenY;
|
||||
+ events.push_back(event);
|
||||
+ return events;
|
||||
+}
|
||||
+
|
||||
+void UdfpsSensor::interruptPoll() {
|
||||
+ if (mWaitPipeFd[1] < 0) return;
|
||||
+
|
||||
+ char c = '1';
|
||||
+ write(mWaitPipeFd[1], &c, sizeof(c));
|
||||
+}
|
||||
+
|
||||
} // namespace implementation
|
||||
} // namespace subhal
|
||||
} // namespace V2_1
|
||||
diff --git a/sensors/Sensor.h b/sensors/Sensor.h
|
||||
index b7cd4a5..aa1f194 100644
|
||||
--- a/sensors/Sensor.h
|
||||
+++ b/sensors/Sensor.h
|
||||
@@ -17,6 +17,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <android/hardware/sensors/2.1/types.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <poll.h>
|
||||
+#include <unistd.h>
|
||||
|
||||
#include <condition_variable>
|
||||
#include <memory>
|
||||
@@ -88,6 +91,29 @@ class OneShotSensor : public Sensor {
|
||||
virtual Result flush() override { return Result::BAD_VALUE; }
|
||||
};
|
||||
|
||||
+class UdfpsSensor : public OneShotSensor {
|
||||
+ public:
|
||||
+ UdfpsSensor(int32_t sensorHandle, ISensorsEventCallback* callback);
|
||||
+ virtual ~UdfpsSensor() override;
|
||||
+
|
||||
+ virtual void activate(bool enable) override;
|
||||
+ virtual void setOperationMode(OperationMode mode) override;
|
||||
+
|
||||
+ protected:
|
||||
+ virtual void run() override;
|
||||
+ virtual std::vector<Event> readEvents();
|
||||
+
|
||||
+ private:
|
||||
+ void interruptPoll();
|
||||
+
|
||||
+ struct pollfd mPolls[2];
|
||||
+ int mWaitPipeFd[2];
|
||||
+ int mPollFd;
|
||||
+
|
||||
+ int mScreenX;
|
||||
+ int mScreenY;
|
||||
+};
|
||||
+
|
||||
} // namespace implementation
|
||||
} // namespace subhal
|
||||
} // namespace V2_1
|
||||
diff --git a/sensors/SensorsSubHal.cpp b/sensors/SensorsSubHal.cpp
|
||||
index 6cbcb56..9306b98 100644
|
||||
--- a/sensors/SensorsSubHal.cpp
|
||||
+++ b/sensors/SensorsSubHal.cpp
|
||||
@@ -32,7 +32,9 @@ namespace implementation {
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::sensors::V2_0::implementation::ScopedWakelock;
|
||||
|
||||
-SensorsSubHal::SensorsSubHal() : mCallback(nullptr), mNextHandle(1) {}
|
||||
+SensorsSubHal::SensorsSubHal() : mCallback(nullptr), mNextHandle(1) {
|
||||
+ AddSensor<UdfpsSensor>();
|
||||
+}
|
||||
|
||||
Return<void> SensorsSubHal::getSensorsList_2_1(ISensors::getSensorsList_2_1_cb _hidl_cb) {
|
||||
std::vector<SensorInfo> sensors;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 946d086e74452d4c948f8b64afe3b082291c75a5 Mon Sep 17 00:00:00 2001
|
||||
From: Arian <arian.kulmer@web.de>
|
||||
Date: Wed, 29 Mar 2023 17:38:34 +0200
|
||||
Subject: [PATCH 09/10] sensors: Handle fod press status without coordinates
|
||||
|
||||
Also fix the error handling of sscanf which returns the
|
||||
number of matched variables on partial success.
|
||||
|
||||
Change-Id: I785c0e3f73e89f79addcf18e1b5111e93e25e430
|
||||
---
|
||||
sensors/Sensor.cpp | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sensors/Sensor.cpp b/sensors/Sensor.cpp
|
||||
index 2982513..6c1c5e4 100644
|
||||
--- a/sensors/Sensor.cpp
|
||||
+++ b/sensors/Sensor.cpp
|
||||
@@ -42,7 +42,13 @@ static bool readFpState(int fd, int& screenX, int& screenY) {
|
||||
}
|
||||
|
||||
rc = sscanf(buffer, "%d,%d,%d", &screenX, &screenY, &state);
|
||||
- if (rc < 0) {
|
||||
+ if (rc == 1) {
|
||||
+ // If only the first variable can be matched assume
|
||||
+ // that the node only reports the state
|
||||
+ state = screenX;
|
||||
+ screenX = 0;
|
||||
+ screenY = 0;
|
||||
+ } else if (rc < 3) {
|
||||
ALOGE("failed to parse fp state: %d", rc);
|
||||
return false;
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
From 17c39edbeb39b2a28567c8224608216c90010cda Mon Sep 17 00:00:00 2001
|
||||
From: Arian <arian.kulmer@web.de>
|
||||
Date: Wed, 2 Aug 2023 09:36:52 +0200
|
||||
Subject: [PATCH 10/10] hidl: biometrics: fingerprint: Add enroll methods to
|
||||
udfps handler
|
||||
|
||||
Change-Id: I1b73438ae6bf7e2c0b3fe6d2ca7726993604454b
|
||||
---
|
||||
hidl/biometrics/fingerprint/BiometricsFingerprint.cpp | 9 +++++++++
|
||||
hidl/biometrics/fingerprint/include/UdfpsHandler.h | 5 +++++
|
||||
2 files changed, 14 insertions(+)
|
||||
|
||||
diff --git a/hidl/biometrics/fingerprint/BiometricsFingerprint.cpp b/hidl/biometrics/fingerprint/BiometricsFingerprint.cpp
|
||||
index 9303e08..b305f35 100644
|
||||
--- a/hidl/biometrics/fingerprint/BiometricsFingerprint.cpp
|
||||
+++ b/hidl/biometrics/fingerprint/BiometricsFingerprint.cpp
|
||||
@@ -209,16 +209,25 @@ Return<uint64_t> BiometricsFingerprint::setNotify(
|
||||
}
|
||||
|
||||
Return<uint64_t> BiometricsFingerprint::preEnroll() {
|
||||
+ if (mUdfpsHandler) {
|
||||
+ mUdfpsHandler->preEnroll();
|
||||
+ }
|
||||
return mDevice->pre_enroll(mDevice);
|
||||
}
|
||||
|
||||
Return<RequestStatus> BiometricsFingerprint::enroll(const hidl_array<uint8_t, 69>& hat,
|
||||
uint32_t gid, uint32_t timeoutSec) {
|
||||
+ if (mUdfpsHandler) {
|
||||
+ mUdfpsHandler->enroll();
|
||||
+ }
|
||||
const hw_auth_token_t* authToken = reinterpret_cast<const hw_auth_token_t*>(hat.data());
|
||||
return ErrorFilter(mDevice->enroll(mDevice, authToken, gid, timeoutSec));
|
||||
}
|
||||
|
||||
Return<RequestStatus> BiometricsFingerprint::postEnroll() {
|
||||
+ if (mUdfpsHandler) {
|
||||
+ mUdfpsHandler->postEnroll();
|
||||
+ }
|
||||
return ErrorFilter(mDevice->post_enroll(mDevice));
|
||||
}
|
||||
|
||||
diff --git a/hidl/biometrics/fingerprint/include/UdfpsHandler.h b/hidl/biometrics/fingerprint/include/UdfpsHandler.h
|
||||
index 9ae531c..dd05832 100644
|
||||
--- a/hidl/biometrics/fingerprint/include/UdfpsHandler.h
|
||||
+++ b/hidl/biometrics/fingerprint/include/UdfpsHandler.h
|
||||
@@ -19,6 +19,11 @@ class UdfpsHandler {
|
||||
|
||||
virtual void onAcquired(int32_t result, int32_t vendorCode) = 0;
|
||||
virtual void cancel() = 0;
|
||||
+
|
||||
+ virtual void preEnroll() = 0;
|
||||
+ virtual void enroll() = 0;
|
||||
+ virtual void postEnroll() = 0;
|
||||
+
|
||||
};
|
||||
|
||||
struct UdfpsHandlerFactory {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
31
hardware/xiaomi/0011-dolby-framework-compatibility.patch
Normal file
31
hardware/xiaomi/0011-dolby-framework-compatibility.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
From ff3a4c984aa18fac7b39943df3810dbd098053db Mon Sep 17 00:00:00 2001
|
||||
From: kuailexs <952415538@qq.com>
|
||||
Date: Mon, 22 Apr 2024 22:46:33 +0800
|
||||
Subject: [PATCH] dolby framework compatibility
|
||||
|
||||
Change-Id: I0c8857fa461fb3c0921d14a1f66c6a94aeffb716
|
||||
---
|
||||
vintf/xiaomi_framework_compatibility_matrix.xml | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/vintf/xiaomi_framework_compatibility_matrix.xml b/vintf/xiaomi_framework_compatibility_matrix.xml
|
||||
index cfc666b..c11acac 100644
|
||||
--- a/vintf/xiaomi_framework_compatibility_matrix.xml
|
||||
+++ b/vintf/xiaomi_framework_compatibility_matrix.xml
|
||||
@@ -100,4 +100,13 @@
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
+ <hal format="hidl">
|
||||
+ <name>vendor.dolby.hardware.dms</name>
|
||||
+ <transport>hwbinder</transport>
|
||||
+ <version>2.0</version>
|
||||
+ <interface>
|
||||
+ <name>IDms</name>
|
||||
+ <instance>default</instance>
|
||||
+ </interface>
|
||||
+ </hal>
|
||||
</compatibility-matrix>
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
From 5508feb9255ea79d4dc206f33efbcbe3e570021e Mon Sep 17 00:00:00 2001
|
||||
From: kuailexs <952415538@qq.com>
|
||||
Date: Tue, 20 Aug 2024 00:25:47 +0800
|
||||
Subject: [PATCH] fix build
|
||||
|
||||
---
|
||||
drivers/input/touchscreen/fts_spi/fts.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/input/touchscreen/fts_spi/fts.c b/drivers/input/touchscreen/fts_spi/fts.c
|
||||
index c8e29a1ef6d9..50b7ca40d32b 100644
|
||||
--- a/drivers/input/touchscreen/fts_spi/fts.c
|
||||
+++ b/drivers/input/touchscreen/fts_spi/fts.c
|
||||
@@ -2752,7 +2752,7 @@ void fts_enable_thp_onoff(int enable) {
|
||||
return;
|
||||
}
|
||||
|
||||
-int fts_enable_touch_raw(bool en)
|
||||
+int fts_enable_touch_raw(int en)
|
||||
{
|
||||
fts_enable_thp_onoff(en);
|
||||
return 0;
|
||||
@@ -0,0 +1,26 @@
|
||||
From 6c4bbb2bd3570efd047dd34491cc6a68a808a2bd Mon Sep 17 00:00:00 2001
|
||||
From: kuailexs <952415538@qq.com>
|
||||
Date: Fri, 20 Sep 2024 01:45:08 +0800
|
||||
Subject: [PATCH] Do not process unsupported links
|
||||
|
||||
Change-Id: Ie45cb78be056e8ed82302806bf2b71e96fd5cd82
|
||||
---
|
||||
app/src/main/java/org/lineageos/jelly/webview/WebClient.kt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/app/src/main/java/org/lineageos/jelly/webview/WebClient.kt b/app/src/main/java/org/lineageos/jelly/webview/WebClient.kt
|
||||
index 07d65c3..42f6348 100644
|
||||
--- a/app/src/main/java/org/lineageos/jelly/webview/WebClient.kt
|
||||
+++ b/app/src/main/java/org/lineageos/jelly/webview/WebClient.kt
|
||||
@@ -132,7 +132,7 @@ internal class WebClient(private val urlBarLayout: UrlBarLayout) : WebViewClient
|
||||
Snackbar.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
- return false
|
||||
+ return true
|
||||
}
|
||||
|
||||
@SuppressLint("QueryPermissionsNeeded")
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 48c190771825033f3ddb139ba721ae53b2acc4c4 Mon Sep 17 00:00:00 2001
|
||||
From: Arian <arian.kulmer@web.de>
|
||||
Date: Sun, 4 Jun 2023 14:34:32 +0200
|
||||
Subject: [PATCH] devicesettings: Import popupcamera strings
|
||||
|
||||
Change-Id: I26c49025a6c85db88a1194de138e1c5911de8934
|
||||
---
|
||||
res/values/strings.xml | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/res/values/strings.xml b/res/values/strings.xml
|
||||
index d810086..54c5d2f 100644
|
||||
--- a/res/values/strings.xml
|
||||
+++ b/res/values/strings.xml
|
||||
@@ -189,4 +189,20 @@
|
||||
<!-- Wake on gesture -->
|
||||
<string name="wake_on_gesture_title">Wake up on gestures</string>
|
||||
<string name="wake_on_gesture_summary">Wake the device instead of pulsing notifications on gesture events</string>
|
||||
+
|
||||
+ <!-- Popup camera -->
|
||||
+ <string name="popup_title">Front camera settings</string>
|
||||
+ <string name="popup_calibration_title">Calibration</string>
|
||||
+ <string name="popup_calibration_summary">Calibrate the popup camera motor</string>
|
||||
+ <string name="popup_calibration_warning_title">Motor calibration</string>
|
||||
+ <string name="popup_calibration_warning_text">Unnecessary use of calibration may cause permanent damage. It is recommended to calibrate the popup camera motor only in case of it not moving properly or it being in incorrect position!</string>
|
||||
+ <string name="popup_camera_tip">Warning</string>
|
||||
+ <string name="popup_camera_takeback_failed_calibrate">Couldn\'t close front camera. Try calibrating the motor.</string>
|
||||
+ <string name="popup_camera_popup_failed_calibrate">Couldn\'t open front camera. Try calibrating the motor.</string>
|
||||
+ <string name="popup_camera_calibrate_running">Front camera cannot be used during calibration.</string>
|
||||
+ <string name="popup_camera_calibrate_now">Calibrate</string>
|
||||
+ <string name="popup_camera_calibrate_failed">Couldn\'t calibrate</string>
|
||||
+ <string name="popup_camera_calibrate_success">Calibrated successfully. You can open the front camera now.</string>
|
||||
+ <string name="popup_led_title">Camera LED</string>
|
||||
+ <string name="popup_led_summary">Enable LED light while the front camera appears and retracts</string>
|
||||
</resources>
|
||||
60
patch.sh
Executable file
60
patch.sh
Executable file
@@ -0,0 +1,60 @@
|
||||
|
||||
cd vendor/lineage
|
||||
git apply ../../patches/vendor/lineage/0001-android-merge_dtbs-Respect-miboard-id-while-merging.patch
|
||||
cd ../../
|
||||
|
||||
cd hardware/xiaomi
|
||||
git apply ../../patches/hardware/xiaomi/0001-Add-dummy-sensors-sub-HAL.patch
|
||||
git apply ../../patches/hardware/xiaomi/0002-sensors-Make-sensor-batch-function-virtual.patch
|
||||
git apply ../../patches/hardware/xiaomi/0003-sensors-Make-sensor-run-function-virtual.patch
|
||||
git apply ../../patches/hardware/xiaomi/0004-sensors-Make-sensor-flush-function-virtual.patch
|
||||
git apply ../../patches/hardware/xiaomi/0005-sensors-Make-sensor-set-mode-operation-function-virt.patch
|
||||
git apply ../../patches/hardware/xiaomi/0006-sensors-Move-one-shot-sensor-out-of-main-class.patch
|
||||
git apply ../../patches/hardware/xiaomi/0007-sensors-Fix-locking-around-setOperationMode-and-acti.patch
|
||||
git apply ../../patches/hardware/xiaomi/0008-sensors-Add-udfps-long-press-sensor.patch
|
||||
git apply ../../patches/hardware/xiaomi/0009-sensors-Handle-fod-press-status-without-coordinates.patch
|
||||
# git apply ../../patches/hardware/xiaomi/0010-hidl-biometrics-fingerprint-Add-enroll-methods-to-ud.patch
|
||||
git apply ../../patches/hardware/xiaomi/0011-dolby-framework-compatibility.patch
|
||||
cd ../../
|
||||
|
||||
cd frameworks/base
|
||||
git apply ../../patches/frameworks/base/4ae78da655484f99715fa8ad7550d2086ee19871.patch
|
||||
cd ../../
|
||||
|
||||
cd frameworks/av
|
||||
git apply ../../patches/frameworks/av/966aae39fb309ed56c3836926623c5ce858ce077.patch
|
||||
cd ../../
|
||||
|
||||
cd frameworks/opt/telephony
|
||||
git apply ../../../patches/frameworks/opt/telephony/001-d18b2cb.diff
|
||||
git apply ../../../patches/frameworks/opt/telephony/002-dd06504.diff
|
||||
git apply ../../../patches/frameworks/opt/telephony/003-7f1ca2e.diff
|
||||
git apply ../../../patches/frameworks/opt/telephony/004-c73da56.diff
|
||||
git apply ../../../patches/frameworks/opt/telephony/005-9e34e75.diff
|
||||
git apply ../../../patches/frameworks/opt/telephony/006-3952581.diff
|
||||
git apply ../../../patches/frameworks/opt/telephony/007-11f6271.diff
|
||||
cd ../../../
|
||||
|
||||
cd device/qcom/sepolicy
|
||||
git apply ../../../patches/device/qcom/sepolicy/4891f5c311d7854b4d7b8357290ed08b866240d9.patch
|
||||
cd ../../../
|
||||
|
||||
#cd device/xiaomi/sm8450-common
|
||||
#git apply ../../../patches/device/xiaomi/sm8450-common/0001-fix-build.patch
|
||||
#cd ../../../
|
||||
|
||||
cd packages/resources/devicesettings
|
||||
git apply ../../../patches/packages/resources/devicesettings/48c190771825033f3ddb139ba721ae53b2acc4c4.patch
|
||||
cd ../../../
|
||||
|
||||
cd kernel/xiaomi/sm8450
|
||||
git apply ../../../patches/kernel/xiaomi/sm8450/5508feb9255ea79d4dc206f33efbcbe3e570021e.patch
|
||||
cd ../../../
|
||||
|
||||
cd packages/apps/Jelly
|
||||
git apply ../../../patches/packages/apps/Jelly/0001-Do-not-process-unsupported-links.patch
|
||||
cd ../../../
|
||||
|
||||
|
||||
|
||||
|
||||
204
vendor/lineage/0001-android-merge_dtbs-Respect-miboard-id-while-merging.patch
vendored
Normal file
204
vendor/lineage/0001-android-merge_dtbs-Respect-miboard-id-while-merging.patch
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
From 6a0a02f56cc761f27565c072fe7f3d33514ff9ed Mon Sep 17 00:00:00 2001
|
||||
From: Arian <arian.kulmer@web.de>
|
||||
Date: Thu, 14 Jul 2022 18:26:54 +0200
|
||||
Subject: [PATCH] android: merge_dtbs: Respect miboard-id while merging
|
||||
|
||||
Change-Id: Ic5b38a122173d8e9ecc1f0f399411cb37acf3150
|
||||
---
|
||||
build/tools/merge_dtbs.py | 50 ++++++++++++++++++++++++++-------------
|
||||
1 file changed, 34 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/build/tools/merge_dtbs.py b/build/tools/merge_dtbs.py
|
||||
index 898be4cc..a5409317 100755
|
||||
--- a/build/tools/merge_dtbs.py
|
||||
+++ b/build/tools/merge_dtbs.py
|
||||
@@ -44,10 +44,11 @@ def split_array(array, cells):
|
||||
return frozenset(tuple(array[i*cells:(i*cells)+cells]) for i in range(len(array) // cells))
|
||||
|
||||
class DeviceTreeInfo(object):
|
||||
- def __init__(self, plat, board, pmic):
|
||||
+ def __init__(self, plat, board, pmic, miboard):
|
||||
self.plat_id = plat
|
||||
self.board_id = board
|
||||
self.pmic_id = pmic
|
||||
+ self.miboard_id = miboard
|
||||
|
||||
def __str__(self):
|
||||
s = ""
|
||||
@@ -57,13 +58,15 @@ class DeviceTreeInfo(object):
|
||||
s += " board-id = <{}>;".format(" ".join(map(str, self.board_id)))
|
||||
if self.pmic_id is not None:
|
||||
s += " pmic-id = <{}>;".format(" ".join(map(str, self.pmic_id)))
|
||||
+ if self.miboard_id is not None:
|
||||
+ s += " miboard-id = <{}>;".format(" ".join(map(str, self.miboard_id)))
|
||||
return s.strip()
|
||||
|
||||
def __repr__(self):
|
||||
return "<{} {}>".format(self.__class__.__name__, str(self))
|
||||
|
||||
def has_any_properties(self):
|
||||
- return self.plat_id is not None or self.board_id is not None or self.pmic_id is not None
|
||||
+ return self.plat_id is not None or self.board_id is not None or self.pmic_id is not None or self.miboard_id is not None
|
||||
|
||||
def __sub__(self, other):
|
||||
"""
|
||||
@@ -71,11 +74,13 @@ class DeviceTreeInfo(object):
|
||||
msm-id = <A>, <B>
|
||||
board-id = <c>, <d>
|
||||
pmic-id = <0, 1>
|
||||
+ miboard-id = <e>, <f>
|
||||
|
||||
Other has plat, board, pmic are:
|
||||
msm-id = <A>, <B>
|
||||
board-id = <c>
|
||||
pmic-id = <0>
|
||||
+ miboard-id = <e>, <f>
|
||||
|
||||
(self - other) will split self into a set of devicetrees with different identifers
|
||||
and meets the following requirements:
|
||||
@@ -86,11 +91,13 @@ class DeviceTreeInfo(object):
|
||||
assert self.plat_id is None or isinstance(self.plat_id, (set, frozenset))
|
||||
assert self.board_id is None or isinstance(self.board_id, (set, frozenset))
|
||||
assert self.pmic_id is None or isinstance(self.pmic_id, (set, frozenset))
|
||||
+ assert self.miboard_id is None or isinstance(self.miboard_id, (set, frozenset))
|
||||
assert other in self
|
||||
|
||||
new_plat = other.plat_id is not None and self.plat_id != other.plat_id
|
||||
new_board = other.board_id is not None and self.board_id != other.board_id
|
||||
new_pmic = other.pmic_id is not None and self.pmic_id != other.pmic_id
|
||||
+ new_miboard = other.miboard_id is not None and self.miboard_id != other.miboard_id
|
||||
|
||||
res = set()
|
||||
# Create the devicetree that matches other exactly
|
||||
@@ -101,13 +108,15 @@ class DeviceTreeInfo(object):
|
||||
s.board_id = other.board_id
|
||||
if new_pmic:
|
||||
s.pmic_id = other.pmic_id
|
||||
+ if new_miboard:
|
||||
+ s.miboard_id = other.miboard_id
|
||||
res.add(s)
|
||||
|
||||
# now create the other possibilities by removing any combination of
|
||||
# other's plat, board, and/or pmic. Set logic (unique elemnts) handles
|
||||
# duplicate devicetrees IDs spit out by this loop
|
||||
- for combo in combinations_with_replacement([True, False], 3):
|
||||
- if not any((c and n) for (c, n) in zip(combo, (new_plat, new_board, new_pmic))):
|
||||
+ for combo in combinations_with_replacement([True, False], 4):
|
||||
+ if not any((c and n) for (c, n) in zip(combo, (new_plat, new_board, new_pmic, new_miboard))):
|
||||
continue
|
||||
s = copy.deepcopy(self)
|
||||
if combo[0] and new_plat:
|
||||
@@ -116,16 +125,18 @@ class DeviceTreeInfo(object):
|
||||
s.board_id -= other.board_id
|
||||
if combo[2] and new_pmic:
|
||||
s.pmic_id -= other.pmic_id
|
||||
+ if combo[3] and new_miboard:
|
||||
+ s.miboard_id -= other.miboard_id
|
||||
res.add(s)
|
||||
return res
|
||||
|
||||
def __hash__(self):
|
||||
- # Hash should only consider msm-id/board-id/pmic-id
|
||||
- return hash((self.plat_id, self.board_id, self.pmic_id))
|
||||
+ # Hash should only consider msm-id/board-id/pmic-id/miboard-id
|
||||
+ return hash((self.plat_id, self.board_id, self.pmic_id, self.miboard_id))
|
||||
|
||||
def __and__(self, other):
|
||||
s = copy.deepcopy(self)
|
||||
- for prop in ['plat_id', 'board_id', 'pmic_id']:
|
||||
+ for prop in ['plat_id', 'board_id', 'pmic_id', 'miboard_id']:
|
||||
if getattr(self, prop) is None or getattr(other, prop) is None:
|
||||
setattr(s, prop, None)
|
||||
else:
|
||||
@@ -141,14 +152,14 @@ class DeviceTreeInfo(object):
|
||||
|
||||
def __eq__(self, other):
|
||||
"""
|
||||
- Checks whether other plat_id, board_id, pmic_id matches either identically
|
||||
+ Checks whether other plat_id, board_id, pmic_id, miboard_id matches either identically
|
||||
or because the property is none
|
||||
"""
|
||||
if not isinstance(other, DeviceTreeInfo):
|
||||
return False
|
||||
if not other.has_any_properties():
|
||||
return False
|
||||
- return all(map(lambda p: self._do_equivalent(other, p), ['plat_id', 'board_id', 'pmic_id']))
|
||||
+ return all(map(lambda p: self._do_equivalent(other, p), ['plat_id', 'board_id', 'pmic_id', 'miboard_id']))
|
||||
|
||||
|
||||
def _do_gt(self, other, property):
|
||||
@@ -180,7 +191,7 @@ class DeviceTreeInfo(object):
|
||||
return False
|
||||
if not other.has_any_properties():
|
||||
return False
|
||||
- return all(map(lambda p: self._do_gt(other, p), ['plat_id', 'board_id', 'pmic_id']))
|
||||
+ return all(map(lambda p: self._do_gt(other, p), ['plat_id', 'board_id', 'pmic_id', 'miboard_id']))
|
||||
|
||||
|
||||
def _do_contains(self, other, property):
|
||||
@@ -214,7 +225,7 @@ class DeviceTreeInfo(object):
|
||||
return False
|
||||
if not other.has_any_properties():
|
||||
return False
|
||||
- return all(map(lambda p: self._do_contains(other, p), ['plat_id', 'board_id', 'pmic_id']))
|
||||
+ return all(map(lambda p: self._do_contains(other, p), ['plat_id', 'board_id', 'pmic_id', 'miboard_id']))
|
||||
|
||||
class DeviceTree(DeviceTreeInfo):
|
||||
def __init__(self, filename):
|
||||
@@ -224,7 +235,8 @@ class DeviceTree(DeviceTreeInfo):
|
||||
# default pmic-id-size is 4
|
||||
pmic_id_size = self.get_prop('/', 'qcom,pmic-id-size', check_output=False) or 4
|
||||
pmic_id = split_array(self.get_prop('/', 'qcom,pmic-id', check_output=False), pmic_id_size)
|
||||
- super().__init__(msm_id, board_id, pmic_id)
|
||||
+ miboard_id = split_array(self.get_prop('/', 'xiaomi,miboard-id', check_output=False), 2)
|
||||
+ super().__init__(msm_id, board_id, pmic_id, miboard_id)
|
||||
|
||||
if not self.has_any_properties():
|
||||
print('WARNING! {} has no properties and may match with any other devicetree'.format(self.filename))
|
||||
@@ -260,10 +272,10 @@ class InnerMergedDeviceTree(DeviceTreeInfo):
|
||||
It has a platform, board, and pmic ID, the "base" devicetree, and some set of add-on
|
||||
devicetrees
|
||||
"""
|
||||
- def __init__(self, filename, plat_id, board_id, pmic_id, techpacks=None):
|
||||
+ def __init__(self, filename, plat_id, board_id, pmic_id, miboard_id, techpacks=None):
|
||||
self.base = filename
|
||||
self.techpacks = techpacks or []
|
||||
- super().__init__(plat_id, board_id, pmic_id)
|
||||
+ super().__init__(plat_id, board_id, pmic_id, miboard_id)
|
||||
|
||||
def try_add(self, techpack):
|
||||
if not isinstance(techpack, DeviceTree):
|
||||
@@ -317,6 +329,12 @@ class InnerMergedDeviceTree(DeviceTreeInfo):
|
||||
print(' {}'.format(' '.join(cmd)))
|
||||
subprocess.run(cmd, check=True)
|
||||
|
||||
+ if self.miboard_id:
|
||||
+ board_iter = self.miboard_id if isinstance(self.miboard_id, tuple) else chain.from_iterable(self.miboard_id)
|
||||
+ cmd = ['fdtput', '-t', 'i', out_file, '/', 'xiaomi,miboard-id'] + list(map(str, board_iter))
|
||||
+ print(' {}'.format(' '.join(cmd)))
|
||||
+ subprocess.run(cmd, check=True)
|
||||
+
|
||||
return DeviceTree(out_file)
|
||||
|
||||
def get_name(self):
|
||||
@@ -336,7 +354,7 @@ class InnerMergedDeviceTree(DeviceTreeInfo):
|
||||
|
||||
class MergedDeviceTree(object):
|
||||
def __init__(self, other):
|
||||
- self.merged_devicetrees = {InnerMergedDeviceTree(other.filename, other.plat_id, other.board_id, other.pmic_id)}
|
||||
+ self.merged_devicetrees = {InnerMergedDeviceTree(other.filename, other.plat_id, other.board_id, other.pmic_id, other.miboard_id)}
|
||||
|
||||
def try_add(self, techpack):
|
||||
did_add = False
|
||||
@@ -395,7 +413,7 @@ def main():
|
||||
.format(sys.argv[0]))
|
||||
sys.exit(1)
|
||||
|
||||
- # 1. Parse the devicetrees -- extract the device info (msm-id, board-id, pmic-id)
|
||||
+ # 1. Parse the devicetrees -- extract the device info (msm-id, board-id, pmic-id, miboard-id)
|
||||
bases = parse_dt_files(sys.argv[1])
|
||||
techpacks = parse_dt_files(sys.argv[2])
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
Reference in New Issue
Block a user