Files
launcher/android/java/dev/ultra/launcher/RecentsService.java
T
nandi 3070db4fb4
Launcher / test (push) Successful in 1m21s
Launcher / apk (push) Successful in 17s
Fix wallpaper transparency, Recents setup guide, drawer animation, and widget resizing (#2)
2026-11-23 05:36:23 +00:00

47 lines
1.4 KiB
Java

package dev.ultra.launcher;
import android.accessibilityservice.AccessibilityService;
import android.content.Intent;
import android.view.accessibility.AccessibilityEvent;
/**
* An accessibility service that does nothing but open Recents (the system's list of open
* windows) for the home screen's Windows button. Android lets no other app open Recents,
* so the user turns this on once under Settings > Accessibility. It reads no window
* content and asks for no events.
*/
public class RecentsService extends AccessibilityService {
private static volatile RecentsService running;
/** Whether the accessibility service is currently connected. */
static boolean isRunning() {
return running != null;
}
/** Open Recents; false when the service isn't turned on. */
static boolean showRecents() {
RecentsService s = running;
return s != null && s.performGlobalAction(GLOBAL_ACTION_RECENTS);
}
@Override
protected void onServiceConnected() {
running = this;
}
@Override
public boolean onUnbind(Intent intent) {
running = null;
return super.onUnbind(intent);
}
@Override
public void onDestroy() {
running = null;
super.onDestroy();
}
@Override public void onAccessibilityEvent(AccessibilityEvent event) { }
@Override public void onInterrupt() { }
}