Skip to content

Reopen the sample player after a memory kill, and test real websites - #48

Merged
514sid merged 1 commit into
mainfrom
sample-watchdog-websites
Nov 23, 2026
Merged

514sid merged 1 commit into
mainfrom
sample-watchdog-websites

Conversation

@514sid

@514sid 514sid commented Nov 23, 2026

Copy link
Copy Markdown
Owner

A website soak run on the TV (930 MB RAM) ran it out of swap within 20 minutes. lmkd killed the sample app's main process and then the player, Android restarted the watchdog, and its attempt to reopen PlayerActivity was blocked as a background activity start. The TV sat on its home screen while the soak script saw a :player process (restarted for its service) and didn't relaunch.

Sample app:

  • Declares SYSTEM_ALERT_WINDOW. Once granted (adb shell appops set io.github.gapless.sample SYSTEM_ALERT_WINDOW allow), Android lets the watchdog reopen the player from the background. Without it, the watchdog logs how to grant it.
  • WatchdogService returns START_REDELIVER_INTENT instead of START_STICKY, so a restarted watchdog still has the launch extras and the player comes back on the same playlist.

Killing both processes by hand on the TV, the player was back on screen with the same playlist about 20 seconds later. Android still delays the watchdog's restart by minutes after repeated kills, and the main process ranks below the player when memory runs out, so the README now says to make the player the home app on devices that run out of memory often.

Soak script and report:

  • Relaunches when PlayerActivity isn't on screen for two samples, instead of when the :player process is missing, and records that as on_screen.
  • Records the WebView renderer's RAM plus swap across all its processes. The first version read one process and sometimes the wrong one.
  • Takes SOAK_PLAYLIST, keeps WebStateMachine warnings, and grants the overlay permission at the start.
  • Counts only the app's own crashes (other apps' crashes were counted before) and splits low-memory kills between the player and the main process.

Test media: a websites playlist of 16 live sites (news with ads and consent banners, WebGL, maps, a dashboard, an embedded YouTube video, light pages) with a video or image between them, and websites_only.

The soak runs on a 930 MB TV showed the system killing both of the sample
app's processes, and the watchdog's attempt to reopen the player being
blocked as a background activity start. The watchdog also came back with
no launch extras, so the player would return on the default playlist.

The sample app now declares SYSTEM_ALERT_WINDOW, which lets the watchdog
reopen the player once granted, and returns START_REDELIVER_INTENT so the
extras survive. The soak script grants it, checks that the player is on
screen rather than that its process exists, records the WebView
renderer's memory across all its processes, and takes SOAK_PLAYLIST. The
report counts only the app's own crashes and splits low-memory kills
between the player and the main process.

Adds a websites playlist of 16 live sites with videos between them.
@514sid
514sid merged commit 0f31bfe into main Nov 23, 2026
1 check passed
@514sid
514sid deleted the sample-watchdog-websites branch November 23, 2026 14:40
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