1

The scenario is that one app is creating some files on its external storage /sdcard/Android/data/myPackageName and during testing automation I need to retrieve some files from that folder using adb.

The compileSdkVersion and targetSdkVersion are set to 31, and also uses:

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

For some reasons, the adb pull command doesn't work (permission denied) on Android 11 but it works on Android 13 (I used real phones not emulators)

These are the mount points:

Android 13 (Pixel 5)

/dev/block/dm-40 on /storage/emulated/0/Android/data type f2fs (rw,lazytime,seclabel,nosuid,nodev,noatime,background_gc=on,discard,no_heap,user_xattr,inline_xattr,acl,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6,reserve_root=32768,resuid=0,resgid=1065,inlinecrypt,alloc_mode=default,checkpoint_merge,fsync_mode=nobarrier,discard_unit=block)

id result:

uid=2000(shell) gid=2000(shell) groups=2000(shell),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),1078(ext_data_rw),1079(ext_obb_rw),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats),3009(readproc),3011(uhid),3012(readtracefs) context=u:r:shell:s0

Android 11 (Pixel 5)

/dev/block/dm-12 on /storage/emulated/0/Android/data type f2fs (rw,lazytime,seclabel,nosuid,nodev,noatime,background_gc=on,discard,no_heap,user_xattr,inline_xattr,acl,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6,reserve_root=32768,resuid=0,resgid=1065,inlinecrypt,alloc_mode=default,fsync_mode=nobarrier)

(the only differences are: discard_unit=block and checkpoint_merge)

id result:

uid=2000(shell) gid=2000(shell) groups=2000(shell),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats),3009(readproc),3011(uhid) context=u:r:shell:s0

I read a lot of posts, Android documentation etc and but I wasn't able to figure out the reason why this is happening. Why it works on 13 and not on 11? Any idea?

5
  • 1
    The reason why I posted the question here is because I feel that the issue is related to file systems, so not exactly related to Android development. Anyhow, I can move to SO no prob
    – Lino
    Commented Feb 26, 2023 at 11:25
  • Then it would be good to generalize the question, so instead of "my app" use "one app". Please name the phone models you have tested.
    – Robert
    Commented Feb 26, 2023 at 11:28
  • can you please update question with output of id? actually never tested A11+ but my assumption was adb can access the whole emulated storage /sdcard
    – alecxs
    Commented Feb 26, 2023 at 12:29
  • answer updated. The only difference is that the output of id on Android 13 has these additional ids 1078(ext_data_rw),1079(ext_obb_rw), 3012(readtracefs)
    – Lino
    Commented Feb 27, 2023 at 8:47
  • 1078(ext_data_rw),1079(ext_obb_rw) are exactly the permissions missing. please double check the storage permissions for the app com.android.shell
    – alecxs
    Commented Feb 27, 2023 at 10:42

0

You must log in to answer this question.

Browse other questions tagged .