Closed Bug 1885167 Opened 10 months ago Closed 10 months ago

Download complete notification does not navigate to downloaded file when firefox is in the background

Categories

(Fenix :: Downloads, defect, P2)

All
Android
defect

Tracking

(firefox126 verified)

RESOLVED FIXED
126 Branch
Tracking Status
firefox126 --- verified

People

(Reporter: pollymce, Assigned: pollymce)

References

Details

(Whiteboard: [fxdroid] [group4])

Attachments

(3 files, 5 obsolete files)

Steps to reproduce

  1. Open firefox and download any file
  2. Wait for download to complete
  3. Background firefox (eg. by pressing home button)
  4. Tap on Download Completed notification

Expected behavior

If an app has been set up to handle this file type, downloaded file is opened in that app
If not, a chooser menu is presented to select an app to open the download

Actual behavior

The file is not opened
An error appears in the log: Indirect notification activity start (trampoline) from org.mozilla.firefox blocked

Device information

  • Firefox version: release build 123.1.0 / latest debug build
  • Android device model: Pixel 8 / Samsung S24
  • Android OS version: Android 14

Any additional information?

It looks like we are running into notification trampoline restrictions as described here: https://developer.android.com/about/versions/12/behavior-changes-12#notification-trampolines
We could fix this by launching an Activity directly rather than using a BroadcastReceiver and a Service to launch the Activity.

Severity: -- → S3
See Also: → 1878402
Whiteboard: [fxdroid] [group4]

Content intent of completed DownloadNotification now uses a PendingIntent which launches an Activity directly.
Previously, we launched the Activity indirectly from a BroadcastReceiver, which is less performant and is prohibited by the OS since Android 12.
The download notification test has been modified to mock out the file opening behaviour, as this test is just checking the visuals of the notification rather than the onward journeys.

Attached file Bug 1885167 (obsolete) —

Fix lint issues.

Attached file Bug 1885167 (obsolete) —

Add notification trampoline test case that fails before the fix was made & passes after, to cover this bug.

Attached file Bug 1885167 (obsolete) —

Fix more lint errors

Attached file Bug 1885167 (obsolete) —

Remove the ACTION_OPEN handling, logging and related messaging.
We are now sending the intent to open the file directly to the Android OS to handle, so none of this is required.
The telemetry wasn't being sent previously anyway because:
a) from what i can see in glean, these metrics have expired
b) this ACTION_OPEN code path hasn't been working since targetting android 12

Assignee: nobody → pmceldowney
Attachment #9391974 - Attachment description: WIP: Bug 1885167 → Bug 1885167
Status: NEW → ASSIGNED
Attachment #9391975 - Attachment description: WIP: Bug 1885167 → Bug 1885167
Attachment #9391976 - Attachment description: WIP: Bug 1885167 → Bug 1885167
Attachment #9391977 - Attachment description: WIP: Bug 1885167 → Bug 1885167
Attachment #9391978 - Attachment description: WIP: Bug 1885167 → Bug 1885167
Priority: -- → P2
Attached file Bug 1885167 (obsolete) —

Remove the ACTION_OPEN handling, logging and related messaging.
We are now sending the intent to open the file directly to the Android OS to handle, so none of this is required.
The telemetry wasn't being sent previously anyway because:
a) from what i can see in glean, these metrics have expired
b) this ACTION_OPEN code path hasn't been working since targetting android 12

Attachment #9391978 - Attachment is obsolete: true
Attachment #9391975 - Attachment is obsolete: true
Attachment #9391976 - Attachment is obsolete: true
Attachment #9391977 - Attachment is obsolete: true
Attachment #9392016 - Attachment is obsolete: true
Attachment #9391974 - Attachment description: Bug 1885167 → Bug 1885167 - fix onward journey from completed download notification
Pushed by pmceldowney@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/991a37292b8d fix onward journey from completed download notification r=android-reviewers,boek,kaya

Backed out for causing linting opt failures.

L.E. Please also check this.

Flags: needinfo?(pmceldowney)
Pushed by pmceldowney@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/71c813e27dff fix onward journey from completed download notification r=android-reviewers,boek,kaya

Backed out for causing linting failures on AbstractFetchDownloadService.kt

[task 2024-03-25T10:09:15.394Z] > Task :detekt FAILED
[task 2024-03-25T10:09:15.394Z] /builds/worker/checkouts/gecko/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/AbstractFetchDownloadService.kt:988:13: The function createOpenFileIntent is missing documentation. [UndocumentedPublicFunction]
[task 2024-03-25T10:09:15.394Z] 
[task 2024-03-25T10:09:15.394Z] /builds/worker/checkouts/gecko/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/AbstractFetchDownloadService.kt - 20min debt
[task 2024-03-25T10:09:15.394Z] 	UndocumentedPublicFunction - [The function createOpenFileIntent is missing documentation.] at /builds/worker/checkouts/gecko/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/AbstractFetchDownloadService.kt:988:13
[task 2024-03-25T10:09:15.394Z] 
[task 2024-03-25T10:09:15.394Z] Overall debt: 20min
[task 2024-03-25T10:09:15.394Z] 
[task 2024-03-25T10:09:15.394Z] comments - 20min debt
[task 2024-03-25T10:09:15.394Z] 	UndocumentedPublicFunction - [The function createOpenFileIntent is missing documentation.] at /builds/worker/checkouts/gecko/mobile/android/android-components/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/AbstractFetchDownloadService.kt:988:13
[task 2024-03-25T10:09:15.394Z] 

sorry for breaking stuff! :(
i have now figured out which linters to run, fixed the errors and got a successful try https://treeherder.mozilla.org/jobs?repo=try&revision=b1d1fce9984a4da12ef6b1b07924cbc595280045

Flags: needinfo?(pmceldowney)
Pushed by pmceldowney@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/66f9284bf68d fix onward journey from completed download notification r=android-reviewers,boek,kaya
Status: ASSIGNED → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → 126 Branch
Flags: qe-verify+

Verified as fixed on the latest Nightly - 126.0a1 from 27.03.2024 with Samsung Galaxy S23 Ultra (Android 14) and OnePlus A3000 (Android 6).

Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: