check android process groups
Asked Answered
N

0

4

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

Nirvana answered 12/5, 2016 at 12:21 Comment(7)
what are you trying to achieve? can give some context to understand???Rouault
I update the question, Thanks!Nirvana
1) Why are you expecting a new Android version to keep that same system? and 2) Why does this matter for application development?Politicize
@m0skit0, Yes, it doesn't matter for application development, I just want to know how android M permission system handle this.Nirvana
@Nirvana whats PID you are trying in command cat /proc/[PID]/status, is it for your app, where did you find pid for your app?Rouault
@shridutt updated question, thanks.Nirvana
yes you are right, hv a look at all-things-android.com/content/…Rouault

© 2022 - 2024 — McMap. All rights reserved.