Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on selecting flash image on android #202

Closed
iczero opened this issue May 22, 2020 · 7 comments
Closed

Crash on selecting flash image on android #202

iczero opened this issue May 22, 2020 · 7 comments

Comments

@iczero
Copy link

iczero commented May 22, 2020

When selecting the flash image in the kits menu on android, the app crashes. This seems to only happen with version 1.5, which introduced the storage access framework file picker.

The error message (from logcat):

05-21 18:27:56.341 15994 16028 F rg.firebird.em: java_vm_ext.cc:570] JNI DETECTED ERROR IN APPLICATION: JNI GetMethodID called with pending exception java.lang.SecurityException: No persistable permission grants found for UID 10348 and Uri content://com.android.externalstorage.documents/document/primary:firebird/cx cas/flash.img [user 0]

A brief search found (https://stackoverflow.com/questions/25414352/how-to-persist-permission-in-android-api-19-kitkat/29588566#29588566). The flag Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION seems to be missing when the file chooser is launched.

@Vogtinator
Copy link
Member

I don't get that here on Android 6.0, which version do you run?

Unfortunately this is done in Qt code, so it would have to be fixed there.

Why oh why is the Android API so unbelievably awful...

@iczero
Copy link
Author

iczero commented May 22, 2020

I am on Android 10, though it might have something to do with vendor customizations.

I dug through the logs a bit more and it seems to be coming from ContentResolver.takePersistableUriPermission:

05-22 00:30:14.301 28013 28051 F rg.firebird.em: runtime.cc:638] No pending exception expected: java.lang.SecurityException: No persistable permission grants found for UID 1010350 and Uri content://com.android.externalstorage.documents/document/primary:firebird/cx cas/flash.img [user 0]
05-22 00:30:14.301 28013 28051 F rg.firebird.em: runtime.cc:638]   at java.lang.Exception android.os.Parcel.createException(int, java.lang.String) (Parcel.java:2071)
05-22 00:30:14.301 28013 28051 F rg.firebird.em: runtime.cc:638]   at void android.os.Parcel.readException(int, java.lang.String) (Parcel.java:2039)
05-22 00:30:14.301 28013 28051 F rg.firebird.em: runtime.cc:638]   at void android.os.Parcel.readException() (Parcel.java:1987)
05-22 00:30:14.301 28013 28051 F rg.firebird.em: runtime.cc:638]   at void android.app.IUriGrantsManager$Stub$Proxy.takePersistableUriPermission(android.net.Uri, int, java.lang.String, int) (IUriGrantsManager.java:280)
05-22 00:30:14.301 28013 28051 F rg.firebird.em: runtime.cc:638]   at void android.content.ContentResolver.takePersistableUriPermission(android.net.Uri, int) (ContentResolver.java:2474)
05-22 00:30:14.301 28013 28051 F rg.firebird.em: runtime.cc:638]   at void org.qtproject.qt5.android.QtNative.startQtApplication() (QtNative.java:-2)

I think it could possibly be fixed by manually invoking the file chooser dialog using JNI, but I'm not exactly familiar with any of that. I tried finding where the file picker is actually launched but it seems that is done with the FileDialog qml component.

Hope this helps.

@JeffLeeBYD
Copy link

I solved this problem by deleting all spaces of folder name where you store flash. "Nspire EMU" does not work, but "nspire" works. Hope this will help you.

@Vogtinator
Copy link
Member

Vogtinator commented Mar 27, 2022

Can you try whether https://owncloud.ritter-vogt.de/index.php/s/DO5h08BKxGvl5du (b1d2b49) works for you?

@iczero
Copy link
Author

iczero commented Mar 27, 2022

@Vogtinator it works! Tried with the same path as last time, but I'm now on android 11.

@Vogtinator
Copy link
Member

Great!

Vogtinator added a commit to Vogtinator/firebird-fork that referenced this issue Mar 28, 2022
Apparently Android checks for equivalence of the passed URLs at a string level
when looking up URI grants. It has to be fully encoded to match properly.

Fixes nspire-emus#202
Vogtinator added a commit that referenced this issue Mar 28, 2022
Apparently Android checks for equivalence of the passed URLs at a string level
when looking up URI grants. It has to be fully encoded to match properly.

Fixes #202
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants