Acknowledged
CIQQA-4159

Activity session undocumented behaviour and device softlock

If for a custom activity app, a session is stopped (but not saved or discarded) and then the activity app goes in the background (you start another widget / go back to watchface), the activity session will be "cleaned" out of memory and you will have no way to resume, save or discard it using the same session object.

I found out that the session is still there somewhere because if you start another activity from the activity list before exiting this menu, it will actually try to resume the previous session. However, if you exit the activity list menu, it softlocks the watch with no way to restart any activity until restart the watch (at least on my fr955).

I think when the activity app goes in the background, the watch firmware stores the session outside of memory like when you select "resume the activity later" option in the menu appearing when you stop a standard Garmin activity. Then, when you go back to your app the session is no longer in memory so you're unable to resume / save / discard it, but if you later try to start a new activity, the firmware wants to resume the session it has previously stored by opening the custom activity app with some undocumented intent, thus it crashes.

I noticed this when using my roundnet activity app, here are the steps to reproduce : 

- set a shortcut key to go back to watchface (mine is longpress "start")

- open the roundnet app and start an activity

- stop the activity (but don't save / discard it yet)

- use your shortcut key to go back to your watchface

- press the back or start button to return to the roundnet activity app

- resume the activity -- notice that the timer is not moving anymore

- stop the activity and save / discard

Then two options : 

1) Exit the app and the activity list menu, press the start button and notice the ciq! exception logo. Now there is no way to start another activity until you restart your watch AFAIK.

2) Start a new roundnet activity directly from the app home screen and notice the timer gets back to where it was before stopping the previous session. Alternatively, you can exit the app but not the activity list menu and start another activity app : it should take you to the standard stop menu for a Garmin activity.

Code for the app is available there : ad220/roundnet-activity: Roundnet activity tracker for Garmin wearables 

Edit: typos