Until Android 11 I could easily push an xml file to ./storage
or ./sdcard
and then copy it under /data/user_de/0/com.myapp/shared_prefs
to prepare the app for testing.
However, with the new storage updates in Android 11, it seems this is not possible anymore. I even grant READ_EXTERNAL_STORAGE
permissions to the app:
adb shell appops set --uid com.myapp READ_EXTERNAL_STORAGE allow
adb shell appops set --uid com.myapp WRITE_EXTERNAL_STORAGE allow
adb shell appops set --uid com.myapp MANAGE_EXTERNAL_STORAGE allow
but still I get Permission denied
on a dir that is part of the shared storage:
adb shell run-as com.myapp ls -alR /sdcard/Android/media
ls: /sdcard/Android/media: Permission denied
According to this it should work but it doesn't.
Also tried the appops
to allow for legacy storage with no luck:
adb shell cmd appops set com.myapp android:legacy_storage allow
adb shell am force-stop com.myapp
Any ideas on how to copy a file from pc/mac to device in a shared_prefs dir?