IT. Expert System.

Android Reference

UserManager


android.os

Class UserManager



  • public class UserManager
    extends Object
    Manages users and user details on a multi-user system.
    • Constructor Detail

      • UserManager

        public UserManager(Context context,
                   IUserManager service)
    • Method Detail

      • supportsMultipleUsers

        public static boolean supportsMultipleUsers()
        Returns whether the system supports multiple users.
        Returns:
        true if multiple users can be created, false if it is a single user device.
      • getUserHandle

        public int getUserHandle()
        Returns the user handle for the user that this application is running for.
        Returns:
        the user handle of the user making this call.
      • getUserName

        public String getUserName()
        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.
        Returns:
        the user name
      • isUserAGoat

        public boolean isUserAGoat()
        Used to determine whether the user making this call is subject to teleportations.
        Returns:
        whether the user making this call is a goat
      • isUserRunning

        public boolean isUserRunning(UserHandle user)
        Return whether the given user is actively running. This means that the user is in the "started" state, not "stopped" -- it is currently allowed to run code through scheduled alarms, receiving broadcasts, etc. A started user may be either the current foreground user or a background user; the result here does not distinguish between the two.
        Parameters:
        user - The user to retrieve the running state for.
      • isUserRunningOrStopping

        public boolean isUserRunningOrStopping(UserHandle user)
        Return whether the given user is actively running or stopping. This is like isUserRunning(UserHandle), but will also return true if the user had been running but is in the process of being stopped (but is not yet fully stopped, and still running some code).
        Parameters:
        user - The user to retrieve the running state for.
      • getUserInfo

        public UserInfo getUserInfo(int userHandle)
        Returns the UserInfo object describing a specific user. Requires android.Manifest.permission#MANAGE_USERS permission.
        Parameters:
        userHandle - the user handle of the user whose information is being requested.
        Returns:
        the UserInfo object for a specific user.
      • getSerialNumberForUser

        public long getSerialNumberForUser(UserHandle user)
        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.
        Parameters:
        user - The user whose serial number is to be retrieved.
        Returns:
        The serial number of the given user; returns -1 if the given UserHandle does not exist.
        See Also:
        getUserForSerialNumber(long)
      • getUserForSerialNumber

        public UserHandle getUserForSerialNumber(long serialNumber)
        Return the user associated with a serial number previously returned by getSerialNumberForUser(UserHandle).
        Parameters:
        serialNumber - The serial number of the user that is being retrieved.
        Returns:
        Return the user associated with the serial number, or null if there is not one.
        See Also:
        getSerialNumberForUser(UserHandle)
      • createUser

        public UserInfo createUser(String name,
                          int flags)
        Creates a user with the specified name and options. Requires android.Manifest.permission#MANAGE_USERS permission.
        Parameters:
        name - the user's name
        flags - flags that identify the type of user and other properties.
        Returns:
        the UserInfo object for the created user, or null if the user could not be created.
        See Also:
        UserInfo
      • getUserCount

        public int getUserCount()
        Return the number of users currently created on the device.
      • getUsers

        public List<UserInfo> getUsers()
        Returns information for all users on this device. Requires android.Manifest.permission#MANAGE_USERS permission.
        Returns:
        the list of users that were created.
      • getUsers

        public List<UserInfo> getUsers(boolean excludeDying)
        Returns information for all users on this device. Requires android.Manifest.permission#MANAGE_USERS permission.
        Parameters:
        excludeDying - specify if the list should exclude users being removed.
        Returns:
        the list of users that were created.
      • removeUser

        public boolean removeUser(int userHandle)
        Removes a user and all associated data. Requires android.Manifest.permission#MANAGE_USERS permission.
        Parameters:
        userHandle - the integer handle of the user, where 0 is the primary user.
      • setUserName

        public void setUserName(int userHandle,
                       String name)
        Updates the user's name. Requires android.Manifest.permission#MANAGE_USERS permission.
        Parameters:
        userHandle - the user's integer handle
        name - the new name for the user
      • setUserIcon

        public void setUserIcon(int userHandle,
                       Bitmap icon)
        Sets the user's photo.
        Parameters:
        userHandle - the user for whom to change the photo.
        icon - the bitmap to set as the photo.
      • getUserIcon

        public Bitmap getUserIcon(int userHandle)
        Returns a file descriptor for the user's photo. PNG data can be read from this file.
        Parameters:
        userHandle - the user whose photo we want to read.
        Returns:
        a Bitmap of the user's photo, or null if there's no photo.
      • setGuestEnabled

        public void setGuestEnabled(boolean enable)
        Enable or disable the use of a guest account. If disabled, the existing guest account will be wiped. Requires android.Manifest.permission#MANAGE_USERS permission.
        Parameters:
        enable - whether to enable a guest account.
      • isGuestEnabled

        public boolean isGuestEnabled()
        Checks if a guest user is enabled for this device. Requires android.Manifest.permission#MANAGE_USERS permission.
        Returns:
        whether a guest user is enabled
      • wipeUser

        public void wipeUser(int userHandle)
        Wipes all the data for a user, but doesn't remove the user. Requires android.Manifest.permission#MANAGE_USERS permission.
        Parameters:
        userHandle -
      • getMaxSupportedUsers

        public static int getMaxSupportedUsers()
        Returns the maximum number of users that can be created on this device. A return value of 1 means that it is a single user device.
        Returns:
        a value greater than or equal to 1
      • getUserSerialNumber

        public int getUserSerialNumber(int userHandle)
        Returns a serial number on this device for a given userHandle. User handles can be recycled when deleting and creating users, but serial numbers are not reused until the device is wiped.
        Parameters:
        userHandle -
        Returns:
        a serial number associated with that user, or -1 if the userHandle is not valid.
      • getUserHandle

        public int getUserHandle(int userSerialNumber)
        Returns a userHandle 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.
        Parameters:
        userSerialNumber -
        Returns:
        the userHandle associated with that user serial number, or -1 if the serial number is not valid.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 11645 / . Delta: 0.02850 с