From 54313e4ec1872795674ca3c6696b3fbea5a64665 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 18 Aug 2024 01:08:12 +0000 Subject: [PATCH] feat: sync with latest sources of TrebleDroid [via Ponces] --- ...ed-to-send-a-hack-message-to-HAL-to-.patch | 2 +- ...n-input-with-a-display-uses-uniqueId.patch | 2 +- ...n-t-exist-in-O-P-so-detect-its-suppo.patch | 2 +- ...Samsung-system-permission-on-sensors.patch | 2 +- ...er-input-as-sensor-exclusively-if-th.patch | 2 +- ...ide-their-vibrator-HAL-behind-non-de.patch | 2 +- ...er-Add-support-Samsung-miscpower-HAL.patch | 2 +- ...008-FOD-support-for-Samsung-and-Asus.patch | 2 +- ...support-to-fix-broken-Mediatek-gpufr.patch | 2 +- .../0010-Fix-loading-unnamed-GLES.patch | 2 +- .../0011-Increase-SW_MAX-4.patch | 2 +- ...le-gpuservice-on-old-BPF-less-kernel.patch | 2 +- ...eFlinger-Disable-SF-HWC-backpressure.patch | 2 +- .../0014-Fix-touch-on-Meizu-21.patch | 137 ++++++++++++++++++ 14 files changed, 150 insertions(+), 13 deletions(-) create mode 100644 patches/trebledroid/platform_frameworks_native/0014-Fix-touch-on-Meizu-21.patch diff --git a/patches/trebledroid/platform_frameworks_native/0001-On-Samsung-we-need-to-send-a-hack-message-to-HAL-to-.patch b/patches/trebledroid/platform_frameworks_native/0001-On-Samsung-we-need-to-send-a-hack-message-to-HAL-to-.patch index 0bcb2063..274694bc 100644 --- a/patches/trebledroid/platform_frameworks_native/0001-On-Samsung-we-need-to-send-a-hack-message-to-HAL-to-.patch +++ b/patches/trebledroid/platform_frameworks_native/0001-On-Samsung-we-need-to-send-a-hack-message-to-HAL-to-.patch @@ -1,7 +1,7 @@ From 50db1f171c6f2833f5f146190b6da249919e11bc Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Wed, 14 Aug 2019 23:37:10 +0200 -Subject: [PATCH 01/13] On Samsung, we need to send a hack-message to HAL to +Subject: [PATCH 01/14] On Samsung, we need to send a hack-message to HAL to get all Sensors Change-Id: Id6a1fa48340de61c418493668e9abd22c2599376 diff --git a/patches/trebledroid/platform_frameworks_native/0002-Matching-an-input-with-a-display-uses-uniqueId.patch b/patches/trebledroid/platform_frameworks_native/0002-Matching-an-input-with-a-display-uses-uniqueId.patch index 312d91d1..a6748a58 100644 --- a/patches/trebledroid/platform_frameworks_native/0002-Matching-an-input-with-a-display-uses-uniqueId.patch +++ b/patches/trebledroid/platform_frameworks_native/0002-Matching-an-input-with-a-display-uses-uniqueId.patch @@ -1,7 +1,7 @@ From 6dcdf89f11eeb4af174a07c966e902c523ba265c Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Thu, 22 Oct 2020 23:22:46 +0200 -Subject: [PATCH 02/13] Matching an input with a display uses uniqueId +Subject: [PATCH 02/14] Matching an input with a display uses uniqueId Not all devices have a `location`, notably bluetooth devices. However, we might still want to associate them with a screen, diff --git a/patches/trebledroid/platform_frameworks_native/0003-unshared_oob-didn-t-exist-in-O-P-so-detect-its-suppo.patch b/patches/trebledroid/platform_frameworks_native/0003-unshared_oob-didn-t-exist-in-O-P-so-detect-its-suppo.patch index 40866039..de158827 100644 --- a/patches/trebledroid/platform_frameworks_native/0003-unshared_oob-didn-t-exist-in-O-P-so-detect-its-suppo.patch +++ b/patches/trebledroid/platform_frameworks_native/0003-unshared_oob-didn-t-exist-in-O-P-so-detect-its-suppo.patch @@ -1,7 +1,7 @@ From db878a2dce60d6a19e2d4ea8cc80317e1d159710 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Tue, 5 Jan 2021 23:44:00 +0100 -Subject: [PATCH 03/13] unshared_oob didn't exist in O/P, so detect its +Subject: [PATCH 03/14] unshared_oob didn't exist in O/P, so detect its supported based on vndk version --- diff --git a/patches/trebledroid/platform_frameworks_native/0004-Remove-Samsung-system-permission-on-sensors.patch b/patches/trebledroid/platform_frameworks_native/0004-Remove-Samsung-system-permission-on-sensors.patch index 2f7abf50..1fb24727 100644 --- a/patches/trebledroid/platform_frameworks_native/0004-Remove-Samsung-system-permission-on-sensors.patch +++ b/patches/trebledroid/platform_frameworks_native/0004-Remove-Samsung-system-permission-on-sensors.patch @@ -1,7 +1,7 @@ From 90afacd9625b2ff98e8a22ac8bcc8682cf90b693 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Wed, 31 Mar 2021 23:36:03 +0200 -Subject: [PATCH 04/13] Remove Samsung system permission on sensors +Subject: [PATCH 04/14] Remove Samsung system permission on sensors --- libs/sensor/Sensor.cpp | 1 + diff --git a/patches/trebledroid/platform_frameworks_native/0005-Mark-accelerometer-input-as-sensor-exclusively-if-th.patch b/patches/trebledroid/platform_frameworks_native/0005-Mark-accelerometer-input-as-sensor-exclusively-if-th.patch index 35bd51b8..d3673e47 100644 --- a/patches/trebledroid/platform_frameworks_native/0005-Mark-accelerometer-input-as-sensor-exclusively-if-th.patch +++ b/patches/trebledroid/platform_frameworks_native/0005-Mark-accelerometer-input-as-sensor-exclusively-if-th.patch @@ -1,7 +1,7 @@ From e0d0fce849431dd86dbc6f770919b209ec8da9de Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Sun, 12 Dec 2021 08:45:36 -0500 -Subject: [PATCH 05/13] Mark accelerometer input as sensor exclusively if there +Subject: [PATCH 05/14] Mark accelerometer input as sensor exclusively if there are ABS axis The reason this is needed is that on -fucked up- Xiami Mi A2 Lite and diff --git a/patches/trebledroid/platform_frameworks_native/0006-MIUI13-devices-hide-their-vibrator-HAL-behind-non-de.patch b/patches/trebledroid/platform_frameworks_native/0006-MIUI13-devices-hide-their-vibrator-HAL-behind-non-de.patch index 80971a49..c881e847 100644 --- a/patches/trebledroid/platform_frameworks_native/0006-MIUI13-devices-hide-their-vibrator-HAL-behind-non-de.patch +++ b/patches/trebledroid/platform_frameworks_native/0006-MIUI13-devices-hide-their-vibrator-HAL-behind-non-de.patch @@ -1,7 +1,7 @@ From d0d340a845cccd76e21b9f15f12cbe7457d839e3 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Fri, 25 Mar 2022 05:37:56 -0400 -Subject: [PATCH 06/13] MIUI13 devices hide their vibrator HAL behind +Subject: [PATCH 06/14] MIUI13 devices hide their vibrator HAL behind non-default name: "vibratorfeature" --- diff --git a/patches/trebledroid/platform_frameworks_native/0007-powermanager-Add-support-Samsung-miscpower-HAL.patch b/patches/trebledroid/platform_frameworks_native/0007-powermanager-Add-support-Samsung-miscpower-HAL.patch index 6f09c314..aaec8847 100644 --- a/patches/trebledroid/platform_frameworks_native/0007-powermanager-Add-support-Samsung-miscpower-HAL.patch +++ b/patches/trebledroid/platform_frameworks_native/0007-powermanager-Add-support-Samsung-miscpower-HAL.patch @@ -1,7 +1,7 @@ From a38497ff4222dfb75efd39a079935e421d0578f4 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Mon, 27 Dec 2021 18:00:43 -0500 -Subject: [PATCH 07/13] powermanager: Add support Samsung miscpower HAL +Subject: [PATCH 07/14] powermanager: Add support Samsung miscpower HAL Several various configurations need to be supported: - Android Pie vendors have a android.hardware.power HIDL default + "miscpower" diff --git a/patches/trebledroid/platform_frameworks_native/0008-FOD-support-for-Samsung-and-Asus.patch b/patches/trebledroid/platform_frameworks_native/0008-FOD-support-for-Samsung-and-Asus.patch index 2537132e..dd296548 100644 --- a/patches/trebledroid/platform_frameworks_native/0008-FOD-support-for-Samsung-and-Asus.patch +++ b/patches/trebledroid/platform_frameworks_native/0008-FOD-support-for-Samsung-and-Asus.patch @@ -1,7 +1,7 @@ From 2ed23f83325f00f3d8e935b8e9ea3c63f1674af3 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Sun, 18 Dec 2022 18:17:30 -0500 -Subject: [PATCH 08/13] FOD support for Samsung and Asus +Subject: [PATCH 08/14] FOD support for Samsung and Asus --- libs/gui/BLASTBufferQueue.cpp | 20 ++++++++++++++-- diff --git a/patches/trebledroid/platform_frameworks_native/0009-Add-MTK-GED-KPI-support-to-fix-broken-Mediatek-gpufr.patch b/patches/trebledroid/platform_frameworks_native/0009-Add-MTK-GED-KPI-support-to-fix-broken-Mediatek-gpufr.patch index ba9975ae..c63b52db 100644 --- a/patches/trebledroid/platform_frameworks_native/0009-Add-MTK-GED-KPI-support-to-fix-broken-Mediatek-gpufr.patch +++ b/patches/trebledroid/platform_frameworks_native/0009-Add-MTK-GED-KPI-support-to-fix-broken-Mediatek-gpufr.patch @@ -1,7 +1,7 @@ From 0e3e58ee51ebf509fd662fe1146f723b185dd542 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Sat, 25 Nov 2023 08:15:28 -0500 -Subject: [PATCH 09/13] Add MTK GED KPI support to fix broken Mediatek gpufreq +Subject: [PATCH 09/14] Add MTK GED KPI support to fix broken Mediatek gpufreq Mediatek GPU scheduler likes to have the timestamps of the frames to be able to adjust DVFS. diff --git a/patches/trebledroid/platform_frameworks_native/0010-Fix-loading-unnamed-GLES.patch b/patches/trebledroid/platform_frameworks_native/0010-Fix-loading-unnamed-GLES.patch index c0e169e4..317afe35 100644 --- a/patches/trebledroid/platform_frameworks_native/0010-Fix-loading-unnamed-GLES.patch +++ b/patches/trebledroid/platform_frameworks_native/0010-Fix-loading-unnamed-GLES.patch @@ -1,7 +1,7 @@ From 71510732a097c837a83861b0f03c1305dfa2d404 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Wed, 20 Dec 2023 09:48:04 -0500 -Subject: [PATCH 10/13] Fix loading unnamed GLES +Subject: [PATCH 10/14] Fix loading unnamed GLES Normally Android loads libGLES_${ro.hardware.egl}.so But up to Android 14, it was allowed not to set ro.hardware.egl diff --git a/patches/trebledroid/platform_frameworks_native/0011-Increase-SW_MAX-4.patch b/patches/trebledroid/platform_frameworks_native/0011-Increase-SW_MAX-4.patch index a027c252..2734465d 100644 --- a/patches/trebledroid/platform_frameworks_native/0011-Increase-SW_MAX-4.patch +++ b/patches/trebledroid/platform_frameworks_native/0011-Increase-SW_MAX-4.patch @@ -1,7 +1,7 @@ From 42f8375463aa6de1cc8b140e5e7df12758bc707b Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Sat, 3 Feb 2024 07:38:33 -0500 -Subject: [PATCH 11/13] Increase SW_MAX *= 4 +Subject: [PATCH 11/14] Increase SW_MAX *= 4 We increase the size of SW_MAX for two reasons: 1. SW_MACHINE_COVER which is SW_MAX is ignored, guessing an off by one diff --git a/patches/trebledroid/platform_frameworks_native/0012-Disable-gpuservice-on-old-BPF-less-kernel.patch b/patches/trebledroid/platform_frameworks_native/0012-Disable-gpuservice-on-old-BPF-less-kernel.patch index 22a84c9f..b77b3bbd 100644 --- a/patches/trebledroid/platform_frameworks_native/0012-Disable-gpuservice-on-old-BPF-less-kernel.patch +++ b/patches/trebledroid/platform_frameworks_native/0012-Disable-gpuservice-on-old-BPF-less-kernel.patch @@ -1,7 +1,7 @@ From 781e66a1e51e184970de933428825d2b4cc958bb Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Tue, 7 May 2024 22:34:40 +0000 -Subject: [PATCH 12/13] Disable gpuservice on old BPF-less kernel +Subject: [PATCH 12/14] Disable gpuservice on old BPF-less kernel Change-Id: I8e1626e2e9d12ee0dc03d758799bc88085899476 --- diff --git a/patches/trebledroid/platform_frameworks_native/0013-SurfaceFlinger-Disable-SF-HWC-backpressure.patch b/patches/trebledroid/platform_frameworks_native/0013-SurfaceFlinger-Disable-SF-HWC-backpressure.patch index 6d651c07..f2f86765 100644 --- a/patches/trebledroid/platform_frameworks_native/0013-SurfaceFlinger-Disable-SF-HWC-backpressure.patch +++ b/patches/trebledroid/platform_frameworks_native/0013-SurfaceFlinger-Disable-SF-HWC-backpressure.patch @@ -1,7 +1,7 @@ From a84523098370e545cbf7c8bc29b4a5812c91a624 Mon Sep 17 00:00:00 2001 From: Andy CrossGate Yan Date: Sun, 26 May 2024 21:34:17 +0800 -Subject: [PATCH 13/13] SurfaceFlinger: Disable SF HWC backpressure +Subject: [PATCH 13/14] SurfaceFlinger: Disable SF HWC backpressure --- services/surfaceflinger/SurfaceFlinger.cpp | 3 ++- diff --git a/patches/trebledroid/platform_frameworks_native/0014-Fix-touch-on-Meizu-21.patch b/patches/trebledroid/platform_frameworks_native/0014-Fix-touch-on-Meizu-21.patch new file mode 100644 index 00000000..16785b6a --- /dev/null +++ b/patches/trebledroid/platform_frameworks_native/0014-Fix-touch-on-Meizu-21.patch @@ -0,0 +1,137 @@ +From 8f1479900dff4ab624a3ad51628d4d04a5698b93 Mon Sep 17 00:00:00 2001 +From: Andy CrossGate Yan +Date: Sat, 17 Aug 2024 20:49:53 +0800 +Subject: [PATCH 14/14] Fix touch on Meizu 21 + +Raw values from the panel are multiplied by 10, +causing most touch events to fall out of bounds and get dropped + +Change-Id: If854a814dee784a2693cc4597169107d6b8561f3 +--- + .../accumulator/MultiTouchMotionAccumulator.cpp | 12 ++++++++++-- + .../accumulator/MultiTouchMotionAccumulator.h | 4 ++++ + .../accumulator/SingleTouchMotionAccumulator.cpp | 14 ++++++++++---- + .../accumulator/SingleTouchMotionAccumulator.h | 2 ++ + 4 files changed, 26 insertions(+), 6 deletions(-) + +diff --git a/services/inputflinger/reader/mapper/accumulator/MultiTouchMotionAccumulator.cpp b/services/inputflinger/reader/mapper/accumulator/MultiTouchMotionAccumulator.cpp +index b3f170075c..7a2ecffe00 100644 +--- a/services/inputflinger/reader/mapper/accumulator/MultiTouchMotionAccumulator.cpp ++++ b/services/inputflinger/reader/mapper/accumulator/MultiTouchMotionAccumulator.cpp +@@ -14,6 +14,8 @@ + * limitations under the License. + */ + ++#include ++ + // clang-format off + #include "../Macros.h" + // clang-format on +@@ -151,6 +153,12 @@ void MultiTouchMotionAccumulator::populateCurrentSlot( + + // --- MultiTouchMotionAccumulator::Slot --- + ++MultiTouchMotionAccumulator::Slot::Slot() { ++ if (android::base::GetProperty("ro.product.vendor.device", "") == "meizu21") { ++ mAbsMtPositionXYRatio = 10; ++ } ++} ++ + ToolType MultiTouchMotionAccumulator::Slot::getToolType() const { + if (mHaveAbsMtToolType) { + switch (mAbsMtToolType) { +@@ -168,10 +176,10 @@ ToolType MultiTouchMotionAccumulator::Slot::getToolType() const { + void MultiTouchMotionAccumulator::Slot::populateAxisValue(int32_t axisCode, int32_t value) { + switch (axisCode) { + case ABS_MT_POSITION_X: +- mAbsMtPositionX = value; ++ mAbsMtPositionX = value / mAbsMtPositionXYRatio; + break; + case ABS_MT_POSITION_Y: +- mAbsMtPositionY = value; ++ mAbsMtPositionY = value / mAbsMtPositionXYRatio; + break; + case ABS_MT_TOUCH_MAJOR: + mAbsMtTouchMajor = value; +diff --git a/services/inputflinger/reader/mapper/accumulator/MultiTouchMotionAccumulator.h b/services/inputflinger/reader/mapper/accumulator/MultiTouchMotionAccumulator.h +index a0f21470c4..e82b7df1ba 100644 +--- a/services/inputflinger/reader/mapper/accumulator/MultiTouchMotionAccumulator.h ++++ b/services/inputflinger/reader/mapper/accumulator/MultiTouchMotionAccumulator.h +@@ -30,6 +30,8 @@ class MultiTouchMotionAccumulator { + public: + class Slot { + public: ++ Slot(); ++ + inline bool isInUse() const { return mInUse; } + inline int32_t getX() const { return mAbsMtPositionX; } + inline int32_t getY() const { return mAbsMtPositionY; } +@@ -67,6 +69,8 @@ public: + int32_t mAbsMtDistance = 0; + int32_t mAbsMtToolType = 0; + ++ int32_t mAbsMtPositionXYRatio = 1; ++ + void clear() { *this = Slot(); } + void populateAxisValue(int32_t axisCode, int32_t value); + }; +diff --git a/services/inputflinger/reader/mapper/accumulator/SingleTouchMotionAccumulator.cpp b/services/inputflinger/reader/mapper/accumulator/SingleTouchMotionAccumulator.cpp +index 27b8e40fc6..e33b229221 100644 +--- a/services/inputflinger/reader/mapper/accumulator/SingleTouchMotionAccumulator.cpp ++++ b/services/inputflinger/reader/mapper/accumulator/SingleTouchMotionAccumulator.cpp +@@ -14,6 +14,8 @@ + * limitations under the License. + */ + ++#include ++ + #include "SingleTouchMotionAccumulator.h" + + #include "EventHub.h" +@@ -23,11 +25,15 @@ namespace android { + + SingleTouchMotionAccumulator::SingleTouchMotionAccumulator() { + clearAbsoluteAxes(); ++ ++ if (android::base::GetProperty("ro.product.vendor.device", "") == "meizu21") { ++ mAbsXYRatio = 10; ++ } + } + + void SingleTouchMotionAccumulator::reset(InputDeviceContext& deviceContext) { +- mAbsX = deviceContext.getAbsoluteAxisValue(ABS_X); +- mAbsY = deviceContext.getAbsoluteAxisValue(ABS_Y); ++ mAbsX = deviceContext.getAbsoluteAxisValue(ABS_X) / mAbsXYRatio; ++ mAbsY = deviceContext.getAbsoluteAxisValue(ABS_Y) / mAbsXYRatio; + mAbsPressure = deviceContext.getAbsoluteAxisValue(ABS_PRESSURE); + mAbsToolWidth = deviceContext.getAbsoluteAxisValue(ABS_TOOL_WIDTH); + mAbsDistance = deviceContext.getAbsoluteAxisValue(ABS_DISTANCE); +@@ -49,10 +55,10 @@ void SingleTouchMotionAccumulator::process(const RawEvent* rawEvent) { + if (rawEvent->type == EV_ABS) { + switch (rawEvent->code) { + case ABS_X: +- mAbsX = rawEvent->value; ++ mAbsX = rawEvent->value / mAbsXYRatio; + break; + case ABS_Y: +- mAbsY = rawEvent->value; ++ mAbsY = rawEvent->value / mAbsXYRatio; + break; + case ABS_PRESSURE: + mAbsPressure = rawEvent->value; +diff --git a/services/inputflinger/reader/mapper/accumulator/SingleTouchMotionAccumulator.h b/services/inputflinger/reader/mapper/accumulator/SingleTouchMotionAccumulator.h +index 93056f06e6..59b8298a34 100644 +--- a/services/inputflinger/reader/mapper/accumulator/SingleTouchMotionAccumulator.h ++++ b/services/inputflinger/reader/mapper/accumulator/SingleTouchMotionAccumulator.h +@@ -48,6 +48,8 @@ private: + int32_t mAbsTiltX; + int32_t mAbsTiltY; + ++ int32_t mAbsXYRatio = 1; ++ + void clearAbsoluteAxes(); + }; + +-- +2.34.1 +