Android M, multiuser environment, how u10_a77 access /storage/emulated/0/DCIM/Camera/xxx.jpg

264 views
Skip to first unread message

Pu Yongming

unread,
Jan 7, 2016, 10:38:41 AM1/7/16
to android-platform
I want to use app create by user10 to access /storage/emulated/0/DCIM/Camera/xxx.jpg. but permission denied. 

I changed the zygote init code, to let app create by user10 mount to /storage/emulated/0.

as for /storage/emulated/0/DCIM/Camera/xxx.jpg, this file can be accessed by all apps create by user0, but cannot be accessed by any app of user10.

I guess this is controlled by sdcard daemon. can someone give some help?


-------------------------------------------------------------------------------------------------------------------------------------------------------
Those below are my experiments:


root@xxx:/storage/emulated/0/DCIM/Camera # ls -l
-rw-rw---- root     sdcard_rw  1878819 2010-01-04 09:11 IMG_20100104_091141.jpg
-rw-rw---- root     sdcard_rw  1816261 2010-01-04 09:49 IMG_20100104_094930.jpg
-rw-rw---- root     sdcard_rw  1785595 2010-01-04 09:50 IMG_20100104_095011.jpg
tat IMG_20100104_091141.jpg                                                   <
  File: `IMG_20100104_091141.jpg'
  Size: 1878819 Blocks: 3672 IO Blocks: 4096 regular file
Device: 15h Inode: 3963 Links: 1
Access: (660/-rw-rw----) Uid: (0/    root) Gid: (1015/    root)
Access: 2010-01-04 09:11:43.830000040
Modify: 2010-01-04 09:11:43.930000040
Change: 2010-01-04 09:11:43.940000040


two apps, u0_a77 can access, but u10_a77 cannot

root@xxx:/storage/emulated/0/DCIM/Camera # ps | grep image        
u0_a77    19422 8808  1015312 39372 SyS_epoll_ 7f9d4aa290 S com.example.imagescan
u10_a77   19827 8808  1210556 52984 SyS_epoll_ 7f9d4aa290 S com.example.imagescan


switch user to u0_a77
root@xxx:/storage/emulated/0/DCIM/Camera # su u0_a77              
u0_a77@xxx:/storage/emulated/0/DCIM/Camera $ id
uid=10077(u0_a77) gid=10077(u0_a77) groups=10077(u0_a77),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) context=u:r:su:s0


switch user to u10_a77
root@xxx:/storage/emulated/0/DCIM/Camera # su u10_a77     
u10_a77@xxx:/storage/emulated/0/DCIM/Camera $ id
uid=1010077(u10_a77) gid=1010077(u10_a77) groups=1010077(u10_a77),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) context=u:r:su:s0


both of those two process have the sdcard_rw permission.


Best,
Reply all
Reply to author
Forward
0 new messages