Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

[BUG] Storage permission is asked in Android 13 and can't be granted

Open WhtUsrWrks opened this issue 1 year ago • 81 comments

Hi.. I hadn't used ankidroid so my Samsung Galaxy A21 removed its permissions, and I wanted to use it again today but when I open it it says "Grant storage permission", but I've granted all permissions and it still asks. I've tried u installing and reinstalling and it says the same thing. I don't seem to have a dedicated Storage Permission option in permission manager but it has permission for files and that's on... I don't know what else to change? Thank you

WhtUsrWrks avatar Sep 11 '23 08:09 WhtUsrWrks

Hello! 👋 Thanks for logging this issue. Please remember we are all volunteers here, so some patience may be required before we can get to the issue. Also remember that the fastest way to get resolution on an issue is to propose a change directly, https://github.com/ankidroid/Anki-Android/wiki/Contributing

welcome[bot] avatar Sep 11 '23 08:09 welcome[bot]

@WhtUsrWrks can you share screenshot of the permission screen and the popup where it is asking permissions? Or better maybe attach a screen recording.

thedroiddiv avatar Sep 13 '23 13:09 thedroiddiv

I have the same issue on my Xiaomi Redmi Note 10 Pro. I have attached a screen recording and written some device info below.

  • Model: M2101K6G
  • MIUI version: MIUI Global 14.0.2.0(TKFMIXM)
  • Android version: 13 TKQ1.221013.002
  • Android security update: 2023-04-01

https://github.com/ankidroid/Anki-Android/assets/144927977/302d0ccc-5776-42a2-b909-928f7536cc6b

ByteCodeRoad avatar Sep 13 '23 14:09 ByteCodeRoad

Thanks for sharing!

thedroiddiv avatar Sep 13 '23 15:09 thedroiddiv

I'm pinning this so we don't forget it

BrayanDSO avatar Sep 17 '23 16:09 BrayanDSO

Hello. I have the same problem with One Plus Nord 2, Android 13.

Ezkielnet avatar Sep 17 '23 16:09 Ezkielnet

Nobody mentioned which version of the app are they running. Is the app installed from the app store, downloaded from here etc?

lukstbit avatar Sep 19 '23 14:09 lukstbit

Version 2.6.15 from the app store. Android 13, pixel 6a

feleck avatar Sep 19 '23 15:09 feleck

Mine says 2.16.5 and I downloaded it from Google play

On Tue 19 Sept 2023, 18:32 Marcin, < @.***> wrote:

Version 2.6.15 from the app store. Android 13, pixel 6a —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID:

DuckDuckGo removed one tracker. More https://duckduckgo.com/-QgeEDl9Nx4fz_303RIzy756cy2ouygPrWxiLMNkhxFGBgwb_pdVCbY4m2csn7ZeKEr8Bm8wsxsHbNluvb6j7RdIKr8m7SGzdwrhvYgEFEOrAIdml-udKXwcLWnCDq5vfb3SXENBz0nar-bVUiX6n55PDstjW-awIpy2Y-pGjPqFDbJ7_lt4X2efyItk7Nv5iUQhQ5t0T87uJK-Vkl2F_Niv3PSE6A_icV3FFwljMlh_vh-Uh23xXSAi10EeDdeEm0qxrQ4bahr7LGlCplV85C6b8f6EXlRnE9jffUxSaAeXkiMU9vBxigkwkMGwl_MrfHns3kySeWKxuZ6O9xqCLrQJPvTvTcMe_nbTF31b3tSnozPX-7-vW6JvV5Y8n2e75Ea_2yQPR8fHN0AOO0RA8hkEZ3_wqp54ONKd9y6Kji8Q7hUygCw20BmgbU7WP-VuaXmunlfZIBawi1Pw Report Spam https://duckduckgo.com/-QgeEDl9Nx4fz_303RIzy756cy2ouygPrWxiLMNkhxFGBgwb_pdVCbY4m2csn7ZeKEr8Bm8wsxsHbNluvb6j7RdIKr8m7SGzdwrhvYgEFEOrAIdml-udKXwcLWnCDq5vfb3SXENBz0nar-bVUiX6n55PDstjW-awIpy2Y-pGjPqFDbJ7_lt4X2efyItk7Nv5iUQhQ5t0T87uJK-Vkl2F_Niv3PSE6A_icV3FFwljMlh_vh-Uh23xXSAi10EeDdeEm0qxrQ4bahr7LGlCplV85C6b8f6EXlRnE9jffUxSaAeXkiMU9vBxigkwkMGwl_MrfHns3kySeWKxuZ6O9xqCLrQJPvTvTcMe_nbTF31b3tSnozPX-7-vW6JvV5Y8n2e75Ea_2yQPR8fHN0AOO0RA8hkEZ3_wqp54ONKd9y6Kji8Q7hUygCw20BmgbU7WP-VuaXmunlfZIBawi1Pw

Version 2.6.15 from the app store. Android 13, pixel 6a

— Reply to this email directly, view it on GitHub https://github.com/ankidroid/Anki-Android/issues/14423#issuecomment-1725899183, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZXMA7QBWT6EH6ZMQBUZS2TX3G3HJANCNFSM6AAAAAA4S7GPFM . You are receiving this because you were mentioned.Message ID: @.***>

WhtUsrWrks avatar Sep 19 '23 16:09 WhtUsrWrks

I could enter, unintentionally. I wanted to show you the gray error message at the bottom and when I hit Delete app data, the app opened.

https://github.com/ankidroid/Anki-Android/assets/23616105/bd24a159-dedd-4376-a636-93bcefe7d7cc

Ezkielnet avatar Sep 19 '23 17:09 Ezkielnet

Could this be the problem? This would at least explain why the system does not ask for memory access in the first place.

Three new permission is introduced with Android 13: READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, and READ_MEDIA_AUDIO. If you were using READ_EXTERNAL_STORAGE for accessing files, then you need to use one of these new permissions. If a user with Android 13 has previously granted this permission, then all is good. If not, then the permission request for READ_EXTERNAL_STORAGE will be ignored.

Source: https://medium.com/@muhammadbilal4074/storage-permission-in-android-13-89372e543864#:~:text=Three%20new%20permission%20is%20introduced,permission%2C%20then%20all%20is%20good.

Sc3l3t0n avatar Sep 20 '23 14:09 Sc3l3t0n

I experience the same running version 2.16.5 on Pixel 7 Pro with Android 13 (September 2023 update)

queue-tip avatar Sep 21 '23 18:09 queue-tip

Launching AnkiDroid this logcat is produced.

09-23 21:21:47.398 18391 19178 I Role    : com.ichi2.anki not qualified for android.app.role.HOME due to missing RequiredComponent{mIntentFilterData=IntentFilterData{mAction='android.intent.action.MAIN', mCategories='[android.intent.category.HOME]', mDataScheme='null', mDataType='null'}, mMinTargetSdkVersion=1, mPermission='null', mQueryFlags=0, mMetaData=[]}
09-23 21:21:47.401 18391 19178 I Role    : com.ichi2.anki not qualified for android.app.role.DIALER due to missing RequiredComponent{mIntentFilterData=IntentFilterData{mAction='android.intent.action.DIAL', mCategories='[]', mDataScheme='null', mDataType='null'}, mMinTargetSdkVersion=1, mPermission='null', mQueryFlags=0, mMetaData=[]}
09-23 21:21:47.404 18391 18642 I Role    : com.ichi2.anki not qualified for android.app.role.SMS due to missing RequiredComponent{mIntentFilterData=IntentFilterData{mAction='android.provider.Telephony.SMS_DELIVER', mCategories='[]', mDataScheme='null', mDataType='null'}, mMinTargetSdkVersion=1, mPermission='android.permission.BROADCAST_SMS', mQueryFlags=0, mMetaData=[]}
09-23 21:21:47.406 20072 20072 E AppInfoDashboard: Package: com.ichi2.anki not found for user: 10
09-23 21:21:47.406 20072 20072 E AppInfoDashboard: Package: com.ichi2.anki not found for user: 11
09-23 21:21:47.407  1494  5310 E AppOps  : Bad call made by uid 1000. Package "com.ichi2.anki" does not belong to uid -1.
09-23 21:21:47.407  1494  5310 E AppOps  : noteOperation
09-23 21:21:47.407  1494  5310 E AppOps  : java.lang.SecurityException: Specified package "com.ichi2.anki" under uid -1 but it is not
09-23 21:21:47.407  1494  5310 E AppOps  : 	at com.android.server.appop.AppOpsService.verifyAndGetBypass(AppOpsService.java:4703)
09-23 21:21:47.407  1494  5310 E AppOps  : 	at com.android.server.appop.AppOpsService.noteOperationUnchecked(AppOpsService.java:3466)
09-23 21:21:47.407  1494  5310 E AppOps  : 	at com.android.server.appop.AppOpsService.noteOperationImpl(AppOpsService.java:3454)
09-23 21:21:47.407  1494  5310 E AppOps  : 	at com.android.server.appop.AppOpsService.-$$Nest$mnoteOperationImpl(Unknown Source:0)
09-23 21:21:47.407  1494  5310 E AppOps  : 	at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher.lambda$noteOperation$4(AppOpsService.java:7662)
09-23 21:21:47.407  1494  5310 E AppOps  : 	at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher.$r8$lambda$oOwUoG55BBmJ6yiwhp3OAq3tQ30(Unknown Source:0)
09-23 21:21:47.407  1494  5310 E AppOps  : 	at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher$$ExternalSyntheticLambda3.apply(Unknown Source:32)
09-23 21:21:47.407  1494  5310 E AppOps  : 	at com.android.server.policy.AppOpsPolicy.noteOperation(AppOpsPolicy.java:225)
09-23 21:21:47.407  1494  5310 E AppOps  : 	at com.android.server.appop.AppOpsService$CheckOpsDelegateDispatcher.noteOperation(AppOpsService.java:7660)
09-23 21:21:47.407  1494  5310 E AppOps  : 	at com.android.server.appop.AppOpsService.noteOperation(AppOpsService.java:3438)
09-23 21:21:47.407  1494  5310 E AppOps  : 	at com.android.internal.app.IAppOpsService$Stub.onTransact(IAppOpsService.java:479)
09-23 21:21:47.407  1494  5310 E AppOps  : 	at android.os.Binder.execTransactInternal(Binder.java:1309)
09-23 21:21:47.407  1494  5310 E AppOps  : 	at android.os.Binder.execTransact(Binder.java:1268)

hmenke avatar Sep 23 '23 19:09 hmenke

Maybe related? https://www.reddit.com/r/androiddev/comments/146cd1y/comment/jnt3jmn/

dae avatar Sep 24 '23 01:09 dae

Dear AnkiDroid Team/Users,

I experienced the same with AnkiDroid 2.16.5 on Android 13 smartphone. Nevertheless, I was able to workaround that blocking issue by doing the following:

  1. Cleaned up AnkiDroid app stored data (perhaps/probably optional)
  2. Uninstalled AnkiDroid 2.16.5 app
  3. Via Neo Store (F-Droid-like app), I managed to install older AnkiDroid 2.16.3 => OK (I was then able to: launch AnkiDroid, connect, sync and use app without any blocker)
  4. Still via Neo Store, I managed to upgrade to AnkiDroid 2.16.4 => OK (I was able to: launch AnkiDroid, then was asked to: "grant access to all files (special access)), then, once access granted, I was able to: connect, sync and use app without any blocker)
  5. Still via Neo Store, I upgraded to AnkiDroid 2.16.5 => OK (I was able to: launch AnkiDroid, connect, sync and use app without any blocker)

If I compare this situation to my initial launch of AnkiDroid (blocked by current issue), here is the main difference: First time, I was launching AnkiDroid (2.16.5) after a long period of inactivity (and multiple intermediate AnkiDroid updates), so last time I launched it, it was a version v2.x<2.16 (at that time, grant special access to all files was not yet required).

So from my own experience, and only based on it, here are my conclusions on that issue:

  • It appears that 2.16.4 (upgrading a fresh 2.16.3 install) behaves correctly and request user to grant AnkiDroid app to "access all files".
  • It appears that 2.16.5 (upgrading from old running 2.1x install) behaves unexpectedly and drives use to app properties/permissions, while it should drive it to: "special access" > "all files access" > AnkiDroid ( v ).

Hope this help.

Best regards,

gragramel avatar Sep 25 '23 19:09 gragramel

I experienced this as well.

Device: Pixel 7 Pro Android version: 13 Android security update: 2023-08-05 Ankidroid version: 2.16.5

I exhibited the same symptoms as ByteCodeRoad's video, additionally looking under "...->All Permissions" and not finding Storage there either. Deleting app data as per Ezkielnet and then logging back in and syncing solved it.

gregyski avatar Sep 28 '23 18:09 gregyski

when I hit Delete app data, the app opened.

Deleting app data as per Ezkielnet and then logging back in and syncing solved it.

@Ezkielnet @gregyski Thank you for sharing information about the unexpected discovery.

Just to be sure, after tapping the "Get started" in the initial screen, were you actually able to see the deck list screen? (And it was without being asked for any sort of permissions?)

(I don't have an Android 13 device so I can't try this way myself.)

snowtimeglass avatar Sep 30 '23 11:09 snowtimeglass

when I hit Delete app data, the app opened.

Deleting app data as per Ezkielnet and then logging back in and syncing solved it.

@Ezkielnet @gregyski Thank you for sharing information about the unexpected discovery.

Just to be sure, after tapping the "Get started" in the initial screen, were you actually able to see the deck list screen? (And it was without being asked for any sort of permissions?)

(I don't have an Android 13 device so I can't try this way myself.)

Yes, I can use the application perfectly. I can't be sure if it asks for permissions afterwards because I enabled them manually.

Ezkielnet avatar Sep 30 '23 11:09 Ezkielnet

Yes, I can use the application perfectly.

How nice. Thank you.

I can't be sure if it asks for permissions afterwards because I enabled them manually.

Which permission items did you manually enable? (Are those in the ByteCodeRoad's video?)

snowtimeglass avatar Sep 30 '23 12:09 snowtimeglass

Which permission items did you manually enable? (Are those in the ByteCodeRoad's video?)

When I had the error I enabled all of them, but I just saw that none of them are active.

WhatsApp Image 2023-09-30 at 14 53 51_4574cf73

Ezkielnet avatar Sep 30 '23 12:09 Ezkielnet

when I hit Delete app data, the app opened.

Deleting app data as per Ezkielnet and then logging back in and syncing solved it.

@Ezkielnet @gregyski Thank you for sharing information about the unexpected discovery.

Just to be sure, after tapping the "Get started" in the initial screen, were you actually able to see the deck list screen? (And it was without being asked for any sort of permissions?)

(I don't have an Android 13 device so I can't try this way myself.)

If I'm understanding the question properly, before the "fix" I'd launch the app and be taken directly to permissions without ever seeing any of the Ankidroid interface. After the "fix", for all practical purposes I was starting with a fresh installation so I had to log in and sync to get my decks back from Ankiweb. I did not, at that time, get asked for any further permissions. Note that I had, when trying to fix the issue originally, manually enabled the "Read and write to the Ankidroid database" permission so that was set as well, so while that had no impact on the original problem, I don't know if it impacted the "fix". Hope that helps.

Edit: I just checked my permissions and things again match Ezkielnet. I currently show "No permissions allowed" despite my not actually adjusting them since the "fix". The app is working normally.

gregyski avatar Sep 30 '23 12:09 gregyski

So, after the "Delete app data", the prior manual permissions may be no impact or annulled, and the app works properly without requiring permissions... I think I have a better understanding of the situation. Thank you for the feedbacks.

snowtimeglass avatar Sep 30 '23 13:09 snowtimeglass

Hi, @snowtimeglass will you be working on this? I would like to contribute.

srishti-R avatar Oct 06 '23 05:10 srishti-R

No, I'm not. I welcome your contribution.

snowtimeglass avatar Oct 06 '23 10:10 snowtimeglass

@srishti-R

If no one is assigned on a issue you can just comment that you are working on it and start working : )

Originally posted by @criticalAY in https://github.com/ankidroid/Anki-Android/issues/14502#issuecomment-1746660974

snowtimeglass avatar Oct 06 '23 10:10 snowtimeglass

Strange that I am not facing any such issue in master branch.

srishti-R avatar Oct 06 '23 12:10 srishti-R

I believe it's possible that it might be related to the Android feature that disables permissions when an app hasn't been used in a while. I know I'd been slacking and am pretty sure that feature activated on my Ankidroid install. And it might even related to some recent Android permission changes making it rather an edge case if it's a combination of the two.

I have no evidence of that, but I know when I was researching the problem to try to fix it I encountered mentions of both situations being potential causes, so I thought I'd mention it.

gregyski avatar Oct 06 '23 14:10 gregyski

Please fix or help find a workaround that doesn't involve deleting data. My AnkiWeb account expired so I'm concerned with loosing all the data if I clear it

7merlin avatar Oct 07 '23 20:10 7merlin

Please fix or help find a workaround that doesn't involve deleting data. My AnkiWeb account expired so I'm concerned with loosing all the data if I clear it

Either of these should work

  • export your collection, including scheduling information and media, reinstall after deleting data, and then import the collection
  • create an ankiweb account, sync to it, reinstall after deleting data, and sync again

queue-tip avatar Oct 07 '23 23:10 queue-tip

I believe it's possible that it might be related to the Android feature that disables permissions when an app hasn't been used in a while. I know I'd been slacking and am pretty sure that feature activated on my Ankidroid install. And it might even related to some recent Android permission changes making it rather an edge case if it's a combination of the two.

I have no evidence of that, but I know when I was researching the problem to try to fix it I encountered mentions of both situations being potential causes, so I thought I'd mention it.

This would line up with what I am seeing. This happened to me just recently. I haven't used it in months. I am in the same boat as 7merlin where I do not have the decks on ankiweb anymore because of the months that I have spent away from the app. I would also like to be able to get this fixed without wiping my data.

queue-tip: I don't know how I am supposed to do your steps since I am getting this error and cannot get into the app.

risshuu avatar Oct 09 '23 23:10 risshuu