Skip to content

Commit

Permalink
feat: sync with latest sources of TrebleDroid
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Aug 18, 2024
1 parent 0d61572 commit 4f727ac
Show file tree
Hide file tree
Showing 14 changed files with 150 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 50db1f171c6f2833f5f146190b6da249919e11bc Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <[email protected]>
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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 6dcdf89f11eeb4af174a07c966e902c523ba265c Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <[email protected]>
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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From db878a2dce60d6a19e2d4ea8cc80317e1d159710 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <[email protected]>
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

---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 90afacd9625b2ff98e8a22ac8bcc8682cf90b693 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <[email protected]>
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 +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From e0d0fce849431dd86dbc6f770919b209ec8da9de Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <[email protected]>
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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From d0d340a845cccd76e21b9f15f12cbe7457d839e3 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <[email protected]>
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"

---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From a38497ff4222dfb75efd39a079935e421d0578f4 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <[email protected]>
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"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 2ed23f83325f00f3d8e935b8e9ea3c63f1674af3 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <[email protected]>
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 ++++++++++++++--
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 0e3e58ee51ebf509fd662fe1146f723b185dd542 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <[email protected]>
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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 71510732a097c837a83861b0f03c1305dfa2d404 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <[email protected]>
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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 42f8375463aa6de1cc8b140e5e7df12758bc707b Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <[email protected]>
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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 781e66a1e51e184970de933428825d2b4cc958bb Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <[email protected]>
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
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From a84523098370e545cbf7c8bc29b4a5812c91a624 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <[email protected]>
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 ++-
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
From 8f1479900dff4ab624a3ad51628d4d04a5698b93 Mon Sep 17 00:00:00 2001
From: Andy CrossGate Yan <[email protected]>
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 <android-base/properties.h>
+
// 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 <android-base/properties.h>
+
#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

0 comments on commit 4f727ac

Please sign in to comment.