foreground app should keep wakelock open until actual suspend happens (aka camera takes ~5 seconds to be responsive after waking phone)

Bug #1309915 reported by Oliver Grawert
42
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
Critical
Unassigned
qtmir (Ubuntu)
Fix Released
Critical
Gerry Boland
qtmir (Ubuntu RTM)
Fix Released
Critical
Michał Sawicz
unity8 (Ubuntu)
Invalid
Undecided
Unassigned
unity8 (Ubuntu RTM)
Invalid
Undecided
Unassigned

Bug Description

while apps that you put in the background are properly SIGSTOPed
(this is easy to verify with a music streaming website atm (while the browser does not use media-hub it will/should stop playback)).
 An app that is in the foreground will try to play on when the system is suspended (easy to verify with the same method, music plays on but becomes stuttery if the browser was in the foreground. This indicates the system tries to suspend but the running app tries to keep it alive.

Unity should send s SIGSTOP/SIGCONT sequence on suspend/resume to the app in foreground when the system goes into suspend and resumes.

Related branches

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

I don't think there's anything unity8 should do here, we already unfocus on locking, or did we lose that in the process?

Changed in unity-mir (Ubuntu):
status: New → Confirmed
Changed in unity8 (Ubuntu):
status: New → Invalid
status: Invalid → Opinion
Revision history for this message
Michael Zanetti (mzanetti) wrote :

Hmm... I've just tested this and it seems to work fine here.

I've started the game dropping letters and while the screen is locked, no new letters come in. It resumes dropping letters as soon as the screen is unlocked.

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

That could be because the rendering is blocked, not necessarily that the app is stopped.

What does `ps aux | grep $app_name` say? Should be "T" in the STAT column when stopped.

Revision history for this message
Michael Zanetti (mzanetti) wrote :

Debugging this a little further reveals this:

The suspending of the app does work, however, its bound to Greeter.locked and turns out we only lock the greeter when the screen wakes up again. This means, pressing the power button to turn off the screen does not suspend the app. Pressing the power button again makes the screen wake up, locks the greeter and suspends the app. Swiping the greeter away resumes the app again.

Reassigning this to mterry given that he'll land the new split greeter soon.

Basically we need to make sure that the greeter locks when the screen turns off (as opposed to when it turns on as it is right now) which should implicitly fix this bug.

If we want to keep the Greeter unlocked while the screen is off for whatever reason, we need to find something else to bind ApplicationManager.suspended to.

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

This should actually be fixed by non-blocking swaps then: bug #1292306.

Changed in unity8 (Ubuntu):
status: Opinion → Invalid
Changed in unity-mir (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Michael Terry (mterry) wrote :

Just to confirm -- in split mode, the session should look at whether it is the active session or not to suspend apps. And in current unity8, it's just the non-blocking swaps that prevent the greeter from coming in on power off.

Revision history for this message
Oliver Grawert (ogra) wrote :

definitely not a duplicate of the EGL blocker bug ... still happening in image 11 (and indeed we still lok on wakeup instead of suspend until mterrys changes land)

Revision history for this message
Oliver Grawert (ogra) wrote : Re: foreground app should keep wakelock open until actual suspend happens

renamed for teh stuttering issue, while (web)apps suspend fine after 5sec, if there is a video or audio stream playing in a webapp it gets all stuttery since the playback part tries to suspend before the app gets SIGSTOPed

summary: - foreground app should recieve SIGSTOP on suspend
+ foreground app should keep wakelock open until actual suspend happens
Revision history for this message
Florian Boucault (fboucault) wrote :

I believe that this bug is the cause of https://bugs.launchpad.net/camera-app/+bug/1398436

Revision history for this message
Jim Hodapp (jhodapp) wrote :
Bill Filler (bfiller)
Changed in unity-mir (Ubuntu):
status: Invalid → Confirmed
Changed in unity8 (Ubuntu):
status: Invalid → Confirmed
Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

will dupe other symptoms over to this bug

Changed in canonical-devices-system-image:
importance: Undecided → Critical
milestone: none → ww03-2015
status: New → Confirmed
Changed in unity8 (Ubuntu RTM):
importance: Undecided → Critical
assignee: nobody → Michał Sawicz (saviq)
Revision history for this message
kevin gunn (kgunn72) wrote :

no such thing as unity-mir, replacing with qtmir

no longer affects: unity-mir (Ubuntu)
no longer affects: unity-mir (Ubuntu RTM)
Revision history for this message
kevin gunn (kgunn72) wrote :
Changed in qtmir (Ubuntu RTM):
assignee: nobody → Gerry Boland (gerboland)
importance: Undecided → Critical
Revision history for this message
kevin gunn (kgunn72) wrote :
Gerry Boland (gerboland)
Changed in qtmir (Ubuntu RTM):
status: New → In Progress
Revision history for this message
Gerry Boland (gerboland) wrote :

Still trying to get my head around this. If I manually create a wakelock:
    sudo bash -c "echo mylock > /sys/power/wake_lock"
then I can't reproduce the bug (tried 20 times anyway). If I remove that wakelock:
    sudo bash -c "echo mylock > /sys/power/wake_unlock"
then yes, I get the bug again. Sadly there's no /proc/wakelocks to get the wakelock state.

Seeing the Greeter have a black background makes me suspicious too. Is phone going to deep sleep before unity8 is ready - as Greeter should be drawn on screen after display is turned off, not before display is turned on.

I need to learn how powerd is interacting with wakelocks

Revision history for this message
Gerry Boland (gerboland) wrote :

After chat with ricmm, am going to have AppMan hold a system wakelock while any app is non-suspended - this should ensure app state is always updated before the device is put into deep sleep.

kevin gunn (kgunn72)
summary: foreground app should keep wakelock open until actual suspend happens
+ (aka camera takes ~5 seconds to be responsive after waking phone)
Gerry Boland (gerboland)
Changed in qtmir (Ubuntu):
importance: Undecided → Critical
status: New → In Progress
assignee: nobody → Gerry Boland (gerboland)
Michał Sawicz (saviq)
Changed in qtmir (Ubuntu RTM):
status: In Progress → Triaged
assignee: Gerry Boland (gerboland) → Michał Sawicz (saviq)
Changed in unity8 (Ubuntu RTM):
assignee: Michał Sawicz (saviq) → nobody
status: New → Invalid
Changed in unity8 (Ubuntu):
status: Confirmed → Invalid
Changed in unity8 (Ubuntu RTM):
importance: Critical → Undecided
Michał Sawicz (saviq)
Changed in qtmir (Ubuntu RTM):
milestone: none → 14.09-ota-2
Michał Sawicz (saviq)
Changed in qtmir (Ubuntu RTM):
milestone: 14.09-ota-2 → 14.09-release
Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

needs more testing and verification

Changed in canonical-devices-system-image:
milestone: ww03-2015 → ww05-2015
Changed in canonical-devices-system-image:
status: Confirmed → In Progress
Michał Sawicz (saviq)
Changed in qtmir (Ubuntu RTM):
status: Triaged → In Progress
Changed in qtmir (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qtmir - 0.4.4+15.04.20150121~rtm-0ubuntu1

---------------
qtmir (0.4.4+15.04.20150121~rtm-0ubuntu1) 14.09; urgency=medium

  [ Gerry Boland ]
  * Add Wakelock support - ensures device drops to deep-sleep mode only
    when all AppMan suspend tasks have completed (LP: #1309915)

  [ Ricardo Mendoza ]
  * Reduce suspend timeout to half of the previous value because the
    long value was too apparent on fast paced apps, like web games of
    music players; it broke the user experience according to design.
    (LP: #1402650)
 -- Ubuntu daily release <email address hidden> Wed, 21 Jan 2015 11:36:24 +0000

Changed in qtmir (Ubuntu RTM):
status: In Progress → Fix Released
Changed in canonical-devices-system-image:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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