Closed Bug 1489594 Opened 6 years ago Closed 6 years ago

File picker doesn't appear when runtime permissions prompt appears first

Categories

(Firefox for Android Graveyard :: General, defect)

Firefox 60
All
Android
defect
Not set
normal

Tracking

(firefox62 wontfix, firefox63+ verified, firefox64 verified)

VERIFIED FIXED
Firefox 64
Tracking Status
firefox62 --- wontfix
firefox63 + verified
firefox64 --- verified

People

(Reporter: JanH, Assigned: JanH)

References

Details

(Keywords: regression)

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1489532 +++

I.e. for me, the file picker works fine if permissions are automatically granted or denied by the OS, but not if a permission prompt pops up.

Triggered by https://hg.mozilla.org/integration/autoland/rev/9f1acf3452e1 of bug 1437382.

The problem seems to be that moving our application-background handling forward to onSaveInstanceState also means that the current activity is cleared earlier from the GeckoActivityMonitor and we run into a problem at https://dxr.mozilla.org/mozilla-central/rev/c2e3be6a1dd352b969a45f0b85e87674e24ad284/mobile/android/base/java/org/mozilla/gecko/FilePicker.java#287-290.
When the OS needs to display a permission prompt, our current activity is paused
and onSaveInstanceState gets called, however the activity isn't stopped yet.
When the permission handling then returns with the results to us, we display
the file picker using the current activity as retrieved from the GeckoActivity-
Monitor.

The problem is that in bug 1437382, our application-background handling was
changed such that it would already be triggered by the preparatory onSave-
InstanceState call. This had the side effect that the current activity would
be cleared from the GeckoActivityMonitor at that point already. Therefore, in
our case showing the file picker would fail because the GAM would have cleared
the current activity already after the runtime permission prompt caused our
previous activity to save its state.

To fix this, we change the behaviour of the GeckoActivityMonitor such that it
will continue to trigger our application-background handling during onSave-
InstanceState if possible, but will only clear the current activity when it is
stopping for real.
Comment on attachment 9007338 [details]
Bug 1489594 - Decouple application-background event from clearing of current activity. r?jchen

Jim Chen [:jchen] [:darchons] has approved the revision.
Attachment #9007338 - Flags: review+
Pushed by mozilla@buttercookie.de:
https://hg.mozilla.org/integration/autoland/rev/910902e3dea7
Decouple application-background event from clearing of current activity. r=jchen
https://hg.mozilla.org/mozilla-central/rev/910902e3dea7
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 64
Why did you request release tracking for 62?
Flags: needinfo?(jh+bugzilla)
For someone to decide whether we want to fix this as a potential ride-along if we do a dot release, or wait until 63.
Flags: needinfo?(jh+bugzilla)
If this dates back to 60 and nobody noticed until now it doesn't seem that severe?
True, I guess.
Comment on attachment 9007338 [details]
Bug 1489594 - Decouple application-background event from clearing of current activity. r?jchen

Approval Request Comment
[Feature/Bug causing the regression]: Bug 1437382
[User impact if declined]: User cannot upload files if this triggers an OS runtime permissions prompt because camera/storage permissions for Firefox haven't yet been granted/permanently denied.
[Is this code covered by automated tests?]: No.
[Has the fix been verified in Nightly?]: Yes.
[Needs manual test from QE? If yes, steps to reproduce]: No.
[List of other uplifts needed for the feature/fix]: no
[Is the change risky?]: Low.
[Why is the change risky/not risky?]: Small change to restore the behaviour from before bug 1437382 as far as retrieving the current activity from the GeckoActivityMonitor is concerned.
[String changes made/needed]: none
Attachment #9007338 - Flags: approval-mozilla-beta?
Comment on attachment 9007338 [details]
Bug 1489594 - Decouple application-background event from clearing of current activity. r?jchen

We are still early in the beta cycle  so taking this for uplift in 63 beta.
Attachment #9007338 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Comment on attachment 9007338 [details]
Bug 1489594 - Decouple application-background event from clearing of current activity. r?jchen

Regression fix for fennec, uplift accepted for the next beta.
(In reply to Pascal Chevrel:pascalc from comment #11)
> Comment on attachment 9007338 [details]
> Bug 1489594 - Decouple application-background event from clearing of current
> activity. r?jchen
> 
> Regression fix for fennec, uplift accepted for the next beta.

it seems I really want this one in :)
Flags: qe-verify+
Verified as fixed in the latest Nightly 64.0a1 (2018-09-17) and Beta 63.0b7 on Nokia 6 (Android 7.1.1) and LG G4 (Android 5.1).
URL tested: https://uploadfiles.io and https://files.fm
Status: RESOLVED → VERIFIED
Flags: qe-verify+
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: