Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

launcher: a gamepad needs the joystick bits too, so TCL's virtual-search keyboard is not one

Guilherme8fbb9529c645
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/GamepadPassthrough.java b/launcher/app/src/main/java/com/gathin/tvhome/GamepadPassthrough.java
index ee34f7a4e..4bccd3e0c 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/GamepadPassthrough.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/GamepadPassthrough.java
@@ -33,11 +33,14 @@ final class GamepadPassthrough implements InputManager.InputDeviceListener {
}
/**
- * A gamepad has all the SOURCE_GAMEPAD bits. SOURCE_JOYSTICK alone is not enough: Bluetooth voice remotes report
- * it too (TCL's BT_RC833_U1: 0x01000311, an Xbox controller: 0x01000511).
+ * A gamepad has all the SOURCE_GAMEPAD bits and the SOURCE_JOYSTICK ones, as dumpsys input reports them on a TCL
+ * G07. Either alone is not enough: the Bluetooth voice remote reports a joystick (BT_RC833_U1: 0x01000311), and
+ * the firmware's virtual-search keyboard, which isVirtual() misses, reports a gamepad (0x00000701). An Xbox
+ * controller reports both (0x01000511).
*/
static boolean isGamepad(int sources) {
- return (sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD;
+ return (sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD
+ && (sources & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK;
}
private boolean gamepadConnected() {
diff --git a/launcher/app/src/test/java/com/gathin/tvhome/GamepadPassthroughTest.java b/launcher/app/src/test/java/com/gathin/tvhome/GamepadPassthroughTest.java
index f3fc5902e..b06dea326 100644
--- a/launcher/app/src/test/java/com/gathin/tvhome/GamepadPassthroughTest.java
+++ b/launcher/app/src/test/java/com/gathin/tvhome/GamepadPassthroughTest.java
@@ -14,6 +14,10 @@ public class GamepadPassthroughTest {
assertFalse(GamepadPassthrough.isGamepad(0x01000311));
}
+ @Test public void virtualSearchKeyboardIsNot() {
+ assertFalse(GamepadPassthrough.isGamepad(0x00000701));
+ }
+
@Test public void keypadIsNot() {
assertFalse(GamepadPassthrough.isGamepad(0x00000101));
}