Rename SupplementalProcess to SdkSandbox
Ignore-AOSP-First: code is not in AOSP yet Bug: 220320098 Test: presubmit Change-Id: I310feb08a903c2ee9cd544e3b9751c2e02ce5951
This commit is contained in:
parent
b5f2f4f50f
commit
6e124aac7c
4 changed files with 20 additions and 20 deletions
|
|
@ -30,7 +30,7 @@ extern userid_t multiuser_get_user_id(uid_t uid);
|
|||
extern appid_t multiuser_get_app_id(uid_t uid);
|
||||
|
||||
extern uid_t multiuser_get_uid(userid_t user_id, appid_t app_id);
|
||||
extern uid_t multiuser_get_supplemental_uid(userid_t user_id, appid_t app_id);
|
||||
extern uid_t multiuser_get_sdk_sandbox_uid(userid_t user_id, appid_t app_id);
|
||||
|
||||
extern gid_t multiuser_get_cache_gid(userid_t user_id, appid_t app_id);
|
||||
extern gid_t multiuser_get_ext_gid(userid_t user_id, appid_t app_id);
|
||||
|
|
|
|||
|
|
@ -210,9 +210,9 @@
|
|||
*/
|
||||
#define AID_OVERFLOWUID 65534 /* unmapped user in the user namespace */
|
||||
|
||||
/* use the ranges below to determine whether a process is supplemental */
|
||||
#define AID_SUPPLEMENTAL_PROCESS_START 20000 /* start of uids allocated to supplemental process */
|
||||
#define AID_SUPPLEMENTAL_PROCESS_END 29999 /* end of uids allocated to supplemental process */
|
||||
/* use the ranges below to determine whether a process is sdk sandbox */
|
||||
#define AID_SDK_SANDBOX_PROCESS_START 20000 /* start of uids allocated to sdk sandbox processes */
|
||||
#define AID_SDK_SANDBOX_PROCESS_END 29999 /* end of uids allocated to sdk sandbox processes */
|
||||
|
||||
/* use the ranges below to determine whether a process is isolated */
|
||||
#define AID_ISOLATED_START 90000 /* start of uids for fully isolated sandboxed processes */
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ uid_t multiuser_get_uid(userid_t user_id, appid_t app_id) {
|
|||
return (user_id * AID_USER_OFFSET) + (app_id % AID_USER_OFFSET);
|
||||
}
|
||||
|
||||
uid_t multiuser_get_supplemental_uid(userid_t user_id, appid_t app_id) {
|
||||
int supplementalProcessOffset = AID_SUPPLEMENTAL_PROCESS_START - AID_APP_START;
|
||||
uid_t multiuser_get_sdk_sandbox_uid(userid_t user_id, appid_t app_id) {
|
||||
int sdk_sandbox_offset = AID_SDK_SANDBOX_PROCESS_START - AID_APP_START;
|
||||
if (app_id >= AID_APP_START && app_id <= AID_APP_END) {
|
||||
return (user_id * AID_USER_OFFSET) + (app_id % AID_USER_OFFSET) + supplementalProcessOffset;
|
||||
return (user_id * AID_USER_OFFSET) + (app_id % AID_USER_OFFSET) + sdk_sandbox_offset;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,20 +31,20 @@ TEST(MultiuserTest, TestMerge) {
|
|||
EXPECT_EQ(1050000U, multiuser_get_uid(10, 50000));
|
||||
}
|
||||
|
||||
TEST(MultiuserTest, TestSupplementalUid) {
|
||||
EXPECT_EQ(ERR_UID, multiuser_get_supplemental_uid(0, 0));
|
||||
EXPECT_EQ(ERR_UID, multiuser_get_supplemental_uid(0, 1000));
|
||||
EXPECT_EQ(20000U, multiuser_get_supplemental_uid(0, 10000));
|
||||
EXPECT_EQ(25000U, multiuser_get_supplemental_uid(0, 15000));
|
||||
EXPECT_EQ(29999U, multiuser_get_supplemental_uid(0, 19999));
|
||||
EXPECT_EQ(ERR_UID, multiuser_get_supplemental_uid(0, 50000));
|
||||
TEST(MultiuserTest, TestSdkSandboxUid) {
|
||||
EXPECT_EQ(ERR_UID, multiuser_get_sdk_sandbox_uid(0, 0));
|
||||
EXPECT_EQ(ERR_UID, multiuser_get_sdk_sandbox_uid(0, 1000));
|
||||
EXPECT_EQ(20000U, multiuser_get_sdk_sandbox_uid(0, 10000));
|
||||
EXPECT_EQ(25000U, multiuser_get_sdk_sandbox_uid(0, 15000));
|
||||
EXPECT_EQ(29999U, multiuser_get_sdk_sandbox_uid(0, 19999));
|
||||
EXPECT_EQ(ERR_UID, multiuser_get_sdk_sandbox_uid(0, 50000));
|
||||
|
||||
EXPECT_EQ(ERR_UID, multiuser_get_supplemental_uid(10, 0));
|
||||
EXPECT_EQ(ERR_UID, multiuser_get_supplemental_uid(10, 1000));
|
||||
EXPECT_EQ(1020000U, multiuser_get_supplemental_uid(10, 10000));
|
||||
EXPECT_EQ(1025000U, multiuser_get_supplemental_uid(10, 15000));
|
||||
EXPECT_EQ(ERR_UID, multiuser_get_supplemental_uid(10, 20000));
|
||||
EXPECT_EQ(ERR_UID, multiuser_get_supplemental_uid(10, 50000));
|
||||
EXPECT_EQ(ERR_UID, multiuser_get_sdk_sandbox_uid(10, 0));
|
||||
EXPECT_EQ(ERR_UID, multiuser_get_sdk_sandbox_uid(10, 1000));
|
||||
EXPECT_EQ(1020000U, multiuser_get_sdk_sandbox_uid(10, 10000));
|
||||
EXPECT_EQ(1025000U, multiuser_get_sdk_sandbox_uid(10, 15000));
|
||||
EXPECT_EQ(ERR_UID, multiuser_get_sdk_sandbox_uid(10, 20000));
|
||||
EXPECT_EQ(ERR_UID, multiuser_get_sdk_sandbox_uid(10, 50000));
|
||||
}
|
||||
|
||||
TEST(MultiuserTest, TestSplitUser) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue