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?)