Open david-allison opened 8 months ago
This is fixable if the IO editor is opened after onCreate
Tried to reproduce it but unable to do so right now
API 33 emulator:
f145def4c4ee9b944bcb1df6cd04a636a5cc8bd3
The source of this exception, https://github.com/ankidroid/Anki-Android/blob/09ab288ee1024fedad61a41441e8fa1963ea8237/AnkiDroid/src/main/java/com/ichi2/anki/NoteEditor.kt#L654-L664
ImportUtils.getFileCachedCopy(this, saveImageUri)?.let { path ->
setupImageOcclusionEditor(path)
}
Here
The code needs to be moved some time after onCreate
This is interesting now, it does crash on emulator but work fine on my device My device :
AnkiDroid Version = 2.18alpha1-debug (6a41697449c76aa6bc07f63565b175dcc2ef38cc)
Backend Version = 0.1.34-anki23.12.1 (23.12.1 1a1d4d5419c6b57ef3baf99c9d2d9cf85d36ae0a)
Android Version = 13 (SDK 33)
ProductFlavor = amazon
Manufacturer = OnePlus
Model = EB2101
Hardware = qcom
Webview User Agent = Mozilla/5.0 (Linux; Android 13; EB2101 Build/TP1A.220905.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/121.0.6167.178 Mobile Safari/537.36
ACRA UUID = f235f25a-b2fa-42ef-bd5e-c885be80ba41
Crash Reports Enabled = false
Emualtor:
AnkiDroid Version = 2.18alpha1-debug (6a41697449c76aa6bc07f63565b175dcc2ef38cc)
Backend Version = 0.1.34-anki23.12.1 (23.12.1 1a1d4d5419c6b57ef3baf99c9d2d9cf85d36ae0a)
Android Version = 13 (SDK 33)
ProductFlavor = amazon
Manufacturer = Google
Model = sdk_gphone_x86_64
Hardware = ranchu
Webview User Agent = Mozilla/5.0 (Linux; Android 13; sdk_gphone_x86_64 Build/TE1A.220922.034; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.71 Mobile Safari/537.36
ACRA UUID = 12e3e0b2-1777-495a-a031-e3086a978ff5
Crash Reports Enabled = false
Not as easy as I thought it would be
Hello 👋, this issue has been opened for more than 3 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically
I think we are loosing the permission to access the uri between activities(I think it's a normal behavior). In the scenario above, IntentHandler receives the intent with the imageUri and can access the provider with the uri(adding inside IntentHandler a call to the method querying the provider succeeds) but when it passes it to SingleFragmentActivity with the image occlusion fragment it crashes as it doesn't have the permission anymore. I'm not sure how to fix this.
Copying the image to cache inside IntentHandler
appears to be a feasible solution.
Are there any blockers to this approach besides:
I think that's fine - I don't see either perf hit or inconvenient cache clear as being blockers in any way
Reproduction Steps