/** * Return the serial number for a user. This is a device-unique * number assigned to that user; if the user is deleted and then a new * user created, the new users will not be given the same serial number. * @param user The user whose serial number is to be retrieved. * @return The serial number of the given user; returns -1 if the * given VUserHandle does not exist. * @see #getUserForSerialNumber(long) */ public long getSerialNumberForUser(VUserHandle user) { return getUserSerialNumber(user.getIdentifier()); }
/** @hide */ public static int getCallingUserId() { return getUserId(VBinder.getCallingUid()); }
/** * Return the user associated with a serial number previously * returned by {@link #getSerialNumberForUser(VUserHandle)}. * @param serialNumber The serial number of the user that is being * retrieved. * @return Return the user associated with the serial number, or null * if there is not one. * @see #getSerialNumberForUser(VUserHandle) */ public VUserHandle getUserForSerialNumber(long serialNumber) { int ident = getUserHandle((int)serialNumber); return ident >= 0 ? new VUserHandle(ident) : null; }
public static VUserHandle getCallingUserHandle() { return new VUserHandle(VUserHandle.getUserId(getCallingUid())); } }
public static int getBaseCallingUid() { return VUserHandle.getAppId(getCallingUid()); }
/** * Checks to see if both uids are referring to the same app id, ignoring the user id part of the * uids. * @param uid1 vuid to compare * @param uid2 other vuid to compare * @return whether the appId is the same for both uids * @hide */ public static final boolean isSameApp(int uid1, int uid2) { return getAppId(uid1) == getAppId(uid2); }
public static boolean accept(int userId) { if (userId == USER_ALL || userId == myUserId()) { return true; } return false; }
/** * Returns true if this VUserHandle refers to the owner user; false otherwise. * @return true if this VUserHandle refers to the owner user; false otherwise. * @hide */ public final boolean isOwner() { return this.equals(OWNER); }
/** * Returns whether the system supports multiple users. * @return true if multiple users can be created, false if it is a single user device. * @hide */ public static boolean supportsMultipleUsers() { return getMaxSupportedUsers() > 1; }
PackagePersistenceLayer(VAppManagerService service) { super(VEnvironment.getPackageListFile()); mService = service; }
VSPersistenceLayer(VirtualStorageService service) { super(VEnvironment.getVSConfigFile()); this.mService = service; }
public DeviceInfoPersistenceLayer(VDeviceManagerService service) { super(VEnvironment.getDeviceInfoFile()); this.mService = service; }
/** @hide */ public static VUserHandle getCallingUserHandle() { int userId = getUserId(VBinder.getCallingUid()); VUserHandle userHandle = userHandles.get(userId); // Intentionally not synchronized to save time if (userHandle == null) { userHandle = new VUserHandle(userId); userHandles.put(userId, userHandle); } return userHandle; }
/** @hide */ public static final boolean isIsolated(int uid) { if (uid > 0) { final int appId = getAppId(uid); return appId >= FIRST_ISOLATED_UID && appId <= LAST_ISOLATED_UID; } else { return false; } }
public ProcessRecord(ApplicationInfo info, String processName, int vuid, int vpid) { this.info = info; this.vuid = vuid; this.vpid = vpid; this.userId = VUserHandle.getUserId(vuid); this.processName = processName; }
/** * Returns the user handle for the user that this application is running for. * @return the user handle of the user making this call. * @hide */ public int getUserHandle() { return VUserHandle.myUserId(); }
/** @hide */ public static boolean isApp(int uid) { if (uid > 0) { final int appId = getAppId(uid); return appId >= Process.FIRST_APPLICATION_UID && appId <= Process.LAST_APPLICATION_UID; } else { return false; } }
public int myUserId() { return VUserHandle.getUserId(myUid); }
public int getBaseVUid() { return VUserHandle.getAppId(vuid); }