1
0
mirror of https://github.com/yurisieucuti/treble_evolution.git synced 2024-11-14 10:17:02 +00:00
treble_evolution/patches/platform_frameworks_native/0011-Increase-SW_MAX-4.patch
2024-04-24 15:13:17 +00:00

56 lines
2.1 KiB
Diff

From 9244db7472836e5ffeea05b61117b0895b6ec370 Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Sat, 3 Feb 2024 07:38:33 -0500
Subject: [PATCH 11/11] 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
somwehere
2. Samsung extends SW_ beyond standard SW_MAX. SW_FLIP goes to 0x15,
standard SW_MAX 0x10
---
services/inputflinger/reader/EventHub.cpp | 4 ++--
services/inputflinger/reader/include/EventHub.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/services/inputflinger/reader/EventHub.cpp b/services/inputflinger/reader/EventHub.cpp
index ad2394d791..18742c6b37 100644
--- a/services/inputflinger/reader/EventHub.cpp
+++ b/services/inputflinger/reader/EventHub.cpp
@@ -1112,7 +1112,7 @@ int32_t EventHub::getKeyCodeForKeyLocation(int32_t deviceId, int32_t locationKey
}
int32_t EventHub::getSwitchState(int32_t deviceId, int32_t sw) const {
- if (sw < 0 || sw > SW_MAX) {
+ if (sw < 0 || sw > (SW_MAX*4)) {
return AKEY_STATE_UNKNOWN;
}
std::scoped_lock _l(mLock);
@@ -2419,7 +2419,7 @@ void EventHub::openDeviceLocked(const std::string& devicePath) {
}
// Check whether this device has switches.
- for (int i = 0; i <= SW_MAX; i++) {
+ for (int i = 0; i <= (SW_MAX * 4); i++) {
if (device->swBitmask.test(i)) {
device->classes |= InputDeviceClass::SWITCH;
break;
diff --git a/services/inputflinger/reader/include/EventHub.h b/services/inputflinger/reader/include/EventHub.h
index 0bcab42417..5659ffb006 100644
--- a/services/inputflinger/reader/include/EventHub.h
+++ b/services/inputflinger/reader/include/EventHub.h
@@ -629,8 +629,8 @@ private:
BitArray<KEY_CNT> keyBitmask;
BitArray<KEY_CNT> keyState;
BitArray<REL_CNT> relBitmask;
- BitArray<SW_CNT> swBitmask;
- BitArray<SW_CNT> swState;
+ BitArray<SW_CNT * 4> swBitmask;
+ BitArray<SW_CNT * 4> swState;
BitArray<LED_CNT> ledBitmask;
BitArray<FF_CNT> ffBitmask;
BitArray<INPUT_PROP_CNT> propBitmask;
--
2.25.1