break;
case PERM_ANDROID_PACKAGE:
if (info->d_uid != 0)
- gid = multiuser_get_ext_gid(info->userid, info->d_uid);
+ gid = multiuser_get_ext_gid(info->d_uid);
else
gid = multiuser_get_uid(info->userid, uid);
break;
case PERM_ANDROID_PACKAGE_CACHE:
if (info->d_uid != 0)
- gid = multiuser_get_cache_gid(info->userid, info->d_uid);
+ gid = multiuser_get_cache_gid(info->d_uid);
else
gid = multiuser_get_uid(info->userid, uid);
break;
return (user_id * AID_USER_OFFSET) + (app_id % AID_USER_OFFSET);
}
-static inline gid_t multiuser_get_cache_gid(userid_t user_id, appid_t app_id)
+static inline gid_t multiuser_get_cache_gid(uid_t uid)
{
- if (app_id >= AID_APP_START && app_id <= AID_APP_END) {
- return multiuser_get_uid(user_id, (app_id - AID_APP_START) + AID_CACHE_GID_START);
- } else {
- return -1;
- }
+ return uid - AID_APP_START + AID_CACHE_GID_START;
}
-static inline gid_t multiuser_get_ext_gid(userid_t user_id, appid_t app_id)
+static inline gid_t multiuser_get_ext_gid(uid_t uid)
{
- if (app_id >= AID_APP_START && app_id <= AID_APP_END) {
- return multiuser_get_uid(user_id, (app_id - AID_APP_START) + AID_EXT_GID_START);
- } else {
- return -1;
- }
+ return uid - AID_APP_START + AID_EXT_GID_START;
}