Skip to content

Add a Start on boot option for devices whose stock launcher owns HOME - #131

Open
williavs wants to merge 1 commit into
leanbitlab-org:masterfrom
williavs:feat/start-on-boot
Open

Add a Start on boot option for devices whose stock launcher owns HOME#131
williavs wants to merge 1 commit into
leanbitlab-org:masterfrom
williavs:feat/start-on-boot

Conversation

@williavs

@williavs williavs commented Sep 2, 2026

Copy link
Copy Markdown

On Google TV and Fire TV the stock launcher wins HOME resolution at boot (intent-filter priority, see #130), so even with the Home Button Fix on, the TV comes up on the stock home screen and the user has to press Home once. This adds an opt-in Start on boot tile under Settings → Accessibility, next to Home Button Fix. Off by default.

How it works:

  • BootReceiver on BOOT_COMPLETED reads the flag straight from the shared_preferences file (FlutterSharedPreferences / flutter.start_on_boot) so it does not need the Flutter engine, then starts MainActivity with FLAG_ACTIVITY_NEW_TASK.
  • SettingsService gets startOnBoot / setStartOnBoot, and the key is included in the backup/restore map.
  • String added to all 14 ARB files.

Android 10+ only allows the background activity start while the app holds an exemption; in practice that is the Home Button Fix accessibility service being enabled, or the overlay permission. Without either the system drops the start silently. The receiver's javadoc says so.

Verification:

  • Builds clean with the pinned toolchain (Flutter 3.24.5, JDK 21).
  • The receiver itself is verified on a Hisense Google TV (Android 12): after adb reboot, sys.boot_completed at 17:09:33, then START u0 {flg=0x10000000 cmp=com.leanbitlab.ltvL/.MainActivity} from uid 10115 at 17:09:57 with Background activity start for com.leanbitlab.ltvL allowed because SYSTEM_ALERT_WINDOW permission is granted, and the launcher in the foreground. Expect ~25 s of stock home before it takes over; the TV delays app boot broadcasts.
  • The settings tile is not device-tested: current master crashes on my device's existing 2026.08.10 data at startup (AppsService.sortCategory, application.categoryOrders[category.id]! null check, apps_service.dart:392), which is unrelated to this change. Happy to open that as a separate issue with the full stack if useful.

On Google TV and Fire TV the stock launcher wins HOME resolution at boot, so
even with the Home Button Fix enabled the TV comes up on the stock home screen.
When this option is on, a BOOT_COMPLETED receiver starts LTvLauncher on top of
it. Off by default. The receiver reads the flag straight from the
shared_preferences file so it works before Flutter is up.

Android 10+ only allows the background activity start while the app holds an
exemption (the Home Button Fix accessibility service enabled, or the overlay
permission granted); otherwise the system drops it silently, which is
documented on the setting.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant