feat: Home button on Google TV without ADB (accessibility service) #34
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/accessibility-home"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds an optional way for Google TV users to open Glass Launcher with the remote's Home button, without the one-time ADB setup. It follows the design in issue #45 on GitHub, with one change. That design filtered every key press, which on TVs stops a held volume key from repeating. This PR pauses the filtering after each volume change (see What changed). Gabriel (the repo owner) tried the debug build on his TV and asked for this PR to be opened and merged.
One commit:
e44d2be, on top of current main8868bcc(the merge of #33, 5/6/7 icons per row). Gabriel tried a build of054ab85. That commit has exactly the same files ase44d2be(same git tree,abe6ab0). It was only re-authored to the repo's noreply email before pushing.Terms used below:
com.google.android.apps.tv.launcherx(Google TV's home screen),com.google.android.tvlauncher(older Android TV's home screen) andcom.google.android.tungsten.setupwraith(Google TV's setup app, which can also take Home).What changed
HomeButtonService.java,res/xml/home_button_service.xml,AndroidManifest.xml). When the service is on and Glass is not the default Home, a short Home press is swallowed and brings Glass to the front. It is also meant to bring Glass back when a stock launcher window comes to the front anyway (after boot, waking from standby, or an app opening Home). When Glass is already the default Home, for example after the ADB setup, the service does nothing, so the two never fight. Every key other than Home goes straight back to Android. The config asks for no screen content (canRetrieveWindowContent=false), only window changes from the three stock launcher packages.android.media.VOLUME_CHANGED_ACTION(a stable but unpublished Android broadcast) and turns key filtering off for 4 seconds after each volume change, so a hold ramps. If a TV never sends that broadcast, only the hold fix is lost. During those 4 seconds a Home press goes to the stock launcher first.HomeOverridePlan.java,HomeOverridePlanTest.java). The rules live in a pure Java class with 20 unit tests: which keys pass, the short/long split, not bringing Glass back within 1.5 s of the service's own launch of Glass or of a long press (so its own transition and Recents aren't undone), reading Android's enabled-services setting, and the On / Off / Not needed status. It copies the pattern ofGoogleTvSetupPlan, the ADB setup's tested rule class.LauncherActivity.java,strings.xml). Default home & backup gets a Home button row showing On, Off or Not needed (Glass is already the default Home). Its page has the status and a Turn on Home button or Turn off Home button row; both open Android's Accessibility settings, where the user flips the switch. Two notes say Google TV Home keeps running, and that the system wallpaper and pinned shortcuts don't apply while Glass isn't the default Home. Turn on first shows a consent screen: the service reads only the Home key and which launcher is in front, never screen content. Continue asks for Glass's own toggle screen, and opens the Accessibility list on TVs without it.README.md,CHANGELOG.md). README has a "Home button without ADB (Google TV)" section with the steps, trade-offs and the Android 13+ restricted-settings note. CHANGELOG has an Unreleased entry.No new permissions. minSdk stays 26 (Android 8). Glass's own Back up settings file gets nothing new, because Android stores whether the service is on.
Screenshots
Glass Launcher on the emulator (Android TV 14, API 34, 1080p), set up like a TV without the ADB setup: the stock launcher is the default Home.
How it was checked
isAccessibilityToolis read only on Android 12 and newer, where it tells Android this is not an assistive tool; older versions ignore it and lose nothing.assembleDebugandassembleDebugAndroidTestbuild. No instrumented tests were added; the existing ones were compiled, not run.054ab85debug build next to it and said it works. Which behaviors he tried wasn't recorded, nothing was measured, and the service is off on the TV now.Not covered yet
launcherxis still on (no ADB setup), with a real remote. That is the main target, and the bring-back path has only run on the emulator.Glass is sideload-only, so Google Play's accessibility declaration doesn't apply.
Trying it
Debug APK:
GlassLauncher-accessibility-home-054ab85-debug.apk, sha2569c7701c1e180947ad233478af9b7882714df0f9704617aa7168d32d4ca84471d, built from the same files as the head. Install it withadb install -r. Open Settings > Default home & backup > Home button > Turn on Home button, choose Continue, and switch on "Glass Launcher – Home button". If a release build is also installed and is the default Home, Home opens the debug build while its service is on.Intent. Give Google TV users a way to open Glass with the remote's Home button without the one-time ADB setup, through an optional accessibility service they switch on themselves. It reads only the Home key and which launcher is in front. It does nothing when Glass is already the default Home, and it keeps volume holds working by pausing key filtering after each volume change. This is issue #45's design on GitHub, with the volume change added.
Not goals: