每当我们启动任何 Activity 时,我们都会获得有关 uid、gid 等的信息,如下所示:
I/ActivityManager( 1986): Start proc app.processName for activity hostingNameStr: pid=3641 uid=10109 gids={3003, 1007}
现在使用 PackageManager,我们可以得到 packageName、uid 和 pid,如下所示:
List<ApplicationInfo> packages = pm
.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo packageInfo : packages) {
Log.d("ME", "packageInfo is :" + packageInfo);
Log.d("ME", "Installed package :" + packageInfo.packageName);
Log.d("ME", "Package process for " + packageInfo.packageName+"-->" + packageInfo.processName);
Log.d("ME", "Package uid for " + packageInfo.packageName+"-->"+packageInfo.uid);
}
但是在这里,我无法获得 gid,所以想知道像这样获得 gid 是否可能。