Skip to content

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

Merge PR #1130: fix(input): resolve CEC child-input IDs to parent input port in openInput

Gathin23771c0634e66e
diff --cc launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
index 7e2fd1ede,8d812981b..dca4f8424
--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java
@@@ -2649,7 -2588,17 +2649,18 @@@ public class MainActivity extends Activ
* throws SecurityException, which used to take Home down with it (YaOS before the manifest asked
* for ACCESS_TV_SOURCE). */
private void openInput(String inputId) {
- Integer source = mappedSource(inputId);
++ // A CEC device is a child input of its HDMI port; the vendor source number belongs to the port
++ // (MiTV-MFFU0). Only that lookup uses the parent: the generic path below still opens the child.
++ String sourceId = inputId;
+ TvInputManager tim = (TvInputManager) getSystemService(TV_INPUT_SERVICE);
+ if (tim != null) {
+ try {
+ TvInputInfo info = tim.getTvInputInfo(inputId);
- if (info != null && info.getParentId() != null) {
- inputId = info.getParentId();
- }
- } catch (Throwable ignored) {
++ if (info != null && info.getParentId() != null) sourceId = info.getParentId();
++ } catch (RuntimeException ignored) {
+ }
+ }
- Integer source = mappedSource(inputId);
++ Integer source = mappedSource(sourceId);
if (source != null && source >= 0 && !inputAction.isEmpty()) {
try {
startActivity(new Intent(inputAction).putExtra("input", source.intValue())