Skip to content

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

launcher: stock_home_redirect subscribes to window changes again

mrk198735dd365ba1a9
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/HomeKeyService.java b/launcher/app/src/main/java/com/gathin/tvhome/HomeKeyService.java
index 68bef961e..3fd973d5b 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/HomeKeyService.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/HomeKeyService.java
@@ -1,6 +1,7 @@
package com.gathin.tvhome;
import android.accessibilityservice.AccessibilityService;
+import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -108,6 +109,12 @@ public class HomeKeyService extends AccessibilityService {
stockHome.add(ri.activityInfo.name);
}
}
+ // home_key_service.xml subscribes to no events, so the redirect asks for window changes only when it is on.
+ AccessibilityServiceInfo info = getServiceInfo();
+ if (info != null && !stockHome.isEmpty()) {
+ info.eventTypes |= AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
+ setServiceInfo(info);
+ }
holdAppKeys = RemoteKeys.parseHoldAppKeys(config.appKeys);
holdAppScancodes = RemoteKeys.parseHoldAppScancodes(config.appKeys);
}
diff --git a/launcher/app/src/main/res/xml/home_key_service.xml b/launcher/app/src/main/res/xml/home_key_service.xml
index 7aaf1ee8a..49565e22f 100644
--- a/launcher/app/src/main/res/xml/home_key_service.xml
+++ b/launcher/app/src/main/res/xml/home_key_service.xml
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Keys only: no accessibilityEventTypes (0), so the system never calls into the launcher for
accessibility events, which both services ignore. Key filtering depends only on
- flagRequestFilterKeyEvents and canRequestFilterKeyEvents, not on the event types. -->
+ flagRequestFilterKeyEvents and canRequestFilterKeyEvents, not on the event types.
+ stock_home_redirect is the exception: with it set, HomeKeyService adds typeWindowStateChanged at runtime. -->
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityFeedbackType="feedbackGeneric"
android:accessibilityFlags="flagRequestFilterKeyEvents"