Skip to content

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

launcher: InputKeyService also opens the input switcher for KEYCODE_TV_INPUT

iytsd0f6435a18ee
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md
index 6fd0137db..d4f85057b 100644
--- a/docs/TROUBLESHOOTING.md
+++ b/docs/TROUBLESHOOTING.md
@@ -122,7 +122,7 @@ tools/tv.py 'dumpsys accessibility'
| Helper | Component in the enabled-services list | Key it filters |
| --- | --- | --- |
| Home button | `com.gathin.tvhome/.HomeKeyService` | `KEYCODE_ALL_APPS` (not an ordinary `KEYCODE_HOME`) |
-| Input button | `com.gathin.tvhome/.InputKeyService` | `KEYCODE_TV` |
+| Input button | `com.gathin.tvhome/.InputKeyService` | `KEYCODE_TV`, `KEYCODE_TV_INPUT` |
- **Enabled** means the component is in that user's colon-separated list (the class may be written in
full, `com.gathin.tvhome/com.gathin.tvhome.HomeKeyService`). Match the whole component.
diff --git a/launcher/app/src/main/AndroidManifest.xml b/launcher/app/src/main/AndroidManifest.xml
index fbf0f9eee..17d96ef3c 100644
--- a/launcher/app/src/main/AndroidManifest.xml
+++ b/launcher/app/src/main/AndroidManifest.xml
@@ -112,7 +112,7 @@
</intent-filter>
</service>
- <!-- The remote's Input button (KEYCODE_TV) opens the input switcher; see InputKeyService. -->
+ <!-- The remote's Input button (KEYCODE_TV or KEYCODE_TV_INPUT) opens the input switcher; see InputKeyService. -->
<service
android:name=".InputKeyService"
android:exported="false"
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/InputKeyService.java b/launcher/app/src/main/java/com/gathin/tvhome/InputKeyService.java
index f3a684c68..2c2585b4f 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/InputKeyService.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/InputKeyService.java
@@ -8,8 +8,9 @@ import android.view.accessibility.AccessibilityEvent;
/**
* Maps the remote's Input button to the system input switcher, from any app. Remotes such as the Chromecast voice
- * remote send KEYCODE_TV for it; on Google TV the stock launcher handles that key, so with the stock launcher
- * disabled the button does nothing. Only KEYCODE_TV is consumed; every other key passes through untouched.
+ * remote send KEYCODE_TV for it, others (KTC and Kalley Realtek Google TV remotes) KEYCODE_TV_INPUT; on Google TV
+ * the stock launcher handles both, so with the stock launcher disabled the button does nothing. Only those two
+ * keys are consumed; every other key passes through untouched.
* Opt-in: INPUT_KEY_SERVICE=1 build-and-install.sh (or -InputKeyService on Windows) enables it.
*/
public class InputKeyService extends AccessibilityService {
@@ -18,7 +19,8 @@ public class InputKeyService extends AccessibilityService {
@Override
protected boolean onKeyEvent(KeyEvent event) {
- if (event.getKeyCode() != KeyEvent.KEYCODE_TV) return false;
+ int code = event.getKeyCode();
+ if (code != KeyEvent.KEYCODE_TV && code != KeyEvent.KEYCODE_TV_INPUT) return false;
if (event.getAction() == KeyEvent.ACTION_UP) {
try {
startActivity(new Intent(ACTION_VIEW_INPUTS).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
diff --git a/launcher/build-and-install.sh b/launcher/build-and-install.sh
index e00685245..ba2cbf87d 100755
--- a/launcher/build-and-install.sh
+++ b/launcher/build-and-install.sh
@@ -147,7 +147,7 @@ esac
# Optional accessibility services. Off unless asked for, and Android switches them off again on
# every reinstall, so pass the flag each time you run this script.
-# INPUT_KEY_SERVICE=1 the remote's Input button (KEYCODE_TV) opens the input switcher from any
+# INPUT_KEY_SERVICE=1 the remote's Input button (KEYCODE_TV or TV_INPUT) opens the input switcher from any
# app; Google TV needs this once the stock launcher is gone (InputKeyService)
# HOME_KEY_SERVICE=1 remotes whose Home button sends KEYCODE_ALL_APPS instead of HOME, e.g. Xiaomi
# sticks: the key is routed to the launcher (HomeKeyService)