mirror of
https://github.com/yurisieucuti/treble_evolution.git
synced 2024-11-24 08:36:19 +00:00
57 lines
2.6 KiB
Diff
57 lines
2.6 KiB
Diff
From 3cbdeea0a18aab35b665192e717ef5d2f5dc2482 Mon Sep 17 00:00:00 2001
|
|
From: Pierre-Hugues Husson <phh@phh.me>
|
|
Date: Sun, 4 Feb 2024 18:01:07 -0500
|
|
Subject: [PATCH 47/51] Some Samsung devices use SW_FLIP 0x15 rather than
|
|
SW_MACHINE_COVER 0x10, so use that
|
|
|
|
---
|
|
.../server/input/InputManagerService.java | 25 +++++++++++++------
|
|
1 file changed, 18 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
|
|
index 2f813324b75f..09f8e2a337cd 100644
|
|
--- a/services/core/java/com/android/server/input/InputManagerService.java
|
|
+++ b/services/core/java/com/android/server/input/InputManagerService.java
|
|
@@ -375,6 +375,8 @@ public class InputManagerService extends IInputManager.Stub
|
|
|
|
/** Switch code: Cover. When set, the cover is closed. */
|
|
public static final int SW_MACHINE_COVER = 0x10;
|
|
+ // Samsung
|
|
+ public static final int SW_FLIP = 0x15;
|
|
|
|
public static final int SW_LID_BIT = 1 << SW_LID;
|
|
public static final int SW_TABLET_MODE_BIT = 1 << SW_TABLET_MODE;
|
|
@@ -500,13 +502,22 @@ public class InputManagerService extends IInputManager.Stub
|
|
}
|
|
|
|
private void checkForSwMachineCover() {
|
|
- int machineCoverState = getSwitchState(-1 /* deviceId */, InputDevice.SOURCE_ANY, SW_MACHINE_COVER);
|
|
- if (machineCoverState != KEY_STATE_UNKNOWN) {
|
|
- android.util.Log.e("PHH", "Found a SW_MACHINE_COVER. Use this instead of SW_LID");
|
|
- mSwForLid = SW_MACHINE_COVER;
|
|
- } else {
|
|
- android.util.Log.e("PHH", "Not found a SW_MACHINE_COVER");
|
|
- }
|
|
+ int machineCoverState = getSwitchState(-1, InputDevice.SOURCE_ANY, SW_MACHINE_COVER);
|
|
+ if (machineCoverState != KEY_STATE_UNKNOWN) {
|
|
+ android.util.Log.e("PHH", "Found a SW_MACHINE_COVER. Use this instead of SW_LID");
|
|
+ mSwForLid = SW_MACHINE_COVER;
|
|
+ } else {
|
|
+ android.util.Log.e("PHH", "Not found a SW_MACHINE_COVER");
|
|
+ }
|
|
+
|
|
+ int flip = getSwitchState(-1, InputDevice.SOURCE_ANY, SW_FLIP);
|
|
+ if (flip != KEY_STATE_UNKNOWN) {
|
|
+ android.util.Log.e("PHH", "Found a SW_FLIP. Use this instead of SW_LID");
|
|
+ mSwForLid = SW_FLIP;
|
|
+ } else {
|
|
+ android.util.Log.e("PHH", "Not found a SW_FLIP");
|
|
+ }
|
|
+ android.util.Log.e("PHH", "Switch state got " + machineCoverState + " and " + flip);
|
|
}
|
|
|
|
void registerLidSwitchCallbackInternal(@NonNull LidSwitchCallback callback) {
|
|
--
|
|
2.25.1
|
|
|