check android process groups

百般思念 提交于 2019-12-01 04:11:12

问题


Device: android 6.0.1

I wrote an app, use WRITE_EXTERNAL_STORAGE permission in manifest, install this app, and then turn on storage permission for this app from settings.

adb shell
:/ # ps | grep com.amida.test
u0_a199   6722  477   872572 41084 SyS_epoll_ b6c89c74 S com.amida.test
:/ # cat /proc/6722/status
Name:    com.amida.test
State:    S (sleeping)
Tgid:    6722
Ngid:    0
Pid:    6722
PPid:    477
TracerPid:    0
Uid:    10199    10199    10199    10199
Gid:    10199    10199    10199    10199
FDSize:    256
Groups:    9997 50199

Question: I think groups should has 1015. but can not find 1015 there, why?

according to : #define AID_SDCARD_RW 1015

More information:

In Android pre-M, from /etc/permissions/platform.xml, we can find bellow information:

    <permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
    <group gid="sdcard_r" />
    <group gid="sdcard_rw" />
</permission>

#define AID_SDCARD_RW     1015

If app use permission "android.permission.WRITE_EXTERNAL_STORAGE", then the app's process has groups: 1015. (as per android_filesystem_config.h)

but on Android M, firstly, I can not find the permission(WRITE_EXTERNAL_STORAGE) and gid mapping configration. because files in sdcard belongs to sdcard_rw group, then how can the app read and write sdcard? (I think Android use Linux permission system for read&write files, right?)

来源:https://stackoverflow.com/questions/37186761/check-android-process-groups

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!