Activity tracker: Playtime includes suspended time

Device: Anbernic RG CubeXX
Version: MustardOS 2601.0 Jacaranda
Build: bc38efa0
Core: mGBA

I noticed that muOS includes time spent suspended in both last_session and total_time.

Steps to reproduce

  1. Launch a RetroArch game.
  2. Play for about 1 minute.
  3. Suspend the device for 3 minutes.
  4. Resume and play for another 2 minutes.
  5. Exit the game.
  6. Check the Activity Tracker or playtime_data.json.

Expected result

The session duration should be about 3 minutes.

The RetroArch log correctly identifies the correct play time:

[INFO] [Runtime] Content ran for a total of: 00 hours, 03 minutes, 05 seconds.

This matches the approximately 1 minute played before suspension plus 2 minutes played after resuming.

Actual result

muOS recorded:

last_session: 381

That is 6 minutes and 21 seconds, which is the full wall-clock time from launch to exit.

total_time also increased by 381 seconds.

What I found

This looks like a conflict between the launcher and suspend scripts.

script/mux/launch.sh removes /tmp/rom_go before executing the emulator:
internal/script/mux/launch.sh at e4d454c2f05b4f998554c4a5dc2e14d2cd0bc539 · MustardOS/internal · GitHub

The suspend activity tracker only calls track.sh stop or track.sh resume when /tmp/rom_go exists:
internal/script/system/suspend.sh at e4d454c2f05b4f998554c4a5dc2e14d2cd0bc539 · MustardOS/internal · GitHub

Since the launcher has already deleted that file, the suspend and resume tracking calls silently do nothing. The final track.sh stop then calculates the session using the original launch timestamp, so suspended time is included:

A possible fix would be to keep the active game’s metadata in a separate runtime file. The launcher could create it before starting the emulator, the suspend script could read it, and the launcher could remove it after the game exits. This would avoid reusing /tmp/rom_go, which appears to be intended as a one-time launch request.

This has already been resolved in Andromeda.