Fennec shouldn't use the GPS when the tab or app is in the background

REOPENED
Unassigned

Status

()

REOPENED
6 years ago
a year ago

People

(Reporter: dbaron, Unassigned, Mentored)

Tracking

(Blocks: 1 bug, {power, privacy})

Trunk
ARM
Android
power, privacy
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

I noticed a usage pattern I've started doing to save battery that seems like I shouldn't have to do it.  In particular, I sometimes load http://nextmuni.com/ on Fennec... and I want to leave the page open so that I can go back to it a few minutes later.  However, if I leave the page open in Fennec and hit the [Home] key to use another app, the GPS icon on my phone stays active and the battery drains rather quickly as a result.  So to avoid this I have to make sure to leave a page that uses the GPS before leaving Fennec, so that Fennec will stop using the GPS.

I feel like I shouldn't have to do this, and Fennec should do the right thing for me by default.

Steps to reproduce:
 1. load http://nextmuni.com/
 2. hit the home button and start doing something with another app

Expected results:  Fennec stops using the GPS

Actual results: Fennec continues using the GPS

(Same steps apply replacing (2) with switching to another Fennec tab.)

Updated

6 years ago
Assignee: nobody → doug.turner

Comment 1

6 years ago
unassigning things that I am not working on.

Updated

6 years ago
Assignee: doug.turner → nobody

Comment 2

3 years ago
This is still valid, a watch position stays active 
1) when the app is backgrounded,
2) when tab is not current,

Chrome on Android does not do (1) or (2).
Mentor: gkeeley

Comment 3

3 years ago
(In reply to David Baron [:dbaron] ⏰UTC-7 from comment #0)
> Expected results:  Fennec stops using the GPS

For one of the pages I use a ton, this actually would be a completely unexpected behavior. I run lantea.kairo.at in a Fennec tab to record my GPS tracks (because apparently our web apps support seems to fail to launch it as an app installed from the Marketplace, with a very weird error message). I would never want that to be stopped and I'm actually pretty annoyed at both Lollipop and Fennec because either the tab or Fennec get unloaded quite often when I don't keep that tab in front all the time.

Comment 4

3 years ago
(In reply to Robert Kaiser (:kairo@mozilla.com) - on vacation or slow to reply until the end of June from comment #3)
> (In reply to David Baron [:dbaron] ⏰UTC-7 from comment #0)
> > Expected results:  Fennec stops using the GPS
> 
> For one of the pages I use a ton, this actually would be a completely
> unexpected behavior.

I'd argue that it's bad *default* behavior to keep the GPS running for non-focused pages. (or once the browser is no longer the foreground application) This is especially true since GPS has the potential to drain the mobile's battery very quickly, leading to unhappy users. It should probably be possible to request an exception from this to enable Robert's use case, but to me that is secondary to remedying the bad user experience of "Oh god, my battery is half-dead. Why? Oh, I left Google Maps open in a browser tab."

Comment 5

3 years ago
I think:
users gained by this behaviour < users lost by this behaviour
This is a duplicate bug of bug 1216148. We posted a patch there that tried to stop background app using GPS as default.
Flags: needinfo?(doug.turner)

Updated

3 years ago
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1216148

Updated

3 years ago
Flags: needinfo?(doug.turner)
I tested the behavior on Fennec today and sadly this problem still exists. 
I am not sure how Feenec works at this point so I remove the duplicate flag to the Bug 1216148.

Looking forward to having Fennec team to take look at this issue.
Thanks!
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---

Comment 9

3 years ago
Fennec uses unrelated geolocation provider code to gecko, the code is all here:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java#506

public static void enableLocation(final boolean enable) is the function.

Roughly speaking, onPause() of the main activity, this could be 
if isLocationEnabled {
enableLocation(false)
} 
and onResume()
if isLocationEnabled {
enableLocation(true)
}

Comment 10

3 years ago
*Please* see: - https://github.com/slightlyoff/ServiceWorker/issues/745
IMHO the following is also well worth a look : - https://github.com/w3c/geofencing-api/issues/25

Also, Chromes bugfix for the same problem can be found here: - https://code.google.com/p/chromium/issues/detail?id=112938

WAKE_LOCKs or CPU_LOCKs or GPS_LOCKs, are a retrograde step with battery consumption and, curiously, ignore the best background processing since slice-bread "Service Workers"!

Comment 11

3 years ago
I am curious about the lack of importance flagged against this bug. FireFox is facilitating the unauthorized tracking of users by unscrupulous sites, and is not in a hurry to do anything about it :-( The user may well be happy to consent but the fact that they are oblivious to what's going on cannot be good surely?

This doesn't sound like the mozilla way or, for that matter, the way of anyone who doesn't want to open themselves up to litigation.
(Reporter)

Updated

2 years ago
See Also: → bug 1254911
(Reporter)

Updated

2 years ago
Keywords: power, privacy
See Also: → bug 1216148
You need to log in before you can comment on or make changes to this bug.