GPS stays active after location data is used by a scope (even after not not using the scopes anymore)

Bug #1422879 reported by Ricardo Salveti
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
Critical
Unassigned
location-service (Ubuntu)
Invalid
Undecided
Unassigned
unity-scopes-api (Ubuntu RTM)
Invalid
Critical
Pete Woods
unity-scopes-shell (Ubuntu)
Fix Released
Critical
Pete Woods
unity-scopes-shell (Ubuntu RTM)
Fix Released
Critical
Pete Woods
unity8 (Ubuntu)
Fix Released
Critical
Pete Woods
unity8 (Ubuntu RTM)
Fix Released
Critical
Pete Woods

Bug Description

phablet@ubuntu-phablet:~$ system-image-cli -i
current build number: 237
device name: krillin
channel: ubuntu-touch/ubuntu-rtm/14.09-proposed
last update: 2015-02-17 17:04:34
version version: 237
version ubuntu: 20150217
version device: 20150216-fe747ac
version custom: 20150207-538-29-183

You can easily see if the GPS is active or not by checking the logcat output (running as root). In this case the hardware remains on (consumed by the location-service) after opening a scope such as the weather channel one, and retrieving location.

To reproduce:
1 - Reboot the phone;
2 - Open logcat as root: sudo /system/bin/logcat
3 - From today's scope, click on the weather icon (opening the weather channel scopes)
4 - See that the GPS is active and location works as expected
5 - Move away from that scope, and check logcat's output (it will stay active, meaning that the location-service is still active).

Tags: battery vivid

Related branches

Changed in canonical-devices-system-image:
status: New → Confirmed
importance: Undecided → High
tags: added: battery
Revision history for this message
Ricardo Mendoza (ricmm) wrote :

From looking at the unity-scopes-shell code for the location provider, it seems like there is no direct correlation with the client request and the active location lookup service side. The request seems to be continuous and always on, is this is so, then we have a problem as this means the GPS hardware is active and signalling even though the user is not interested in location data at the moment.

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Also, it doesn't happen with today's scope, but I can see from logcat that the GPS hardware is never really used in there (but it gets used by the weather scope).

Revision history for this message
Pete Woods (pete-woods) wrote :

I just put together a branch for unity-scopes-shell that logs when GPS updates from the location service are being enabled and disabled:

lp:~unity-api-team/unity-scopes-shell/log-when-updating-location

Trying this on my device produces the expected behaviour, i.e.:

* When looking at a scope that requires location, it enables location updates.
* When you move away from that scope, location updates stay enabled for a 5 second timeout (in order that the GPS isn't rapidly turned on and off as you browse through scopes).

To be clear, the location "session" remains active all the time, we just toggle the "updates" property. This is the (I believe correct) way tvoß explained to use the location service to me.

Log output:
Enabling location updates
Disabling location updates
Enabling location updates
Disabling location updates
Enabling location updates
Disabling location updates

Revision history for this message
Pete Woods (pete-woods) wrote :

So it's *possible* the problem could be in the location service, maybe?

Revision history for this message
Pete Woods (pete-woods) wrote :

Okay, further debugging reveals that if you put the phone to sleep with a scope that requires location visible, the location updates are not disabled.

Looks like this is a regression. The location service listens to when scopes are marked as active/inactive, and they all used to be marked inactive when the phone went to sleep. This is obviously no-longer the case.

Revision history for this message
Pete Woods (pete-woods) wrote :

I think it's worth noting that this bug could be in addition to the problem rsalveti is mentioning

Revision history for this message
Thomas Voß (thomas-voss) wrote :

Please find a verbose variant of the GPS Provider here:

  https://code.launchpad.net/~thomas-voss/location-service/be-verbose-about-starting-and-stopping-updates-for-testing/+merge/250600

To use it, the upstart override job for the location service has to be adjusted such that:

  GLOG_v=100 GLOG_logtostderr=1

is in the environment of the job. You can find the logs in /var/log/upstart/ubuntu-location-service.log

Changed in canonical-devices-system-image:
milestone: none → ww13-ota
status: Confirmed → In Progress
Changed in unity-scopes-api (Ubuntu RTM):
assignee: nobody → Pete Woods (pete-woods)
importance: Undecided → Critical
status: New → In Progress
Changed in canonical-devices-system-image:
importance: High → Critical
Revision history for this message
Pete Woods (pete-woods) wrote :

Testing the build from silo 3 confirms that the GPS active / inactive signal is being sent to the location service 5 seconds after the screen turns off.

Revision history for this message
Pete Woods (pete-woods) wrote :

Checking the logcat output, I definitely see the GPS updates stopping after moving away from location-aware scopes. This is on an N4.

Revision history for this message
Pete Woods (pete-woods) wrote :

Okay, tvoss has helped uncover the actual bug. There's a refcounting error with temporary scopes. Attaching MR.

Pete Woods (pete-woods)
Changed in location-service (Ubuntu):
status: New → Invalid
Changed in unity-scopes-api (Ubuntu RTM):
status: In Progress → Invalid
Changed in unity-scopes-shell (Ubuntu):
importance: Undecided → Critical
assignee: nobody → Pete Woods (pete-woods)
status: New → Confirmed
Changed in unity-scopes-shell (Ubuntu RTM):
status: New → Confirmed
Changed in unity8 (Ubuntu):
status: New → Confirmed
Changed in unity8 (Ubuntu RTM):
status: New → Confirmed
Changed in unity-scopes-shell (Ubuntu RTM):
importance: Undecided → Critical
assignee: nobody → Pete Woods (pete-woods)
Changed in unity8 (Ubuntu):
importance: Undecided → Critical
assignee: nobody → Pete Woods (pete-woods)
Changed in unity8 (Ubuntu RTM):
importance: Undecided → Critical
assignee: nobody → Pete Woods (pete-woods)
status: Confirmed → In Progress
Changed in unity8 (Ubuntu):
status: Confirmed → In Progress
Changed in unity-scopes-shell (Ubuntu RTM):
status: Confirmed → In Progress
Changed in unity-scopes-shell (Ubuntu):
status: Confirmed → In Progress
kevin gunn (kgunn72)
tags: added: vivid
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity-scopes-shell - 0.5.4+15.04.20150226-0ubuntu1

---------------
unity-scopes-shell (0.5.4+15.04.20150226-0ubuntu1) vivid; urgency=medium

  [ CI Train Bot ]
  * New rebuild forced.

  [ Pete Woods ]
  * Manage location activations with shared pointers instead of manual
    reference counting (LP: #1422879)
 -- CI Train Bot <email address hidden> Thu, 26 Feb 2015 19:38:49 +0000

Changed in unity-scopes-shell (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity8 - 8.02+15.04.20150226-0ubuntu1

---------------
unity8 (8.02+15.04.20150226-0ubuntu1) vivid; urgency=medium

  [ CI Train Bot ]
  * New rebuild forced.

  [ Pete Woods ]
  * Only set scopes active when the screen is on (LP: #1422879)
 -- CI Train Bot <email address hidden> Thu, 26 Feb 2015 19:39:54 +0000

Changed in unity8 (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity-scopes-shell - 0.5.4+15.04.20150226~rtm-0ubuntu1

---------------
unity-scopes-shell (0.5.4+15.04.20150226~rtm-0ubuntu1) 14.09; urgency=medium

  [ CI Train Bot ]
  * New rebuild forced.

  [ Pete Woods ]
  * Manage location activations with shared pointers instead of manual
    reference counting (LP: #1422879)
 -- CI Train Bot <email address hidden> Thu, 26 Feb 2015 22:00:38 +0000

Changed in unity-scopes-shell (Ubuntu RTM):
status: In Progress → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity8 - 8.02+15.04.20150226~rtm-0ubuntu1

---------------
unity8 (8.02+15.04.20150226~rtm-0ubuntu1) 14.09; urgency=medium

  [ CI Train Bot ]
  * New rebuild forced.

  [ Pete Woods ]
  * Only set scopes active when the screen is on (LP: #1422879)
 -- CI Train Bot <email address hidden> Thu, 26 Feb 2015 22:01:45 +0000

Changed in unity8 (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.

Other bug subscribers

Remote bug watches

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