Add a Start on boot option for devices whose stock launcher owns HOME - #131
Open
williavs wants to merge 1 commit into
Open
Add a Start on boot option for devices whose stock launcher owns HOME#131williavs wants to merge 1 commit into
williavs wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
BootReceiveronBOOT_COMPLETEDreads the flag straight from the shared_preferences file (FlutterSharedPreferences/flutter.start_on_boot) so it does not need the Flutter engine, then startsMainActivitywithFLAG_ACTIVITY_NEW_TASK.SettingsServicegetsstartOnBoot/setStartOnBoot, and the key is included in the backup/restore map.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:
adb reboot,sys.boot_completedat 17:09:33, thenSTART u0 {flg=0x10000000 cmp=com.leanbitlab.ltvL/.MainActivity} from uid 10115at 17:09:57 withBackground 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.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.