Repository navigation
Start on boot: an opt-in setting for boxes without a firmware autorun (#255) - #256
Conversation
…evice boots (#255) A BOOT_COMPLETED receiver opens Decoder when the setting is on. Android 10+ needs the permission to draw over other apps for that start: turning the setting on opens the system screen for it, or shows the adb command where the device has none. /stats.json reports start_on_boot (on, overlay).
…s not blink the streams (#255) Android writes app ops to disk with a delay: an appops set followed soon by a reboot was lost on the test box, so the hint and the docs add appops write-settings. onNewIntent restarted the streams for any intent; a firmware autorun plus Start on boot opened the app twice and the second start restarted the decoder. Only a shared link (EXTRA_TEXT) restarts them now.
5b669e7 to
6b89c7d
Compare
…d it already (#255) On the test box a second start paused and resumed the activity, which restarted every stream, so the receiver now does nothing while an activity of the app is on the screen.
6b89c7d to
97a77f7
Compare
|
Device test on an Android 10 TV box (Allwinner H313), CI build of
The box was left as found: the setting off, the op back to |
PR Summary by QodoAdd opt-in start on boot for devices without firmware autorun
AI Description
Diagram
High-Level Assessment
Files changed (11)
|
Code Review by Qodo
1.
|
…e READMEs (Qodo on #256) On a short landscape screen with the keyboard up, the new checkbox could end up below the dialog with no way to reach it. The READMEs get the short section the issue asked for: the device's own autorun first, otherwise the setting.
97a77f7 to
ded13e9
Compare
|
/review |
|
Code review by qodo was updated up to the latest commit ded13e9 |
…ats.json has it without an activity (Qodo on #256) A firmware autorun that is still creating the activity when BOOT_COMPLETED arrives no longer gets a second start: the receiver checks for any Decoder activity alive (onCreate to onDestroy). The no-activity snapshot of the debug server reports start_on_boot too.
ded13e9 to
4de2f6c
Compare
|
/review |
|
Code review by qodo was updated up to the latest commit 4de2f6c |
…n_boot also when the UI thread hangs (Qodo on #256) Android 15 lets an app that targets 35+ start an activity from the background with SYSTEM_ALERT_WINDOW only while one of its overlay windows is visible, so the receiver adds a transparent 1x1 overlay for two seconds around the start. start_on_boot moves to the part of /stats.json that needs no UI state.
4de2f6c to
82375a2
Compare
|
/review |
|
Code review by qodo was updated up to the latest commit 82375a2 |
…e paused behind another app (Qodo on #256)
82375a2 to
cbee135
Compare
|
/review |
| View overlay = Build.VERSION.SDK_INT >= 35 && overlayAllowed(context) | ||
| ? showOverlay(context) : null; | ||
| try { | ||
| context.startActivity(start); |
There was a problem hiding this comment.
4. Boot start on android 15+ may still be blocked 🐞 Bug ≡ Correctness
onReceive calls showOverlay() and then calls context.startActivity(start) straight away, in the same main-thread turn. wm.addView only queues the window: the 1×1 view has not been laid out, drawn or put on screen when startActivity runs, so the overlay may not count as visible yet when Android 15+ decides whether to allow the background start. In that case the start is blocked even with the permission granted, the 2 s postDelayed only removes the overlay afterwards, and the Android 10 device test does not cover this path.
Agent Prompt
## Issue description
On Android 15+ the boot receiver adds a transparent overlay window and calls startActivity in the same main-thread turn. The window has not been drawn yet, so the background start may still be blocked.
## Fix Focus Areas
- android/app/src/main/java/com/openipc/decoder/BootReceiver.java[81-94]
## Recommended Fix
When an overlay is shown, call goAsync() right away. Then call startActivity only once the view has been drawn: for example from a ViewTreeObserver.OnDrawListener / OnPreDrawListener on the overlay view, or from a short postDelayed (a few hundred ms) on the main Handler. Remove the overlay and call pending.finish() OVERLAY_MS after the start. Keep the immediate start when no overlay is shown. Log when the start is attempted, so a failed start on Android 15+ can be diagnosed.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit cbee135 |
|
Re-tested on the Android 10 TV box with the CI build of
Not tested on Android 15+ (the 1x1 overlay path): no Android 15 device available for it right now. The box was left as found (setting off, app op |
Closes #255.
What
BootReceivergetsBOOT_COMPLETEDand opensDecoderwhen it is on; the app comes up with the saved slots and view.SYSTEM_ALERT_WINDOW; turning the setting on without it opens the system Display over other apps screen, or, where the device has none (many TV boxes), a dialog withadb shell appops set com.openipc.decoder SYSTEM_ALERT_WINDOW allowandadb shell appops write-settings(Android writes app ops to disk with a delay; a reboot soon afterappops setloses it)./stats.json:start_on_bootwithonandoverlay(allowed/missing/not needed).onNewIntentrestarts the streams only for a shared link (EXTRA_TEXT), not for a plain launcher intent.docs/usage.md"Start on boot" (firmware autorun first, otherwise this setting), the/stats.jsonfield, one line in the three READMEs.Checked
testDebugUnitTest,lintDebug(no new findings besidesSetTextI18non the label, as for Mirror),assembleDebug.Device test
Android 10 TV box (Allwinner H313), CI build of the branch, details in the comment below.
Background activity startblocked, warning in the log.appops set+write-settings→ reboot → the app opens by itself with the saved view;/stats.json"on": true, "overlay": "allowed".Start video decoder.