更新
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From d019a2cf56c0c25c2e99caa79c42e18c4e18ae00 Mon Sep 17 00:00:00 2001
|
||||
From cf7d74eb8fa269653c5053eb1bf8e7a0a100f89f 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
|
||||
@@ -6,14 +6,14 @@ 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(+)
|
||||
.../telephony/CarrierConfigManager.java | 85 +++++++++++++++++++
|
||||
1 file changed, 85 insertions(+)
|
||||
|
||||
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
|
||||
index 7cb2cc398c46..570ee2aa8628 100644
|
||||
index 5d99acd87dd3..cf8b1c2d63e3 100644
|
||||
--- a/telephony/java/android/telephony/CarrierConfigManager.java
|
||||
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
|
||||
@@ -10038,6 +10038,81 @@ public class CarrierConfigManager {
|
||||
@@ -10202,6 +10202,81 @@ public class CarrierConfigManager {
|
||||
public static final String KEY_AUTO_DATA_SWITCH_RAT_SIGNAL_SCORE_BUNDLE =
|
||||
"auto_data_switch_rat_signal_score_string_bundle";
|
||||
|
||||
@@ -92,13 +92,13 @@ index 7cb2cc398c46..570ee2aa8628 100644
|
||||
+ 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;
|
||||
// TODO(b/316183370): replace @code with @link in javadoc after feature is released
|
||||
/**
|
||||
* An array of cellular services supported by a subscription.
|
||||
@@ -10880,6 +10955,16 @@ public class CarrierConfigManager {
|
||||
sDefaults.putStringArray(KEY_MISSED_INCOMING_CALL_SMS_ORIGINATOR_STRING_ARRAY,
|
||||
new String[0]);
|
||||
|
||||
@@ -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);
|
||||
@@ -108,9 +108,10 @@ index 7cb2cc398c46..570ee2aa8628 100644
|
||||
+ 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.
|
||||
sDefaults.putStringArray(
|
||||
--
|
||||
2.25.1
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 3d887846df2b6ff5c4330118a81d99708607032c Mon Sep 17 00:00:00 2001
|
||||
From b65f97d76be0466bd2681d87fdfc76965e4f6298 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
|
||||
@@ -11,13 +11,13 @@ CRs-Fixed: 3218447
|
||||
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
|
||||
index cf8b1c2d63e3..49e15e1cbf00 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"
|
||||
});
|
||||
@@ -10955,14 +10955,14 @@ public class CarrierConfigManager {
|
||||
sDefaults.putStringArray(KEY_MISSED_INCOMING_CALL_SMS_ORIGINATOR_STRING_ARRAY,
|
||||
new String[0]);
|
||||
|
||||
- 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);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 2843c0313a8b5f82fa54b344f3f01cc668db4fe5 Mon Sep 17 00:00:00 2001
|
||||
From 380b51175229ab1918a27e811680c302e7859b0e 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
|
||||
Subject: [PATCH 01/15] Add dummy sensors sub HAL
|
||||
|
||||
Change-Id: Ie20ed775344990de3e16e2eefba1754d831027fb
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From e6f404fece4e39b5be00a7e82632b245cd007b2c Mon Sep 17 00:00:00 2001
|
||||
From 554e5cb75f40e6b03123bd1f9af516db0cc389e3 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
|
||||
Subject: [PATCH 02/15] sensors: Make sensor batch function virtual
|
||||
|
||||
Change-Id: I2de1e919234c4893b0b70390c0189cae38dbbe6c
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 1088f413cc85c735acc652d1b69252a2c1ea2bba Mon Sep 17 00:00:00 2001
|
||||
From 421e7fe3ca5f4e9381732319929401ee7921767d 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
|
||||
Subject: [PATCH 03/15] sensors: Make sensor run function virtual
|
||||
|
||||
Change-Id: Ie50900903bbf4a302baff084f229c37c5c324742
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From b856ada4457b884c2890d4ddfbf415c51765787f Mon Sep 17 00:00:00 2001
|
||||
From 53b88dce1cbd7165b97b3419f02af9cb235bf92c 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
|
||||
Subject: [PATCH 04/15] sensors: Make sensor flush function virtual
|
||||
|
||||
Change-Id: I46532fc726d9e0c2073100ff1f6008fcde9e821c
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 012799cb2f69ca2e8a8a6e34b3b191c653da1ae6 Mon Sep 17 00:00:00 2001
|
||||
From 205173ea0bf99530303bdc4c92c9b7a4f7747615 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
|
||||
Subject: [PATCH 05/15] sensors: Make sensor set mode operation function
|
||||
virtual
|
||||
|
||||
Change-Id: I62c94a6ad250417162cfc9eaca8cb490ce650d9c
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 4fe1ac6fb8fe97b2698d09f425627771abbd0625 Mon Sep 17 00:00:00 2001
|
||||
From 60085c6a4d33e70b083eb0a1eb92155a0bf9cb0b 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
|
||||
Subject: [PATCH 06/15] sensors: Move one shot sensor out of main class
|
||||
|
||||
Change-Id: Ib7ac0c55409f2dc7f8fb114167e9f4b2e8859223
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From ae334ea8a2706737212c9e00ff6279cd836af640 Mon Sep 17 00:00:00 2001
|
||||
From 25e899a09c0a1a8cb49b8bd51346c147c28b854c 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
|
||||
Subject: [PATCH 07/15] sensors: Fix locking around setOperationMode and
|
||||
activate
|
||||
|
||||
Change-Id: I9a09f45f012662c8f92fa40da3a4b9dd691a1b2c
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
From 2ab6db384c58652b61c1ff70fc9901b0d4202734 Mon Sep 17 00:00:00 2001
|
||||
From ff7c28b365ae5fee069bc24809460eb2386cea7c 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
|
||||
Subject: [PATCH 08/15] sensors: Create sysfs polling one shot 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(-)
|
||||
sensors/Sensor.cpp | 166 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
sensors/Sensor.h | 32 +++++++++
|
||||
2 files changed, 198 insertions(+)
|
||||
|
||||
diff --git a/sensors/Sensor.cpp b/sensors/Sensor.cpp
|
||||
index dcf5b75..2982513 100644
|
||||
index dcf5b75..e96ef21 100644
|
||||
--- a/sensors/Sensor.cpp
|
||||
+++ b/sensors/Sensor.cpp
|
||||
@@ -17,10 +17,41 @@
|
||||
@@ -17,10 +17,36 @@
|
||||
#include "Sensor.h"
|
||||
|
||||
#include <hardware/sensors.h>
|
||||
@@ -26,30 +24,25 @@ index dcf5b75..2982513 100644
|
||||
|
||||
+namespace {
|
||||
+
|
||||
+static bool readFpState(int fd, int& screenX, int& screenY) {
|
||||
+ char buffer[512];
|
||||
+ int state = 0;
|
||||
+static bool readBool(int fd, bool seek) {
|
||||
+ char c;
|
||||
+ int rc;
|
||||
+
|
||||
+ rc = lseek(fd, 0, SEEK_SET);
|
||||
+ if (rc) {
|
||||
+ ALOGE("failed to seek: %d", rc);
|
||||
+ if (seek) {
|
||||
+ rc = lseek(fd, 0, SEEK_SET);
|
||||
+ if (rc) {
|
||||
+ ALOGE("failed to seek: %d", rc);
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ rc = read(fd, &c, sizeof(c));
|
||||
+ if (rc != 1) {
|
||||
+ ALOGE("failed to read bool: %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;
|
||||
+ return c != '0';
|
||||
+}
|
||||
+
|
||||
+} // anonymous namespace
|
||||
@@ -57,21 +50,25 @@ index dcf5b75..2982513 100644
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace sensors {
|
||||
@@ -191,6 +222,117 @@ OneShotSensor::OneShotSensor(int32_t sensorHandle, ISensorsEventCallback* callba
|
||||
@@ -191,6 +217,146 @@ OneShotSensor::OneShotSensor(int32_t sensorHandle, ISensorsEventCallback* callba
|
||||
mSensorInfo.flags |= SensorFlagBits::ONE_SHOT_MODE;
|
||||
}
|
||||
|
||||
+UdfpsSensor::UdfpsSensor(int32_t sensorHandle, ISensorsEventCallback* callback)
|
||||
+SysfsPollingOneShotSensor::SysfsPollingOneShotSensor(
|
||||
+ int32_t sensorHandle, ISensorsEventCallback* callback, const std::string& pollPath,
|
||||
+ const std::string& enablePath, const std::string& name, const std::string& typeAsString,
|
||||
+ SensorType type)
|
||||
+ : 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.name = name;
|
||||
+ mSensorInfo.type = type;
|
||||
+ mSensorInfo.typeAsString = typeAsString;
|
||||
+ mSensorInfo.maxRange = 2048.0f;
|
||||
+ mSensorInfo.resolution = 1.0f;
|
||||
+ mSensorInfo.power = 0;
|
||||
+ mSensorInfo.flags |= SensorFlagBits::WAKE_UP;
|
||||
+
|
||||
+ mEnableStream.open(enablePath);
|
||||
+
|
||||
+ int rc;
|
||||
+
|
||||
+ rc = pipe(mWaitPipeFd);
|
||||
@@ -81,7 +78,7 @@ index dcf5b75..2982513 100644
|
||||
+ ALOGE("failed to open wait pipe: %d", rc);
|
||||
+ }
|
||||
+
|
||||
+ mPollFd = open("/sys/devices/virtual/touch/touch_dev/fod_press_status", O_RDONLY);
|
||||
+ mPollFd = open(pollPath.c_str(), O_RDONLY);
|
||||
+ if (mPollFd < 0) {
|
||||
+ ALOGE("failed to open poll fd: %d", mPollFd);
|
||||
+ }
|
||||
@@ -102,27 +99,49 @@ index dcf5b75..2982513 100644
|
||||
+ };
|
||||
+}
|
||||
+
|
||||
+UdfpsSensor::~UdfpsSensor() {
|
||||
+SysfsPollingOneShotSensor::~SysfsPollingOneShotSensor() {
|
||||
+ interruptPoll();
|
||||
+}
|
||||
+
|
||||
+void UdfpsSensor::activate(bool enable) {
|
||||
+ std::lock_guard<std::mutex> lock(mRunMutex);
|
||||
+
|
||||
+ if (mIsEnabled != enable) {
|
||||
+ mIsEnabled = enable;
|
||||
+
|
||||
+ interruptPoll();
|
||||
+ mWaitCV.notify_all();
|
||||
+void SysfsPollingOneShotSensor::writeEnable(bool enable) {
|
||||
+ if (mEnableStream) {
|
||||
+ mEnableStream << (enable ? '1' : '0') << std::flush;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void UdfpsSensor::setOperationMode(OperationMode mode) {
|
||||
+void SysfsPollingOneShotSensor::activate(bool enable, bool notify, bool lock) {
|
||||
+ std::unique_lock<std::mutex> runLock(mRunMutex, std::defer_lock);
|
||||
+
|
||||
+ if (lock) {
|
||||
+ runLock.lock();
|
||||
+ }
|
||||
+
|
||||
+ if (mIsEnabled != enable) {
|
||||
+ writeEnable(enable);
|
||||
+
|
||||
+ mIsEnabled = enable;
|
||||
+
|
||||
+ if (notify) {
|
||||
+ interruptPoll();
|
||||
+ mWaitCV.notify_all();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (lock) {
|
||||
+ runLock.unlock();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void SysfsPollingOneShotSensor::activate(bool enable) {
|
||||
+ activate(enable, true, true);
|
||||
+}
|
||||
+
|
||||
+void SysfsPollingOneShotSensor::setOperationMode(OperationMode mode) {
|
||||
+ Sensor::setOperationMode(mode);
|
||||
+ interruptPoll();
|
||||
+}
|
||||
+
|
||||
+void UdfpsSensor::run() {
|
||||
+void SysfsPollingOneShotSensor::run() {
|
||||
+ std::unique_lock<std::mutex> runLock(mRunMutex);
|
||||
+
|
||||
+ while (!mStopThread) {
|
||||
@@ -142,44 +161,47 @@ index dcf5b75..2982513 100644
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (mPolls[1].revents == mPolls[1].events && readFpState(mPollFd, mScreenX, mScreenY)) {
|
||||
+ mIsEnabled = false;
|
||||
+ if (mPolls[1].revents == mPolls[1].events && readBool(mPollFd, true /* seek */)) {
|
||||
+ activate(false, false, false);
|
||||
+ mCallback->postEvents(readEvents(), isWakeUpSensor());
|
||||
+ } else if (mPolls[0].revents == mPolls[0].events) {
|
||||
+ char buf;
|
||||
+ read(mWaitPipeFd[0], &buf, sizeof(buf));
|
||||
+ readBool(mWaitPipeFd[0], false /* seek */);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+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() {
|
||||
+void SysfsPollingOneShotSensor::interruptPoll() {
|
||||
+ if (mWaitPipeFd[1] < 0) return;
|
||||
+
|
||||
+ char c = '1';
|
||||
+ write(mWaitPipeFd[1], &c, sizeof(c));
|
||||
+}
|
||||
+
|
||||
+std::vector<Event> SysfsPollingOneShotSensor::readEvents() {
|
||||
+ std::vector<Event> events;
|
||||
+ Event event;
|
||||
+ event.sensorHandle = mSensorInfo.sensorHandle;
|
||||
+ event.sensorType = mSensorInfo.type;
|
||||
+ event.timestamp = ::android::elapsedRealtimeNano();
|
||||
+ fillEventData(event);
|
||||
+ events.push_back(event);
|
||||
+ return events;
|
||||
+}
|
||||
+
|
||||
+void SysfsPollingOneShotSensor::fillEventData(Event& event) {
|
||||
+ event.u.data[0] = 0;
|
||||
+ event.u.data[1] = 0;
|
||||
+}
|
||||
+
|
||||
} // namespace implementation
|
||||
} // namespace subhal
|
||||
} // namespace V2_1
|
||||
diff --git a/sensors/Sensor.h b/sensors/Sensor.h
|
||||
index b7cd4a5..aa1f194 100644
|
||||
index b7cd4a5..f6fe7a5 100644
|
||||
--- a/sensors/Sensor.h
|
||||
+++ b/sensors/Sensor.h
|
||||
@@ -17,6 +17,9 @@
|
||||
@@ -17,8 +17,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <android/hardware/sensors/2.1/types.h>
|
||||
@@ -188,22 +210,33 @@ index b7cd4a5..aa1f194 100644
|
||||
+#include <unistd.h>
|
||||
|
||||
#include <condition_variable>
|
||||
+#include <fstream>
|
||||
#include <memory>
|
||||
@@ -88,6 +91,29 @@ class OneShotSensor : public Sensor {
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
@@ -88,6 +92,34 @@ class OneShotSensor : public Sensor {
|
||||
virtual Result flush() override { return Result::BAD_VALUE; }
|
||||
};
|
||||
|
||||
+class UdfpsSensor : public OneShotSensor {
|
||||
+class SysfsPollingOneShotSensor : public OneShotSensor {
|
||||
+ public:
|
||||
+ UdfpsSensor(int32_t sensorHandle, ISensorsEventCallback* callback);
|
||||
+ virtual ~UdfpsSensor() override;
|
||||
+ SysfsPollingOneShotSensor(int32_t sensorHandle, ISensorsEventCallback* callback,
|
||||
+ const std::string& pollPath, const std::string& enablePath,
|
||||
+ const std::string& name, const std::string& typeAsString,
|
||||
+ SensorType type);
|
||||
+ virtual ~SysfsPollingOneShotSensor() override;
|
||||
+
|
||||
+ virtual void activate(bool enable) override;
|
||||
+ virtual void activate(bool enable, bool notify, bool lock);
|
||||
+ virtual void writeEnable(bool enable);
|
||||
+ virtual void setOperationMode(OperationMode mode) override;
|
||||
+ virtual std::vector<Event> readEvents() override;
|
||||
+ virtual void fillEventData(Event& event);
|
||||
+
|
||||
+ protected:
|
||||
+ virtual void run() override;
|
||||
+ virtual std::vector<Event> readEvents();
|
||||
+
|
||||
+ std::ofstream mEnableStream;
|
||||
+
|
||||
+ private:
|
||||
+ void interruptPoll();
|
||||
@@ -211,29 +244,11 @@ index b7cd4a5..aa1f194 100644
|
||||
+ 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
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
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,50 @@
|
||||
From b34c5cc80835b581a7f35d54dacfd3326dd356fc Mon Sep 17 00:00:00 2001
|
||||
From: Arian <arian.kulmer@web.de>
|
||||
Date: Tue, 21 May 2024 12:57:47 +0200
|
||||
Subject: [PATCH 09/15] sensors: Let the reading of poll fd be configurable
|
||||
|
||||
Change-Id: I554a238c11a87d89687b60d3f39446c8f2ff7e2a
|
||||
---
|
||||
sensors/Sensor.cpp | 6 +++++-
|
||||
sensors/Sensor.h | 1 +
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sensors/Sensor.cpp b/sensors/Sensor.cpp
|
||||
index e96ef21..ed3ff71 100644
|
||||
--- a/sensors/Sensor.cpp
|
||||
+++ b/sensors/Sensor.cpp
|
||||
@@ -324,7 +324,7 @@ void SysfsPollingOneShotSensor::run() {
|
||||
continue;
|
||||
}
|
||||
|
||||
- if (mPolls[1].revents == mPolls[1].events && readBool(mPollFd, true /* seek */)) {
|
||||
+ if (mPolls[1].revents == mPolls[1].events && readFd(mPollFd)) {
|
||||
activate(false, false, false);
|
||||
mCallback->postEvents(readEvents(), isWakeUpSensor());
|
||||
} else if (mPolls[0].revents == mPolls[0].events) {
|
||||
@@ -357,6 +357,10 @@ void SysfsPollingOneShotSensor::fillEventData(Event& event) {
|
||||
event.u.data[1] = 0;
|
||||
}
|
||||
|
||||
+bool SysfsPollingOneShotSensor::readFd(const int fd) {
|
||||
+ return readBool(fd, true /* seek */);
|
||||
+}
|
||||
+
|
||||
} // namespace implementation
|
||||
} // namespace subhal
|
||||
} // namespace V2_1
|
||||
diff --git a/sensors/Sensor.h b/sensors/Sensor.h
|
||||
index f6fe7a5..522d194 100644
|
||||
--- a/sensors/Sensor.h
|
||||
+++ b/sensors/Sensor.h
|
||||
@@ -106,6 +106,7 @@ class SysfsPollingOneShotSensor : public OneShotSensor {
|
||||
virtual void setOperationMode(OperationMode mode) override;
|
||||
virtual std::vector<Event> readEvents() override;
|
||||
virtual void fillEventData(Event& event);
|
||||
+ virtual bool readFd(const int fd);
|
||||
|
||||
protected:
|
||||
virtual void run() override;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
From b36a5bb9476e08d03a7ed3e71b27afc72fa106ef Mon Sep 17 00:00:00 2001
|
||||
From: Arian <arian.kulmer@web.de>
|
||||
Date: Tue, 21 May 2024 13:17:52 +0200
|
||||
Subject: [PATCH 10/15] sensors: Add SysfsPollingOneShotSensor constructor
|
||||
without enable path
|
||||
|
||||
Change-Id: I0780a6ac56c99066213bb61650ebd8f55e71f78d
|
||||
---
|
||||
sensors/Sensor.cpp | 9 ++++++++-
|
||||
sensors/Sensor.h | 3 +++
|
||||
2 files changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sensors/Sensor.cpp b/sensors/Sensor.cpp
|
||||
index ed3ff71..ea5f00e 100644
|
||||
--- a/sensors/Sensor.cpp
|
||||
+++ b/sensors/Sensor.cpp
|
||||
@@ -230,7 +230,9 @@ SysfsPollingOneShotSensor::SysfsPollingOneShotSensor(
|
||||
mSensorInfo.power = 0;
|
||||
mSensorInfo.flags |= SensorFlagBits::WAKE_UP;
|
||||
|
||||
- mEnableStream.open(enablePath);
|
||||
+ if (enablePath != "") {
|
||||
+ mEnableStream.open(enablePath);
|
||||
+ }
|
||||
|
||||
int rc;
|
||||
|
||||
@@ -262,6 +264,11 @@ SysfsPollingOneShotSensor::SysfsPollingOneShotSensor(
|
||||
};
|
||||
}
|
||||
|
||||
+SysfsPollingOneShotSensor::SysfsPollingOneShotSensor(
|
||||
+ int32_t sensorHandle, ISensorsEventCallback* callback, const std::string& pollPath,
|
||||
+ const std::string& name, const std::string& typeAsString, SensorType type)
|
||||
+ : SysfsPollingOneShotSensor(sensorHandle, callback, pollPath, "", name, typeAsString, type) {}
|
||||
+
|
||||
SysfsPollingOneShotSensor::~SysfsPollingOneShotSensor() {
|
||||
interruptPoll();
|
||||
}
|
||||
diff --git a/sensors/Sensor.h b/sensors/Sensor.h
|
||||
index 522d194..31dbbc1 100644
|
||||
--- a/sensors/Sensor.h
|
||||
+++ b/sensors/Sensor.h
|
||||
@@ -98,6 +98,9 @@ class SysfsPollingOneShotSensor : public OneShotSensor {
|
||||
const std::string& pollPath, const std::string& enablePath,
|
||||
const std::string& name, const std::string& typeAsString,
|
||||
SensorType type);
|
||||
+ SysfsPollingOneShotSensor(int32_t sensorHandle, ISensorsEventCallback* callback,
|
||||
+ const std::string& pollPath, const std::string& name,
|
||||
+ const std::string& typeAsString, SensorType type);
|
||||
virtual ~SysfsPollingOneShotSensor() override;
|
||||
|
||||
virtual void activate(bool enable) override;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
From 0ccf2a04cb307a2bc113d70c8f597d746f061923 Mon Sep 17 00:00:00 2001
|
||||
From: Arian <arian.kulmer@web.de>
|
||||
Date: Tue, 21 May 2024 13:32:01 +0200
|
||||
Subject: [PATCH 11/15] sensors: Implement udfps long press sensor
|
||||
|
||||
Change-Id: I49773535f47c538b1ff210245109dd63c18d32cb
|
||||
---
|
||||
sensors/Sensor.cpp | 34 ++++++++++++++++++++++++++++++++++
|
||||
sensors/Sensor.h | 17 +++++++++++++++++
|
||||
sensors/SensorsSubHal.cpp | 7 ++++++-
|
||||
3 files changed, 57 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sensors/Sensor.cpp b/sensors/Sensor.cpp
|
||||
index ea5f00e..646e852 100644
|
||||
--- a/sensors/Sensor.cpp
|
||||
+++ b/sensors/Sensor.cpp
|
||||
@@ -368,6 +368,40 @@ bool SysfsPollingOneShotSensor::readFd(const int fd) {
|
||||
return readBool(fd, true /* seek */);
|
||||
}
|
||||
|
||||
+void UdfpsSensor::fillEventData(Event& event) {
|
||||
+ event.u.data[0] = mScreenX;
|
||||
+ event.u.data[1] = mScreenY;
|
||||
+}
|
||||
+
|
||||
+bool UdfpsSensor::readFd(const int fd) {
|
||||
+ char buffer[512];
|
||||
+ int state = 0;
|
||||
+ int rc;
|
||||
+
|
||||
+ rc = lseek(fd, 0, SEEK_SET);
|
||||
+ if (rc < 0) {
|
||||
+ 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", &mScreenX, &mScreenY, &state);
|
||||
+ if (rc == 1) {
|
||||
+ // If fod_press_status contains only one value,
|
||||
+ // assume that just reports the state
|
||||
+ state = mScreenX;
|
||||
+ mScreenX = 0;
|
||||
+ mScreenY = 0;
|
||||
+ } else if (rc < 3) {
|
||||
+ ALOGE("failed to parse fp state: %d", rc);
|
||||
+ return false;
|
||||
+ }
|
||||
+ return state > 0;
|
||||
+}
|
||||
+
|
||||
} // namespace implementation
|
||||
} // namespace subhal
|
||||
} // namespace V2_1
|
||||
diff --git a/sensors/Sensor.h b/sensors/Sensor.h
|
||||
index 31dbbc1..91c835e 100644
|
||||
--- a/sensors/Sensor.h
|
||||
+++ b/sensors/Sensor.h
|
||||
@@ -124,6 +124,23 @@ class SysfsPollingOneShotSensor : public OneShotSensor {
|
||||
int mPollFd;
|
||||
};
|
||||
|
||||
+class UdfpsSensor : public SysfsPollingOneShotSensor {
|
||||
+ public:
|
||||
+ UdfpsSensor(int32_t sensorHandle, ISensorsEventCallback* callback)
|
||||
+ : SysfsPollingOneShotSensor(
|
||||
+ sensorHandle, callback, "/sys/class/touch/touch_dev/fod_press_status",
|
||||
+ "/sys/class/touch/touch_dev/fod_longpress_gesture_enabled", "UDFPS Sensor",
|
||||
+ "org.lineageos.sensor.udfps",
|
||||
+ static_cast<SensorType>(static_cast<int32_t>(SensorType::DEVICE_PRIVATE_BASE) +
|
||||
+ 1)) {}
|
||||
+ virtual void fillEventData(Event& event);
|
||||
+ virtual bool readFd(const int fd);
|
||||
+
|
||||
+ private:
|
||||
+ int mScreenX;
|
||||
+ int mScreenY;
|
||||
+};
|
||||
+
|
||||
} // namespace implementation
|
||||
} // namespace subhal
|
||||
} // namespace V2_1
|
||||
diff --git a/sensors/SensorsSubHal.cpp b/sensors/SensorsSubHal.cpp
|
||||
index 6cbcb56..8522213 100644
|
||||
--- a/sensors/SensorsSubHal.cpp
|
||||
+++ b/sensors/SensorsSubHal.cpp
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "SensorsSubHal.h"
|
||||
|
||||
#include <android/hardware/sensors/2.1/types.h>
|
||||
+#include <cutils/properties.h>
|
||||
#include <log/log.h>
|
||||
|
||||
using ::android::hardware::sensors::V2_1::implementation::ISensorsSubHal;
|
||||
@@ -32,7 +33,11 @@ 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) {
|
||||
+ if (property_get_bool("ro.vendor.sensors.xiaomi.udfps", false)) {
|
||||
+ 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,55 @@
|
||||
From f384120189427f03fa4c3b20849e4f71b864351e Mon Sep 17 00:00:00 2001
|
||||
From: Arian <arian.kulmer@web.de>
|
||||
Date: Wed, 29 Mar 2023 17:38:34 +0200
|
||||
Subject: [PATCH 12/15] 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 | 28 ++++++++++++++++++++++++++++
|
||||
1 file changed, 28 insertions(+)
|
||||
|
||||
diff --git a/sensors/Sensor.cpp b/sensors/Sensor.cpp
|
||||
index 646e852..4fcfd86 100644
|
||||
--- a/sensors/Sensor.cpp
|
||||
+++ b/sensors/Sensor.cpp
|
||||
@@ -45,6 +45,34 @@ static bool readBool(int fd, bool seek) {
|
||||
return c != '0';
|
||||
}
|
||||
|
||||
+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 == 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;
|
||||
+ }
|
||||
+ return state > 0;
|
||||
+}
|
||||
+
|
||||
} // anonymous namespace
|
||||
|
||||
namespace android {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 17c39edbeb39b2a28567c8224608216c90010cda Mon Sep 17 00:00:00 2001
|
||||
From 104cd363c19cb2ab5cebb5c2ceb364f99c20cf21 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
|
||||
Subject: [PATCH 13/15] hidl: biometrics: fingerprint: Add enroll methods to
|
||||
udfps handler
|
||||
|
||||
Change-Id: I1b73438ae6bf7e2c0b3fe6d2ca7726993604454b
|
||||
@@ -11,7 +11,7 @@ Change-Id: I1b73438ae6bf7e2c0b3fe6d2ca7726993604454b
|
||||
2 files changed, 14 insertions(+)
|
||||
|
||||
diff --git a/hidl/biometrics/fingerprint/BiometricsFingerprint.cpp b/hidl/biometrics/fingerprint/BiometricsFingerprint.cpp
|
||||
index 9303e08..b305f35 100644
|
||||
index d054fe9..516f2d1 100644
|
||||
--- a/hidl/biometrics/fingerprint/BiometricsFingerprint.cpp
|
||||
+++ b/hidl/biometrics/fingerprint/BiometricsFingerprint.cpp
|
||||
@@ -209,16 +209,25 @@ Return<uint64_t> BiometricsFingerprint::setNotify(
|
||||
@@ -0,0 +1,90 @@
|
||||
From 95d69c4ae3afdfb17a0f0c308d94d4b41c6df6d0 Mon Sep 17 00:00:00 2001
|
||||
From: Arian <arian.kulmer@web.de>
|
||||
Date: Tue, 21 May 2024 12:35:55 +0200
|
||||
Subject: [PATCH 14/15] vibrator: effect: Create double click effect from click
|
||||
if necessary
|
||||
|
||||
Unfortunately, xiaomi did not implement a proper double click effect
|
||||
on many devices. If a device does not provide fifo data for this
|
||||
effect, play the click effect twice with a pause in between instead.
|
||||
|
||||
Co-authored-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
|
||||
Change-Id: Iac1bc924d078b45684072ec64e992a38507e908b
|
||||
---
|
||||
vibrator/effect/Android.bp | 1 +
|
||||
vibrator/effect/effect.cpp | 26 ++++++++++++++++++++++++++
|
||||
2 files changed, 27 insertions(+)
|
||||
|
||||
diff --git a/vibrator/effect/Android.bp b/vibrator/effect/Android.bp
|
||||
index bfd7f11..1ee28e1 100644
|
||||
--- a/vibrator/effect/Android.bp
|
||||
+++ b/vibrator/effect/Android.bp
|
||||
@@ -9,6 +9,7 @@ cc_library_shared {
|
||||
"effect.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
+ "android.hardware.vibrator-V2-ndk",
|
||||
"libbase",
|
||||
"libcutils",
|
||||
"libutils",
|
||||
diff --git a/vibrator/effect/effect.cpp b/vibrator/effect/effect.cpp
|
||||
index a11ba39..5655922 100644
|
||||
--- a/vibrator/effect/effect.cpp
|
||||
+++ b/vibrator/effect/effect.cpp
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#define LOG_TAG "libqtivibratoreffect.xiaomi"
|
||||
|
||||
+#include <aidl/android/hardware/vibrator/Effect.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
@@ -43,6 +44,8 @@
|
||||
|
||||
#include "effect.h"
|
||||
|
||||
+using aidl::android::hardware::vibrator::Effect;
|
||||
+
|
||||
namespace {
|
||||
|
||||
const uint32_t kDefaultPlayRateHz = 24000;
|
||||
@@ -81,6 +84,21 @@ std::unique_ptr<effect_stream> readEffectStreamFromFile(uint32_t uniqueEffectId)
|
||||
result.first->second.data());
|
||||
}
|
||||
|
||||
+std::unique_ptr<effect_stream> duplicateEffect(const effect_stream* effectStream,
|
||||
+ uint32_t newEffectId) {
|
||||
+ const std::uint32_t newEffectLength = effectStream->length * 4;
|
||||
+ std::vector<int8_t> fifoData(newEffectLength);
|
||||
+
|
||||
+ std::copy(effectStream->data, effectStream->data + effectStream->length, fifoData.begin());
|
||||
+ std::copy(effectStream->data, effectStream->data + effectStream->length,
|
||||
+ fifoData.begin() + newEffectLength - effectStream->length);
|
||||
+
|
||||
+ auto result = sEffectFifoData.emplace(newEffectId, std::move(fifoData));
|
||||
+
|
||||
+ return std::make_unique<effect_stream>(newEffectId, newEffectLength, kDefaultPlayRateHz,
|
||||
+ result.first->second.data());
|
||||
+}
|
||||
+
|
||||
} // namespace
|
||||
|
||||
const struct effect_stream* get_effect_stream(uint32_t effectId) {
|
||||
@@ -91,6 +109,14 @@ const struct effect_stream* get_effect_stream(uint32_t effectId) {
|
||||
if (newEffectStream) {
|
||||
auto result = sEffectStreams.emplace(effectId, *newEffectStream);
|
||||
return &result.first->second;
|
||||
+ } else if (effectId == (uint32_t)Effect::DOUBLE_CLICK) {
|
||||
+ LOG(VERBOSE) << "Could not get double click effect, duplicating click effect";
|
||||
+ newEffectStream = duplicateEffect(get_effect_stream((uint32_t)Effect::CLICK),
|
||||
+ (uint32_t)Effect::DOUBLE_CLICK);
|
||||
+ if (newEffectStream) {
|
||||
+ auto result = sEffectStreams.emplace(effectId, *newEffectStream);
|
||||
+ return &result.first->second;
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
return &it->second;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From 249bbdf1fc97b0a519a789828a2abc33518fad70 Mon Sep 17 00:00:00 2001
|
||||
From: Adithya R <gh0strider.2k18.reborn@gmail.com>
|
||||
Date: Fri, 11 Aug 2023 19:33:04 +0530
|
||||
Subject: [PATCH 15/15] vibrator: effect: Fallback to click if an effect is
|
||||
missing
|
||||
|
||||
On some device certain effects can be garbage to the point
|
||||
where its just better to use the default click effect.
|
||||
|
||||
Change-Id: I047f72aaba2a1d56138a6431b5b96f0f626e2e83
|
||||
---
|
||||
vibrator/effect/effect.cpp | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/vibrator/effect/effect.cpp b/vibrator/effect/effect.cpp
|
||||
index 5655922..f09d09a 100644
|
||||
--- a/vibrator/effect/effect.cpp
|
||||
+++ b/vibrator/effect/effect.cpp
|
||||
@@ -117,6 +117,9 @@ const struct effect_stream* get_effect_stream(uint32_t effectId) {
|
||||
auto result = sEffectStreams.emplace(effectId, *newEffectStream);
|
||||
return &result.first->second;
|
||||
}
|
||||
+ } else if (effectId != (uint32_t)Effect::CLICK) {
|
||||
+ LOG(VERBOSE) << "Could not get effect " << effectId << ", falling back to click effect";
|
||||
+ return get_effect_stream((uint32_t)Effect::CLICK);
|
||||
}
|
||||
} else {
|
||||
return &it->second;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
16
patch.sh
16
patch.sh
@@ -3,10 +3,6 @@ cd vendor/lineage
|
||||
git apply ../../patches/vendor/lineage/0001-android-merge_dtbs-Respect-miboard-id-while-merging.patch
|
||||
cd ../../
|
||||
|
||||
# cd device/qcom/sepolicy_vndr/sm8450
|
||||
# git apply ../../../../patches-21/device/qcom/sepolicy_vndr/sm8450/0001-sepolicy_vndr-update-sepolicy-for-health-HAL-service.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
|
||||
@@ -15,13 +11,17 @@ git apply ../../patches/hardware/xiaomi/0004-sensors-Make-sensor-flush-function-
|
||||
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/0008-sensors-Create-sysfs-polling-one-shot-sensor.patch
|
||||
git apply ../../patches/hardware/xiaomi/0009-sensors-Let-the-reading-of-poll-fd-be-configurable.patch
|
||||
git apply ../../patches/hardware/xiaomi/0010-sensors-Add-SysfsPollingOneShotSensor-constructor-wi.patch
|
||||
git apply ../../patches/hardware/xiaomi/0011-sensors-Implement-udfps-long-press-sensor.patch
|
||||
git apply ../../patches/hardware/xiaomi/0012-sensors-Handle-fod-press-status-without-coordinates.patch
|
||||
git apply ../../patches/hardware/xiaomi/0013-hidl-biometrics-fingerprint-Add-enroll-methods-to-ud.patch
|
||||
git apply ../../patches/hardware/xiaomi/0014-vibrator-effect-Create-double-click-effect-from-clic.patch
|
||||
git apply ../../patches/hardware/xiaomi/0015-vibrator-effect-Fallback-to-click-if-an-effect-is-mi.patch
|
||||
cd ../../
|
||||
|
||||
cd frameworks/base
|
||||
git apply ../../patches/frameworks/base/0001-Add-5G-Ultra-Wideband-icon-carrier-config-keys.patch
|
||||
git apply ../../patches/frameworks/base/0002-Fix-default-values-for-5G-Ultra-Wideband-icon-carrie.patch
|
||||
|
||||
|
||||
|
||||
26
repopicks.sh
26
repopicks.sh
@@ -4,12 +4,6 @@ set -e
|
||||
source "build/envsetup.sh";
|
||||
source "vendor/lineage/build/envsetup.sh";
|
||||
|
||||
# device/qcom/sepolicy_vndr/sm8450
|
||||
changes=(
|
||||
383884 # sepolicy_vndr: update sepolicy for health HAL service
|
||||
)
|
||||
repopick -P device/qcom/sepolicy_vndr/sm8450 ${changes[@]}
|
||||
|
||||
# hardware/xiaomi
|
||||
changes=(
|
||||
352657 # Add dummy sensors sub HAL
|
||||
@@ -19,28 +13,30 @@ changes=(
|
||||
352661 # sensors: Make sensor set mode operation function virtual
|
||||
352662 # sensors: Move one shot sensor out of main class
|
||||
352663 # sensors: Fix locking around setOperationMode and activate
|
||||
352664 # sensors: Add udfps long press sensor
|
||||
352664 # sensors: Create sysfs polling one shot sensor
|
||||
392967 # sensors: Let the reading of poll fd be configurable
|
||||
392968 # sensors: Add SysfsPollingOneShotSensor constructor without enable path
|
||||
392969 # sensors: Add udfps long press sensor using SysfsPollingOneShotSensor
|
||||
352665 # sensors: Handle fod_pressed_state without coordinates
|
||||
363160 # hidl: biometrics: fingerprint: Add enroll methods to udfps handler
|
||||
392965 # vibrator: effect: Create double click effect from click if necessary
|
||||
392966 # vibrator: effect: Fallback to click if an effect is missing
|
||||
)
|
||||
repopick -P hardware/xiaomi ${changes[@]}
|
||||
repopick -P hardware/xiaomi ${changes[@]}&
|
||||
|
||||
# frameworks/base
|
||||
changes=(
|
||||
386158 # Add 5G Ultra Wideband icon carrier config keys
|
||||
386159 # Fix default values for 5G Ultra Wideband icon carrier config keys
|
||||
)
|
||||
repopick -P frameworks/base ${changes[@]}
|
||||
repopick -P frameworks/base ${changes[@]}&
|
||||
|
||||
# vendor/lineage
|
||||
changes=(
|
||||
367044 # android: merge_dtbs: Respect miboard-id while merging
|
||||
)
|
||||
repopick -P vendor/lineage ${changes[@]}
|
||||
repopick -P vendor/lineage ${changes[@]}&
|
||||
|
||||
wait
|
||||
|
||||
|
||||
cd hardware/qcom-caf/sm8450/display
|
||||
git pull https://github.com/LineageOS/android_hardware_qcom_display refs/changes/99/384299/1
|
||||
cd ../../../../
|
||||
|
||||
# https://xdaforums.com/t/development-of-lineageos-and-oss-kernel-for-xiaomi-sm-gen-4-5-10-devices.4589247/
|
||||
|
||||
Reference in New Issue
Block a user