apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.59k stars 1.52k forks source link

Cordova app on Android crashes after choosing file with native HTML file input, only on Android 13 #1698

Closed NetMango closed 3 weeks ago

NetMango commented 1 month ago

Bug Report

Problem

My original problem was this issue: https://github.com/quasarframework/quasar/issues/17043 . I have a QUASAR - CORDOVA app, and I use file-inputs to upload files to server. But after some test it turned out, that QUASAR file input is not the fault, because the native HTML file input also generates the same error.

What is expected to happen?

Like below Android 13 ( sdk level < 33 ): after selecting a file, the app window comes back and shows the selected file name as normal. And the file upload works well.

What does actually happen?

Only on Android 13 Cordova app:

Information

I have a debug log:

D/VRI[MainActivity]: processPointerEvent: action: ACTION_DOWN, handled = true, X=340.2106, Y=1402.4269
D/VRI[MainActivity]: processPointerEvent: action: ACTION_UP, handled = true, X=340.2106, Y=1402.4269
D/ActivityThread: ***** performPauseActivity ActivityRecord{8a4bc7a token=android.os.BinderProxy@ea400a5 {hu.flowtion.app.bpmp/hu.flowtion.app.bpmp.MainActivity}} finished= false paused= false mFinished= false
D/CordovaActivity: Paused the activity.
D/ActivityThread: ***** handleStopActivity r ActivityRecord{8a4bc7a token=android.os.BinderProxy@ea400a5 {hu.flowtion.app.bpmp/hu.flowtion.app.bpmp.MainActivity}} stopped= false paused= true
D/CordovaActivity: Stopped the activity.
D/CompatibilityChangeReporter: Compat change id reported: 78294732; UID 10396; state: ENABLED
D/ActivityThread: ***** handleStartActivity ActivityRecord{8a4bc7a token=android.os.BinderProxy@ea400a5 {hu.flowtion.app.bpmp/hu.flowtion.app.bpmp.MainActivity}} stopped= true paused= true mFinished= false
D/CordovaActivity: Started the activity.
D/CordovaActivity: Incoming Result. Request code = 5173
D/CordovaInterfaceImpl: Sending activity result to plugin
D/SystemWebChromeClient: Receive file chooser URL: [Landroid.net.Uri;@44a70c5
D/ActivityThread: ***** performResumeActivity ActivityRecord{8a4bc7a token=android.os.BinderProxy@ea400a5 {hu.flowtion.app.bpmp/hu.flowtion.app.bpmp.MainActivity}} mFinished= false
D/CordovaActivity: Resumed the activity.
E/chromium: [ERROR:jni_android.cc(270)] Crashing due to uncaught Java exception
E/chromium: [ERROR:jni_android.cc(314)] Native stack trace:
    #00 pc 0x00000000040ef587 /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #01 pc 0x0000000002c9a367 /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #02 pc 0x0000000002c9926f /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #03 pc 0x000000000411ba7b /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #04 pc 0x000000000411b9cb /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #05 pc 0x0000000002c26323 /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #06 pc 0x0000000002c2776b /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #07 pc 0x0000000002c27a77 /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #08 pc 0x0000000002c28b97 /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #09 pc 0x0000000002ca58bf /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #10 pc 0x0000000002ca580b /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #11 pc 0x0000000002c1ba7f /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #12 pc 0x000000000007d59b /apex/com.android.runtime/lib64/bionic/libc.so
    #13 pc 0x0000000000016f3f /apex/com.android.runtime/lib64/bionic/libc.so
E/cr_JniAndroid: Handling uncaught Java exception
    java.lang.RuntimeException: An error occurred while executing doInBackground()
        at WV.n4.done(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:41)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:381)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:250)
        at java.util.concurrent.FutureTask.run(FutureTask.java:269)
        at WV.n4.run(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:26)
     Caused by: java.lang.IllegalArgumentException: You must pass a valid uri and observer
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
        at android.content.ContentProviderProxy.query(ContentProviderNative.java:481)
        at android.content.ContentResolver.query(ContentResolver.java:1231)
        at android.content.ContentResolver.query(ContentResolver.java:1157)
        at android.content.ContentResolver.query(ContentResolver.java:1113)
        at org.chromium.base.ContentUriUtils.b(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:18)
        at WV.y8.b(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:23)
        at WV.k4.call(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:9)
        at java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at WV.n4.run(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:26) 
E/AndroidRuntime: FATAL EXCEPTION: ThreadPoolForeg
    Process: hu.flowtion.app.bpmp, PID: 20008
    org.chromium.base.JniAndroid$UncaughtExceptionException: Native stack trace:
    #00 pc 0x00000000040ef587 /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #01 pc 0x0000000002c9a367 /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #02 pc 0x0000000002c9926f /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #03 pc 0x000000000411ba7b /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #04 pc 0x000000000411b9cb /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #05 pc 0x0000000002c26323 /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #06 pc 0x0000000002c2776b /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #07 pc 0x0000000002c27a77 /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #08 pc 0x0000000002c28b97 /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #09 pc 0x0000000002ca58bf /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #10 pc 0x0000000002ca580b /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #11 pc 0x0000000002c1ba7f /data/app/~~hyEp3R64i82nQvOdrvmxqA==/com.google.android.trichromelibrary_626111933-RKE44VnmEv0FhMTbn5QiHA==/base.apk (offset 0x8dc000)
    #12 pc 0x000000000007d59b /apex/com.android.runtime/lib64/bionic/libc.so
    #13 pc 0x0000000000016f3f /apex/com.android.runtime/lib64/bionic/libc.so

        at org.chromium.base.JniAndroid.handleException(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:11)
     Caused by: java.lang.RuntimeException: An error occurred while executing doInBackground()
        at WV.n4.done(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:41)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:381)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:250)
        at java.util.concurrent.FutureTask.run(FutureTask.java:269)
        at WV.n4.run(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:26)
     Caused by: java.lang.IllegalArgumentException: You must pass a valid uri and observer
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
        at android.content.ContentProviderProxy.query(ContentProviderNative.java:481)
        at android.content.ContentResolver.query(ContentResolver.java:1231)
        at android.content.ContentResolver.query(ContentResolver.java:1157)
        at android.content.ContentResolver.query(ContentResolver.java:1113)
        at org.chromium.base.ContentUriUtils.b(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:18)
        at WV.y8.b(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:23)
        at WV.k4.call(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:9)
        at java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at WV.n4.run(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:26) 
D/ActivityThread: ***** performPauseActivity ActivityRecord{8a4bc7a token=android.os.BinderProxy@ea400a5 {hu.flowtion.app.bpmp/hu.flowtion.app.bpmp.MainActivity}} finished= true paused= false mFinished= false
D/CordovaActivity: Paused the activity.
D/ActivityThread: ***** handleStopActivity r ActivityRecord{8a4bc7a token=android.os.BinderProxy@ea400a5 {hu.flowtion.app.bpmp/hu.flowtion.app.bpmp.MainActivity}} stopped= false paused= true
D/CordovaActivity: Stopped the activity.
D/CordovaActivity: CordovaActivity.onDestroy()
D/CordovaWebViewImpl: >>> loadUrl(about:blank)
W/cr_AwContents: WebView.destroy() called while WebView is still attached to window.
E/chromium: [ERROR:aw_browser_terminator.cc(154)] Renderer process (20072) crash detected (code -1).
E/chromium: [ERROR:directory_reader_posix.cc(43)] opendir /data/user/0/hu.flowtion.app.bpmp/cache/WebView/Crashpad/attachments/a444add5-4ec5-49c4-be16-132fba64b61b: No such file or directory (2)
W/chromium: [WARNING:minidump_to_upload_parameters.cc(67)] duplicate annotation name ptype, discarding value browser

Command or Code

Environment, Platform, Device

Operating System - Linux(5.15.0-101-generic) - linux/x64
NodeJs - 18.17.1

Global packages
  NPM - 9.6.7
  yarn - 1.22.19
  @quasar/cli - undefined
  @quasar/icongenie - Not installed
  cordova - 12.0.0 (cordova-lib@12.0.1)

Important local packages
  quasar - 2.15.0 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
  @quasar/app-vite - 1.7.0 -- Quasar Framework App CLI with Vite
  @quasar/extras - 1.16.9 -- Quasar Framework fonts, icons and animations
  eslint-plugin-quasar - Not installed
  vue - 3.4.21 -- The progressive JavaScript framework for building modern web UI.
  vue-router - 4.1.3
  pinia - 2.0.22 -- Intuitive, type safe and flexible Store for Vue
  vuex - Not installed
  vite - 2.9.16 -- Native-ESM powered web dev build tool
  eslint - 8.17.0 -- An AST-based pattern checker for JavaScript.
  electron - Not installed
  electron-packager - Not installed
  electron-builder - Not installed
  register-service-worker - 1.7.2 -- Script for registering service worker, with hooks
  @capacitor/core - Not installed
  @capacitor/cli - Not installed
  @capacitor/android - Not installed
  @capacitor/ios - Not installed

Quasar App Extensions
  @quasar/quasar-app-extension-qcalendar - 4.0.0-beta.16 -- A Quasar App Extension for 
  @quasar/quasar-ui-qcalendar

Version information

cordova - 12.0.0 (cordova-lib@12.0.1) cordova-plugin-file@latest --> v8.0.1

Checklist

jcesarmobile commented 3 weeks ago

Can you provide a sample app that reproduces the issue?

NetMango commented 3 weeks ago

Sorry, I need more test.

NetMango commented 3 weeks ago

I close this issue, because it seems only some physical devices produce this issue with default file chooser. These devices does not allow to choose file from other storages than media storage, but if you choose with another file tool, e.g: CX file explorer, it works. But same issue happens with a simple Google Chrome or Brave file uploader, so i think it's a brand specific bug.