Live TV black after closing an app opened over Home (webOS 6.5.3 stand-in, issue 289)
Done when
Closing an app opened over Home no longer leaves Live TV black on a webOS 6 stand-in TV (recovers by itself, about 20 s or less); no effect on other TVs or on the Inputs picker; tvprofile gate and on/off files work; blank app is packaged; new tests and docs pass `sh tools/check.sh`; PR against dev with the real-TV status stated.
Details
GitHub issue: https://github.com/lasharor/cleanyourtv-WebOS/issues/289 Problem: on webOS 6 with the stand-in Home takeover, when a card app opened over Home is closed, Home comes back but the web engine does not re-activate the launcher window. Every later Live TV pipeline is `media_loaded` with `is_foreground:false`, never reaches the screen, and stays black until a reboot. Pressing Home while the app is still running does not trigger it. Chosen approach (option 1, the one the reporter verified on a TV): a watcher modelled on scripts/hdmi-plane.sh. 1. Follow `luna://com.webos.applicationManager/getAppLifeStatus` (subscribe, no polling while idle). On the sequence Home background -> app X foreground -> X closing/stop -> Home foreground, arm. 2. While armed, when Live TV opens (the launcher logs `page iptv`), check `com.webos.media/getActivePipelines`: the Home media pipeline `media_loaded` and not `is_foreground` means stuck. 3. Cure: launch a hidden blank card app (visible:false, spinnerOnLaunch:false, black page that calls PalmSystem.stageReady()/activate() on launch and on webOSRelaunch), wait until it is really in front (about 2 s after the app manager reports it), then launch Home with {"live":true}. Disarm once the pipeline is foreground. At most two attempts. 4. The Inputs picker overlay never sends Home to the background and must never arm it. Requirements: - Gate it in helper/tvprofile.js (webOS 6 with the stand-in), with on/off files like hdmi-plane-on and hdmi-plane-off. Start it from the boot script, in the background, so the Homebrew Channel failsafe still works. - Ship the blank app with the package (ipk/build.py, scripts/bootstrap.sh copies only helper/*.js and scripts/*, so copy it there too). Node 8.12 for any JS; busybox sh for the script. Log every step to /tmp/cleanyourtv-boot.log (Share log). - Add a test in tools/test/ (stub luna like tools/test/hdmi-plane.test.js) and update docs/tv-changes.md and docs/development/internals.md. `sh tools/check.sh` must pass. - Say plainly what was and was not checked on a real TV. A 6.5.3 TV with the stand-in is needed to confirm; the reporter's stopgap script is in the issue body as reference (write your own code, do not copy it). - Do not touch a user's TV; no private data in the repo or PR.
What happened
In order. Text written by an agent is marked: read it as a hint.-
@lasharor Proposed the task