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-Note.patch similarity index 81% rename from patches/trebledroid/platform_frameworks_native/0014-Fix-touch-on-Meizu-21.patch rename to patches/trebledroid/platform_frameworks_native/0014-Fix-touch-on-Meizu-21-Note.patch index 16785b6..9de32d1 100644 --- 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-Note.patch @@ -1,21 +1,21 @@ -From 8f1479900dff4ab624a3ad51628d4d04a5698b93 Mon Sep 17 00:00:00 2001 +From 1bbe204e4a28752b3e9e2d2b85276469eaca7d7c 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 +Subject: [PATCH 14/14] Fix touch on Meizu 21 / Note 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(-) + .../accumulator/MultiTouchMotionAccumulator.cpp | 13 +++++++++++-- + .../accumulator/MultiTouchMotionAccumulator.h | 4 ++++ + .../accumulator/SingleTouchMotionAccumulator.cpp | 15 +++++++++++---- + .../accumulator/SingleTouchMotionAccumulator.h | 2 ++ + 4 files changed, 28 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 +index b3f170075c..0d50de0588 100644 --- a/services/inputflinger/reader/mapper/accumulator/MultiTouchMotionAccumulator.cpp +++ b/services/inputflinger/reader/mapper/accumulator/MultiTouchMotionAccumulator.cpp @@ -14,6 +14,8 @@ @@ -27,12 +27,13 @@ index b3f170075c..7a2ecffe00 100644 // clang-format off #include "../Macros.h" // clang-format on -@@ -151,6 +153,12 @@ void MultiTouchMotionAccumulator::populateCurrentSlot( +@@ -151,6 +153,13 @@ void MultiTouchMotionAccumulator::populateCurrentSlot( // --- MultiTouchMotionAccumulator::Slot --- +MultiTouchMotionAccumulator::Slot::Slot() { -+ if (android::base::GetProperty("ro.product.vendor.device", "") == "meizu21") { ++ std::string targetDevice = android::base::GetProperty("ro.product.vendor.device", ""); ++ if (targetDevice == "meizu21" || targetDevice == "Meizu21Note") { + mAbsMtPositionXYRatio = 10; + } +} @@ -40,7 +41,7 @@ index b3f170075c..7a2ecffe00 100644 ToolType MultiTouchMotionAccumulator::Slot::getToolType() const { if (mHaveAbsMtToolType) { switch (mAbsMtToolType) { -@@ -168,10 +176,10 @@ ToolType MultiTouchMotionAccumulator::Slot::getToolType() const { +@@ -168,10 +177,10 @@ ToolType MultiTouchMotionAccumulator::Slot::getToolType() const { void MultiTouchMotionAccumulator::Slot::populateAxisValue(int32_t axisCode, int32_t value) { switch (axisCode) { case ABS_MT_POSITION_X: @@ -76,7 +77,7 @@ index a0f21470c4..e82b7df1ba 100644 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 +index 27b8e40fc6..fe37638103 100644 --- a/services/inputflinger/reader/mapper/accumulator/SingleTouchMotionAccumulator.cpp +++ b/services/inputflinger/reader/mapper/accumulator/SingleTouchMotionAccumulator.cpp @@ -14,6 +14,8 @@ @@ -88,12 +89,13 @@ index 27b8e40fc6..e33b229221 100644 #include "SingleTouchMotionAccumulator.h" #include "EventHub.h" -@@ -23,11 +25,15 @@ namespace android { +@@ -23,11 +25,16 @@ namespace android { SingleTouchMotionAccumulator::SingleTouchMotionAccumulator() { clearAbsoluteAxes(); + -+ if (android::base::GetProperty("ro.product.vendor.device", "") == "meizu21") { ++ std::string targetDevice = android::base::GetProperty("ro.product.vendor.device", ""); ++ if (targetDevice == "meizu21" || targetDevice == "Meizu21Note") { + mAbsXYRatio = 10; + } } @@ -106,7 +108,7 @@ index 27b8e40fc6..e33b229221 100644 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) { +@@ -49,10 +56,10 @@ void SingleTouchMotionAccumulator::process(const RawEvent* rawEvent) { if (rawEvent->type == EV_ABS) { switch (rawEvent->code) { case ABS_X: