Need to expose API to notify about user closing the app

Bug #1447566 reported by Michał Sawicz
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
ubuntu-ui-toolkit (Ubuntu)
Confirmed
Medium
Zsombor Egri

Bug Description

Apps currently have no way to "clean up" when a user closes them (swipes an app away in the right-edge switcher).

It'd be useful to expose a signal that the app can subscribe to to handle SIGTERM that's sent to it by upstart. The app should not exit until the signal handler returns. Initially we'll rely on upstart to SIGKILL the app after a timeout, but later we'll need to implement a way for the app to suppress that if e.g. it needs to ask the user what to do with unsaved data.

Zoltan Balogh (bzoltan)
Changed in ubuntu-ui-toolkit (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Zsombor Egri (zsombi)
Revision history for this message
Cris Dywan (kalikiana) wrote :

What about the unsaved data case when an app is killed by life cycle management? It seems problematic to me to lead app developers into believing that users will see that question, when most of the time they won't.

Revision history for this message
Michał Sawicz (saviq) wrote :

The app should've saved all volatile data when it went inactive, since that's when there's no guarantee it will ever get resumed again.

The SIGTERM would just be a way to tell the app "The user closed you, clear yourself up as needed". Often it will be NOOP, assuming the app uses StateSaver, which already does this.

Revision history for this message
Zsombor Egri (zsombi) wrote :

StateSaver discards the saved states on SIGTERM. This has been agreed long ago when we stabilised the StateSaver requirements:
- states are saved every time the app goes background (inactive)
- SIGINT keeps the states saved
- SIGTERM, quit() clears the state data, as well as when the app comes foreground

So donate assume states being saved when SIGTERM comes. This was like this since 1.0, so we cannot break that.

We can however expose an interface to apps so they can save whatever they want. Any other signals we should listen on?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.