Skip to content
New issue

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

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

Already on GitHub? # to your account

Maybe need requestLegacyExternalStorage=true in manifest? #1102

Open
ploink opened this issue Jul 27, 2020 · 3 comments
Open

Maybe need requestLegacyExternalStorage=true in manifest? #1102

ploink opened this issue Jul 27, 2020 · 3 comments

Comments

@ploink
Copy link

ploink commented Jul 27, 2020

I am not sure if latest release uses scoped storage for Android 10, but if not than microg needs to Temporarily opt-out of scoped storage in order to access any files in storage.

@mar-v-in
Copy link
Member

I don't think anything in microG uses external storage. Can you point to any issues you see because of this?

@ploink
Copy link
Author

ploink commented Jul 28, 2020

Microg self-check is requesting "Permission to modify or delete the contents of your shared storage".
In the gmscore manifest:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

Maybe I am missing something, but why would you request those permissions if not using them anywhere?

If I understand it correctly, Android 10 introduced Scoped storage. Android 11 enforces it.
If you target SDK29 then asking WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE only give permission to access photo's and media. You need requestLegacyExternalStorage=true to access anything else.

References:
https://developer.android.com/preview/privacy/storage
https://medium.com/android-microsoft/scoped-storage-in-android-10-android-11-28d58d989f3c
https://commonsware.com/blog/2019/06/07/death-external-storage-end-saga.html

@ploink
Copy link
Author

ploink commented Jul 28, 2020

I found out a way to opt out of scoped storage, post install.
The question remains if gmscore actually needs the permissions, but this is how it is accomplished:

When self-check is requesting WRITE_EXTERNAL_STORAGE permission, I get this dialog (on Pocophone F1 running crdroid android 10). Note it only asks permission for photo's and media, not for any other files:
screenshot1

First get the app user id:

$ dumpsys package com.google.android.gms | grep userId=                                          
    userId=10174
    userId=10174

Then allow the appop for this user id:

$ appops set 10174 android:legacy_storage allow 

(somehow it does not work when specifying the app name instead of user id)

Then I tried getting the permission again. Note it asks permission also for "files".
screenshot2

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

No branches or pull requests

2 participants