本篇紀錄 Android UID 定義,android 的 user 是定義在程式裡,並不像 linux 一樣可以用 /etc/passwd 來查看。
Android UID 定義在 AOSP/system/core/include/private/android_filesystem_config.h 標頭檔
https://android.googlesource.com/platform/system/core/+/dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0/include/private/android_filesystem_config.h
這是比較早期 Android 的版本,1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* The 3000 series are intended for use as supplemental group id's only.
* They indicate special Android capabilities that the kernel is aware of. */
struct android_id_info {
const char *name;
unsigned aid;
};
static struct android_id_info android_ids[] = {
{ "root", AID_ROOT, },
{ "system", AID_SYSTEM, },
{ "radio", AID_RADIO, },
{ "bluetooth", AID_BLUETOOTH, },
{ "graphics", AID_GRAPHICS, },
{ "input", AID_INPUT, },
{ "audio", AID_AUDIO, },
{ "camera", AID_CAMERA, },
{ "log", AID_LOG, },
{ "compass", AID_COMPASS, },
{ "mount", AID_MOUNT, },
{ "wifi", AID_WIFI, },
{ "dhcp", AID_DHCP, },
{ "adb", AID_ADB, },
{ "install", AID_INSTALL, },
{ "media", AID_MEDIA, },
{ "shell", AID_SHELL, },
{ "cache", AID_CACHE, },
{ "diag", AID_DIAG, },
{ "net_bt_admin", AID_NET_BT_ADMIN, },
{ "net_bt", AID_NET_BT, },
{ "inet", AID_INET, },
{ "net_raw", AID_NET_RAW, },
{ "misc", AID_MISC, },
{ "nobody", AID_NOBODY, },
};
(sizeof(android_ids) / sizeof(android_ids[0]))
system/core/include/private/android_filesystem_config.h 軟連結指向 system/core/libcutils/include/private/android_filesystem_config.h,
Android 10 system/core/include/private/android_filesystem_config.h
https://android.googlesource.com/platform/system/core/+/android10-release/include/private/android_filesystem_config.h
Android 10 system/core/libcutils/include/private/android_filesystem_config.h
https://android.googlesource.com/platform/system/core/+/android10-release/libcutils/include/private/android_filesystem_config.h
1 |
|
抽丝剥茧:理解Android权限机制
https://www.cnblogs.com/0xJDchen/p/6806573.html
Android:进程UID定义
https://blog.csdn.net/annkie/article/details/8111842