← Back to team overview

ubuntu-phone team mailing list archive

Re: Running background services

 

On Wed, Aug 14, 2013 at 10:08 AM, Roberto Colistete Jr.
<roberto.colistete@xxxxxxxxx> wrote:
>     Hi,
>
>     Please, let it be clear about Ubuntu Touch :
> - currently Apps screen shows "Running Apps" with (not live) miniatures of
> open softwares. These softwares are not-focused ? If so, they can be closed
> by the system ?
> - if the user have installed a mathematical application and want to let an
> integral calculation run (for 30s or even some minutes, it depends a lot on
> the complexity of the integral) while he/she can browse the web, etc. Will
> the mathematical application be stopped by the system even if it is shown as
> "Running Apps" miniature ?

This is what will happen to the mathematical application if the user
puts it in the background.
1. The application will receive a signal that it is being unfocused
2. With that signal in step 1, the application will be given a chance
to save some state information
3. The application will be stopped (not killed). The application will
still be in memory, but "frozen in time". It can't do any
calculations.
4. In the case where the user runs more apps and runs out of memory,
it's possible that the mathematical application will be killed
entirely in order to free memory for more applications.

When the user goes back to the mathematical application, either:
1. The application was only stopped, not killed, in which case it can
just keep going. The application will receive a signal that it has
been refocused in case the application wants to check the time or some
other relevant action.
2. The application was killed entirely, in which case the application
must read in the state it as saved, rebuild itself, and keep going. If
written properly, the fact that application was killed and not merely
stopped will be transparent to the user.

Support for transitioning between these states (focused,
unfocused-stopped, unfocused-killed) is being built into the SDK.

Obviously a mathematical application that has intense CPU requirements
is a bit of an odd application for a mobile phone. So, the user must
keep the application focused if they don't mind it consuming all the
phone's power.

Rather than running in the background themselves, applications that
should continue working when unfocused will consume provided system
services via the SDK. The current list of planned services relevant to
running in the background for 13.10 is:

Music
Download
Telephony
Alarms

Note that this is all version 1. The application lifecycle will be
extended to support tablets and deskops in future versions.

HTH

Cheers, Rick


References