Closed Bug 1336734 Opened 8 years ago Closed 8 years ago

Navigating within preferences screens triggers unnecessary application-background/application-foreground events

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(firefox54 fixed)

RESOLVED FIXED
Firefox 54
Tracking Status
firefox54 --- fixed

People

(Reporter: JanH, Assigned: JanH)

References

Details

Attachments

(2 files, 1 obsolete file)

We have some code (https://dxr.mozilla.org/mozilla-central/rev/1d025ac534a6333a8170a59a95a8a3673d4028ee/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java#109) whose purpose it seems to be to make sure that Gecko is paused only when Firefox as a whole is backgrounded, as opposed to us merely switching to a different activity *within* Firefox. I've no idea how our settings screen used to work at that time when this was originally implemented (bug 826385), however as of now it looks like this logic doesn't properly cope with navigation within the settings. It seems like each child menu screen (General, Search, Privacy, etc., as well as any "grand children", e.g. General -> Home, and so forth) is a fresh activity and since GeckoPreferences always returns "false" for isGeckoActivityOpened(), this allows the whole if-block in onActivityPause() to run, triggering a call to GeckoThread.onPause() and all that entails, only to be immediately followed by a onActivityResume() for the new screen. When going back up the levels of the settings we're at least saved because in that case activity.isFinishing() will be true, so we skip pausing Gecko. Oh, and the GeckoNetworkManager stop() call is placed outside of that if-block, so currently it is paused and immediately restarted (through onActivityResume()) even more frequently, namely each time we navigate within/exit/enter the settings.
Assignee: nobody → jh+bugzilla
I need to check this, but I probably have to implement GeckoActivityStatus for the FxAccountStatusActivity as well, otherwise backgrounding the app from there would go unnoticed.
Comment on attachment 8833775 [details] Bug 1336734 - Part 1 - Have GeckoPreferences properly support GeckoActivityStatus. https://reviewboard.mozilla.org/r/109924/#review111964 ::: mobile/android/base/java/org/mozilla/gecko/GeckoActivity.java:71 (Diff revision 2) > public void startActivityForResult(Intent intent, int request) { > mGeckoActivityOpened = checkIfGeckoActivity(intent); > super.startActivityForResult(intent, request); > } > > - private static boolean checkIfGeckoActivity(Intent intent) { > + public static boolean checkIfGeckoActivity(Intent intent) { It looks like this could be moved to IntentUtils completely.
Attachment #8833775 - Flags: review?(s.kaspari) → review+
Comment on attachment 8834115 [details] Bug 1336734 - Part 2 - Implement GeckoActivityStatus for the FxAccountStatusActivity. https://reviewboard.mozilla.org/r/110172/#review111970
Attachment #8834115 - Flags: review?(s.kaspari) → review+
Comment on attachment 8833776 [details] Bug 1336734 - Part 2 - Don't stop the GeckoNetworkManager unless we're really backgrounded. https://reviewboard.mozilla.org/r/109926/#review111972
Attachment #8833776 - Flags: review?(s.kaspari) → review+
Pushed by mozilla@buttercookie.de: https://hg.mozilla.org/integration/autoland/rev/a2b69382c9ad Part 1 - Have GeckoPreferences properly support GeckoActivityStatus. r=sebastian https://hg.mozilla.org/integration/autoland/rev/fa9cca3e321c Part 2 - Implement GeckoActivityStatus for the FxAccountStatusActivity. r=sebastian https://hg.mozilla.org/integration/autoland/rev/a7f9815aeec1 Part 3 - Don't stop the GeckoNetworkManager unless we're really backgrounded. r=sebastian
Backed out for android build bustage like https://treeherder.mozilla.org/logviewer.html#?job_id=76440293&repo=autoland https://hg.mozilla.org/integration/autoland/rev/0c8cd30bc427 >12:51:03 <JanH> KWierso: I think you can backout bug 1336734 again from autoland - unfortunately it seems like the normal Android build does things differently than the gradle one (and fails)
Flags: needinfo?(jh+bugzilla)
Blocks: 1338673
Attachment #8834115 - Attachment is obsolete: true
Left out the offending part and opened a new bug for that (bug 1338673). It means that opening the sync settings will still trigger "application-background", but at least in that case that'll stick until the user leaves that screen again, whereas the current behaviour in the settings is that each navigation *into* the settings triggers a "application-background" + "application-foreground" combo.
Flags: needinfo?(jh+bugzilla)
Pushed by mozilla@buttercookie.de: https://hg.mozilla.org/integration/autoland/rev/b5d12d30e6cf Part 1 - Have GeckoPreferences properly support GeckoActivityStatus. r=sebastian https://hg.mozilla.org/integration/autoland/rev/be42accd3a48 Part 2 - Don't stop the GeckoNetworkManager unless we're really backgrounded. r=sebastian
Blocks: 1328868
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 54
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: