/** * Returns a file descriptor for the user's photo. PNG data can be read from this file. * @param handle the user whose photo we want to read. * @return a {@link Bitmap} of the user's photo, or null if there's no photo. * @hide */ public Bitmap getUserIcon(int handle) { try { return mService.getUserIcon(handle); } catch (RemoteException re) { Log.w(TAG, "Could not get the user icon ", re); return null; } }
/** * Returns the UserInfo object describing a specific user. * @param handle the user handle of the user whose information is being requested. * @return the UserInfo object for a specific user. * @hide */ public VUserInfo getUserInfo(int handle) { try { return mService.getUserInfo(handle); } catch (RemoteException re) { Log.w(TAG, "Could not get user info", re); return null; } }
/** * Returns a serial number on this device for a given VUserHandle. User handles can be recycled * when deleting and creating users, but serial numbers are not reused until the device is wiped. * @param handle * @return a serial number associated with that user, or -1 if the VUserHandle is not valid. * @hide */ public int getUserSerialNumber(int handle) { try { return mService.getUserSerialNumber(handle); } catch (RemoteException re) { Log.w(TAG, "Could not get serial number for user " + handle); } return -1; }
/** * Returns information for all users on this device. * @return the list of users that were created. * @hide */ public List<VUserInfo> getUsers() { try { return mService.getUsers(false); } catch (RemoteException re) { Log.w(TAG, "Could not get user list", re); return null; } }
/** * Removes a user and all associated data. * @param handle the integer handle of the user, where 0 is the primary user. * @hide */ public boolean removeUser(int handle) { try { return mService.removeUser(handle); } catch (RemoteException re) { Log.w(TAG, "Could not remove user ", re); return false; } }
/** * Checks if a guest user is enabled for this device. * @return whether a guest user is enabled * @hide */ public boolean isGuestEnabled() { try { return mService.isGuestEnabled(); } catch (RemoteException re) { Log.w(TAG, "Could not retrieve guest enabled state"); return false; } }
/** * Sets the user's photo. * @param handle the user for whom to change the photo. * @param icon the bitmap to set as the photo. * @hide */ public void setUserIcon(int handle, Bitmap icon) { try { mService.setUserIcon(handle, icon); } catch (RemoteException re) { Log.w(TAG, "Could not set the user icon ", re); } }
/** * Enable or disable the use of a guest account. If disabled, the existing guest account * will be wiped. * @param enable whether to enable a guest account. * @hide */ public void setGuestEnabled(boolean enable) { try { mService.setGuestEnabled(enable); } catch (RemoteException re) { Log.w(TAG, "Could not change guest account availability to " + enable); } }
/** * Returns a VUserHandle on this device for a given user serial number. User handles can be * recycled when deleting and creating users, but serial numbers are not reused until the device * is wiped. * @param userSerialNumber * @return the VUserHandle associated with that user serial number, or -1 if the serial number * is not valid. * @hide */ public int getUserHandle(int userSerialNumber) { try { return mService.getUserHandle(userSerialNumber); } catch (RemoteException re) { Log.w(TAG, "Could not get VUserHandle for user " + userSerialNumber); } return -1; }
/** * Creates a user with the specified name and options. * * @param name the user's name * @param flags flags that identify the type of user and other properties. * @see VUserInfo * * @return the UserInfo object for the created user, or null if the user could not be created. * @hide */ public VUserInfo createUser(String name, int flags) { try { return mService.createUser(name, flags); } catch (RemoteException re) { Log.w(TAG, "Could not create a user", re); return null; } }
/** * Returns information for all users on this device. * @param excludeDying specify if the list should exclude users being removed. * @return the list of users that were created. * @hide */ public List<VUserInfo> getUsers(boolean excludeDying) { try { return mService.getUsers(excludeDying); } catch (RemoteException re) { Log.w(TAG, "Could not get user list", re); return null; } }
/** * Returns the user name of the user making this call. This call is only * available to applications on the system image; it requires the * MANAGE_USERS permission. * @return the user name */ public String getUserName() { try { return mService.getUserInfo(getUserHandle()).name; } catch (RemoteException re) { Log.w(TAG, "Could not get user name", re); return ""; } }