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

3rd party program cannot be used to select dictionary #13

Open
user202729 opened this issue Mar 25, 2021 · 4 comments
Open

3rd party program cannot be used to select dictionary #13

user202729 opened this issue Mar 25, 2021 · 4 comments

Comments

@user202729
Copy link
Contributor

Currently I'm using CX file explorer.

I'm not entirely sure if this is problem on Android side or the application, but it is definitely not trivial for a typical user to see where the issue is.

Reproduce:

  • Add dictionary.
  • Choose CX file explorer.
  • Add any valid JSON file.

Result: Dotterel crashes.

Possibly-relevant logcat section:

AndroidRuntime: FATAL EXCEPTION: main
AndroidRuntime: Process: nimble.dotterel, PID: 6406
AndroidRuntime: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=196610, result=-1, data=Intent { dat=content://com.cxinventor.file.explorer.fileprovider/root/storage/emulated/0/dotterel_dict/user_combined.json flg=0x3 }} to activity {nimble.dotterel/nimble.dotterel.DotterelSettings}: java.lang.SecurityException: No persistable permission grants found for UID 10150 and Uri 0 @ content://com.cxinventor.file.explorer.fileprovider/root/storage/emulated/0/dotterel_dict/user_combined.json
AndroidRuntime: 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4547)
AndroidRuntime: 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:4590)
AndroidRuntime: 	at android.app.ActivityThread.-wrap20(ActivityThread.java)
AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1772)
AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:110)
AndroidRuntime: 	at android.os.Looper.loop(Looper.java:232)
AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6806)
AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1103)
AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
AndroidRuntime: Caused by: java.lang.SecurityException: No persistable permission grants found for UID 10150 and Uri 0 @ content://com.cxinventor.file.explorer.fileprovider/root/storage/emulated/0/dotterel_dict/user_combined.json
AndroidRuntime: 	at android.os.Parcel.readException(Parcel.java:1708)
AndroidRuntime: 	at android.os.Parcel.readException(Parcel.java:1661)
AndroidRuntime: 	at android.app.ActivityManagerProxy.takePersistableUriPermission(ActivityManagerNative.java:5155)
AndroidRuntime: 	at android.content.ContentResolver.takePersistableUriPermission(ContentResolver.java:2006)
AndroidRuntime: 	at nimble.dotterel.DictionariesPreferenceFragment.onActivityResult(DictionariesPreference.kt:305)
AndroidRuntime: 	at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:170)
AndroidRuntime: 	at android.app.Activity.dispatchActivityResult(Activity.java:7234)
AndroidRuntime: 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4543)
AndroidRuntime: 	... 9 more
@nimble0
Copy link
Owner

nimble0 commented Mar 25, 2021

Dotterel needs persistent access to dictionaries so your dictionaries don't stop working when you reopen it. Not catching the exception is a bug but the main problem appears to be with CX file explorer not granting persistent access.

@user202729
Copy link
Contributor Author

user202729 commented Mar 26, 2021

As a workaround, I guess it is still possible to save the file (and inform the user that if they update the dictionary file they have to explicitly reselect it)?

I didn't try any other third party application, but this could be an issue with the android operating system too.

(also should there be any way for the program to require persistent access?)

==

The problem persists when I allow "storage" permission for dotterel (although I observe that dotterel works well even without that permission)

@nimble0
Copy link
Owner

nimble0 commented Mar 26, 2021

I'd be reluctant to do that since then there'd need to be a way to manage those saved files. Dotterel does require persistent, it's what's causing the exception.

I just tried CX file explorer 1.5.2 and didn't get any error. Could you provide your version of Android and CX file explorer?

@user202729
Copy link
Contributor Author

Upgraded to 1.5.2 and the problem disappeared.

My previous version was 1.4.2.

Given that it's likely a bug in the other program, perhaps dotterel should just catch the exception and show a warning message.

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

No branches or pull requests

2 participants