Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

RuntimeException: Error receiving broadcast Intent { act=mozilla.components.feature.downloads.OPEN flg=0x10 pkg=org... #6436

Closed
pocmo opened this issue Nov 4, 2019 · 16 comments
Assignees
Labels
b:crash Crashes Fenix: should link to Sentry, Crash-Stats or GPlay info 🐞 bug Crashes, Something isn't working, .. E3 Estimation Point: average, 2 - 3 days eng:qa:verified QA Verified Feature:Download needs:strings Needs strings S2 Major Functionality/product severely impaired and a satisfactory workaround doesn't exist

Comments

@pocmo
Copy link
Contributor

pocmo commented Nov 4, 2019

https://sentry.prod.mozaws.net/operations/fenix-nightly/issues/6599952/

ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://org.mozilla.fenix.nightly.fileprovider/Download/Download/null typ=application/vnd.android.package-archive flg=0x10000001 }
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1792)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1512)
    at android.app.ContextImpl.startActivity(ContextImpl.java:1433)
    at android.app.ContextImpl.startActivity(ContextImpl.java:1385)
    at android.content.ContextWrapper.startActivity(ContextWrapper.java:334)
...
(10 additional frame(s) were not displayed)

RuntimeException: Error receiving broadcast Intent { act=mozilla.components.feature.downloads.OPEN flg=0x10 pkg=org.mozilla.fenix.nightly (has extras) } in mozilla.components.feature.downloads.AbstractFetchDownloadService$broadcastReceiver$2$1@1150109f
    at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:927)
    at android.os.Handler.handleCallback(Handler.java:815)
    at android.os.Handler.dispatchMessage(Handler.java:104)
    at android.os.Looper.loop(Looper.java:210)
    at android.app.ActivityThread.main(ActivityThread.java:5839)
...
(4 additional frame(s) were not displayed)

Error receiving broadcast Intent { act=mozilla.components.feature.downloads.OPEN flg=0x10 pkg=org.mozilla.fenix.nightly (has extras) } in mozilla.components.feature.downloads.AbstractFetchDownloadService$broadcastReceiver$2$1@1150109f

┆Issue is synchronized with this Jira Task

@pocmo pocmo added b:crash Crashes Fenix: should link to Sentry, Crash-Stats or GPlay info 🐞 bug Crashes, Something isn't working, .. labels Nov 4, 2019
@pocmo
Copy link
Contributor Author

pocmo commented Nov 4, 2019

java.lang.RuntimeException: Error receiving broadcast Intent { act=mozilla.components.feature.downloads.OPEN flg=0x10 pkg=org.mozilla.fenix.nightly (has extras) } in mozilla.components.feature.downloads.AbstractFetchDownloadService$broadcastReceiver$2$1@1150109f

@pocmo
Copy link
Contributor Author

pocmo commented Nov 4, 2019

@sblatz That looks like it may be a regression from the downloads work?

@AndiAJ
Copy link
Collaborator

AndiAJ commented Nov 7, 2019

Hi @pocmo reproducible on the latest Nightly Build #13110606 from 7/11 using the following devices:
• Google Pixel 3a XL (Android 9)
• Pixel 2 (Android 9)
• Huawei Honor 8 (Android 7.0)

 --------- beginning of crash
2019-11-07 14:15:38.002 30593-30593/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: org.mozilla.fenix.nightly, PID: 30593
    java.lang.RuntimeException: Error receiving broadcast Intent { act=mozilla.components.feature.downloads.OPEN flg=0x10 pkg=org.mozilla.fenix.nightly (has extras) } in mozilla.components.feature.downloads.AbstractFetchDownloadService$broadcastReceiver$2$1@d0abd79
        at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1401)
        at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6718)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://org.mozilla.fenix.nightly.fileprovider/Download/Download/null typ=application/msword flg=0x10000001 }
        at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2007)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1673)
        at android.app.ContextImpl.startActivity(ContextImpl.java:917)
        at android.app.ContextImpl.startActivity(ContextImpl.java:888)
        at android.content.ContextWrapper.startActivity(ContextWrapper.java:379)
        at mozilla.components.feature.downloads.AbstractFetchDownloadService$broadcastReceiver$2$1.onReceive(AbstractFetchDownloadService.kt:34)
        at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1391)
        at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2) 
        at android.os.Handler.handleCallback(Handler.java:873) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6718) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:8582019-11-07 14:15:38.003 30593-30593/? I/mozac/CrashReporter: Received crash: UncaughtExceptionCrash(throwable=java.lang.RuntimeException: Error receiving broadcast Intent { act=mozilla.components.feature.downloads.OPEN flg=0x10 pkg=org.mozilla.fenix.nightly (has extras) } in mozilla.components.feature.downloads.AbstractFetchDownloadService$broadcastReceiver$2$1@d0abd79, breadcrumbs=[Breadcrumb(message=Changing to fragment homeFragment, isCustomTab: false, data={}, category=DestinationChanged, level=INFO, type=DEFAULT, date=Thu Nov 07 14:14:14 GMT+02:00 2019), Breadcrumb(message=Changing to fragment historyFragment, isCustomTab: false, data={}, category=DestinationChanged, level=INFO, type=DEFAULT, date=Thu Nov 07 14:14:25 GMT+02:00 2019), Breadcrumb(message=Changing to fragment browserFragment, isCustomTab: false, data={}, category=DestinationChanged, level=INFO, type=DEFAULT, date=Thu Nov 07 14:14:26 GMT+02:00 2019)])
2019-11-07 14:15:38.003 30593-30593/? I/mozac/CrashReporter: Showing prompt
2019-11-07 14:15:38.009 1174-2853/? I/ActivityManager: START u0 {flg=0x10018000 cmp=org.mozilla.fenix.nightly/mozilla.components.lib.crash.prompt.CrashReporterActivity (has extras)} from uid 10184
2019-11-07 14:15:38.013 769-769/? d/android.hardware.power@1.3-service.bonito-libperfmgr: LAUNCH ON
2019-11-07 14:15:38.020 30593-30593/? I/Process: Sending signal. PID: 30593 SIG: 9
2019-11-07 14:15:38.024 1174-1198/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
2019-11-07 14:15:38.025 1174-1198/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
2019-11-07 14:15:38.060 30622-30848/? I/Gecko: Exiting due to channel error.
2019-11-07 14:15:38.076 1174-1354/? W/InputDispatcher: channel 'd45ef44 org.mozilla.fenix.nightly/org.mozilla.fenix.HomeActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
2019-11-07 14:15:38.076 1174-1354/? E/InputDispatcher: channel 'd45ef44 org.mozilla.fenix.nightly/org.mozilla.fenix.HomeActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2019-11-07 14:15:38.077 1174-4102/? I/WindowManager: WIN DEATH: Window{d45ef44 u0 org.mozilla.fenix.nightly/org.mozilla.fenix.HomeActivity}
2019-11-07 14:15:38.078 1174-5091/? I/ActivityManager: Process org.mozilla.fenix.nightly (pid 30593) has died: fore TOP 
2019-11-07 14:15:38.078 1174-4102/? W/InputDispatcher: Attempted to unregister already unregistered input channel 'd45ef44 org.mozilla.fenix.nightly/org.mozilla.fenix.HomeActivity (server)'
2019-11-07 14:15:38.078 1174-1201/? W/libprocessgroup: kill(-30593, 9) failed: No such process
2019-11-07 14:15:38.078 1174-5091/? W/ActivityManager: Scheduling restart of crashed service org.mozilla.fenix.nightly/org.mozilla.fenix.downloads.DownloadService in 1000ms
2019-11-07 14:15:38.082 685-685/? I/Zygote: Process 30593 exited due to signal (9)
2019-11-07 14:15:38.103 1174-6207/? I/ActivityManager: Process org.mozilla.fenix.nightly:tab (pid 30622) has died: fore SVC 
2019-11-07 14:15:38.113 685-685/? I/Zygote: Process 30622 exited cleanly (0)
2019-11-07 14:15:38.115 30960-30960/? E/h.CrashReporte: Not starting debugger since process cannot load the jdwp agent.
2019-11-07 14:15:38.119 1174-1200/? I/ActivityManager: Start proc 30960:org.mozilla.fenix.nightly:mozilla.components.lib.crash.CrashReporter/u0a184 for activity org.mozilla.fenix.nightly/mozilla.components.lib.crash.prompt.CrashReporterActivity
`

@AndiAJ AndiAJ added the S2 Major Functionality/product severely impaired and a satisfactory workaround doesn't exist label Nov 7, 2019
@sblatz
Copy link
Contributor

sblatz commented Nov 7, 2019

@AndiAJ do you have steps to reproduce on this? :)

@AndiAJ
Copy link
Collaborator

AndiAJ commented Nov 7, 2019

@sblatz - Sure! :)

  1. Navigate to https://file-examples.com/index.php/sample-documents-download/sample-doc-download/
  2. Download a file
  3. From the Android task bar tap on the download confirmation notification

► Video
20191107_183700

@sblatz sblatz self-assigned this Nov 7, 2019
@sblatz
Copy link
Contributor

sblatz commented Nov 7, 2019

Awesome, this looks like it is actually a failed download, but is claimed to be completed. This should be fixed by mozilla-mobile/android-components#4999

@sblatz sblatz added the 🙅 waiting Issues that are blocked or has dependencies that are not ready label Nov 7, 2019
@cpeterso
Copy link

cpeterso commented Nov 7, 2019

@pocmo
Copy link
Contributor Author

pocmo commented Nov 8, 2019

@sblatz I think regardless of the download being completed/failed we have an issue in openFile():
https://github.com/mozilla-mobile/android-components/blob/master/components/feature/downloads/src/main/java/mozilla/components/feature/downloads/AbstractFetchDownloadService.kt#L361-L377

For a bunch of files it can happen that there is just no application / activity that can open it. In that case startActivity will throw ActivityNotFoundException like in the stacktrace @AndiAJ posted. We can either query package manager and ask it whether there's an activity that can handle the intent or just catch ActivityNotFoundException.
The quickest, most pragmatic choice for this error case is probably to just show an error toast.

@sblatz
Copy link
Contributor

sblatz commented Nov 8, 2019

Ah, thank you for the clarification on this, @pocmo! I'll dig into it :)

@sblatz sblatz removed the 🙅 waiting Issues that are blocked or has dependencies that are not ready label Nov 8, 2019
@sblatz
Copy link
Contributor

sblatz commented Nov 8, 2019

@brampitoyo what string should we use when a user does not have an app installed to open the file?

I was thinking something along the lines of: "Cannot open file"

@sblatz sblatz added the E3 Estimation Point: average, 2 - 3 days label Nov 8, 2019
@sblatz sblatz added the needs:strings Needs strings label Nov 11, 2019
@brampitoyo
Copy link

@sblatz Android natively shows a toast with “Can’t open file”:

So, we should also follow that example and show a toast above our URL bar:

What should we say? What about something along the lines of “No application to open this file”. It’s more descriptive, but is it also more confusing? If that’s the case, then I agree with your suggestion: “Cannot open file”.

@sblatz
Copy link
Contributor

sblatz commented Nov 12, 2019

Now that mozilla-mobile/android-components#5031 is merged, this should be testable in our next nightly :)

@sblatz sblatz added the eng:qa:needed QA Needed label Nov 12, 2019
@sv-ohorvath
Copy link
Contributor

sv-ohorvath commented Nov 13, 2019

Still reproducing on Nightly 191113 (@6am), close the in-app notification and tap the system notification, you will get the same crash:
log 2.txt

Crashes also when tapping Open in the in-app notification of a completed download:
log 1.txt

you can also try these files:

@sv-ohorvath sv-ohorvath removed the eng:qa:needed QA Needed label Nov 13, 2019
@sblatz sblatz added eng:qa:needed QA Needed and removed eng:qa:needed QA Needed labels Nov 14, 2019
@sv-ohorvath
Copy link
Contributor

@sblatz The crash is fixed but there's no snackbar notification displayed if you tap open from the in-app notification. Will this: #6436 (comment) be implemented?

@sv-ohorvath sv-ohorvath added eng:qa:verified QA Verified and removed eng:qa:needed QA Needed labels Nov 15, 2019
@sv-ohorvath sv-ohorvath removed the eng:qa:verified QA Verified label Nov 15, 2019
sblatz added a commit to sblatz/fenix that referenced this issue Nov 16, 2019
@sblatz
Copy link
Contributor

sblatz commented Nov 16, 2019

Should be fixed by: #6648

sblatz added a commit to sblatz/fenix that referenced this issue Nov 22, 2019
sblatz added a commit to sblatz/fenix that referenced this issue Nov 22, 2019
@sblatz sblatz added the eng:qa:needed QA Needed label Nov 22, 2019
@lobontiumira
Copy link

Verified as fixed on the latest Nightly build from 11/25 with Google Pixel 3 (Android Q), and Huawei P9 Lite (Android 7).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
b:crash Crashes Fenix: should link to Sentry, Crash-Stats or GPlay info 🐞 bug Crashes, Something isn't working, .. E3 Estimation Point: average, 2 - 3 days eng:qa:verified QA Verified Feature:Download needs:strings Needs strings S2 Major Functionality/product severely impaired and a satisfactory workaround doesn't exist
Projects
None yet
Development

No branches or pull requests

7 participants