Udostępnij za pośrednictwem


UserManager Class

Definition

Manages users and user details on a multi-user system.

[Android.Runtime.Register("android/os/UserManager", DoNotGenerateAcw=true)]
public class UserManager : Java.Lang.Object
[<Android.Runtime.Register("android/os/UserManager", DoNotGenerateAcw=true)>]
type UserManager = class
    inherit Object
Inheritance
UserManager
Attributes

Remarks

Manages users and user details on a multi-user system. There are two major categories of users: fully customizable users with their own login, and profiles that share a workspace with a related user.

Users are different from accounts, which are managed by AccountManager. Each user can have their own set of accounts.

See DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE for more on managed profiles.

Java documentation for android.os.UserManager.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

UserManager(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

AllowParentProfileAppLinking

Allows apps in the parent profile to handle web links from the managed profile.

DisallowAddManagedProfile

Specifies if a user is disallowed from adding managed profiles.

DisallowAddUser

Specifies if a user is disallowed from adding new users.

DisallowAddWifiConfig

Specifies if a user is disallowed from adding a new Wi-Fi configuration.

DisallowAdjustVolume

Specifies if a user is disallowed from adjusting the global volume.

DisallowAirplaneMode

Specifies if airplane mode is disallowed on the device.

DisallowAmbientDisplay

Specifies if ambient display is disallowed for the user.

DisallowAppsControl

Specifies if a user is disallowed from modifying applications in Settings or launchers.

DisallowAutofill

Specifies if a user is not allowed to use Autofill Services.

DisallowBluetooth

Specifies if bluetooth is disallowed on the device.

DisallowBluetoothSharing

Specifies if outgoing bluetooth sharing is disallowed.

DisallowCameraToggle

Specifies whether the camera toggle is available to the user.

DisallowCellular2g

Specifies if a user is not allowed to use 2g networks.

DisallowChangeWifiState

Specifies if a user is disallowed from enabling/disabling Wi-Fi.

DisallowConfigBluetooth

Specifies if a user is disallowed from configuring bluetooth via Settings.

DisallowConfigBrightness

Specifies if a user is disallowed from configuring brightness.

DisallowConfigCellBroadcasts

Specifies if a user is disallowed from configuring cell broadcasts.

DisallowConfigCredentials

Specifies if a user is disallowed from configuring user credentials.

DisallowConfigDateTime

Specifies configuring date, time and timezone is disallowed via Settings.

DisallowConfigDefaultApps

Specifies whether the user is allowed to modify default apps in settings.

DisallowConfigLocale

Specifies if a user is disallowed from changing the device language.

DisallowConfigLocation

Specifies if a user is disallowed from enabling or disabling location providers.

DisallowConfigMobileNetworks

Specifies if a user is disallowed from configuring mobile networks.

DisallowConfigPrivateDns

Specifies whether the user is allowed to modify private DNS settings.

DisallowConfigScreenTimeout

Specifies if a user is disallowed from changing screen off timeout.

DisallowConfigTethering

Specifies if a user is disallowed from using and configuring Tethering and portable hotspots via Settings.

DisallowConfigVpn

Specifies if a user is disallowed from configuring a VPN.

DisallowConfigWifi

Specifies if a user is disallowed from changing Wi-Fi access points via Settings.

DisallowContentCapture

Specifies if the contents of a user's screen is not allowed to be captured for artificial intelligence purposes.

DisallowContentSuggestions

Specifies if the current user is able to receive content suggestions for selections based on the contents of their screen.

DisallowCreateWindows

Specifies that windows besides app windows should not be created.

DisallowCrossProfileCopyPaste

Specifies if the clipboard contents can be exported by pasting the data into other users or profiles.

DisallowDataRoaming

Specifies if a user is not allowed to use cellular data when roaming.

DisallowDebuggingFeatures

Specifies if a user is disallowed from enabling or accessing debugging features.

DisallowFactoryReset

Specifies if a user is disallowed from factory resetting from Settings.

DisallowFun

Specifies if the user is not allowed to have fun.

DisallowGrantAdmin

Specifies if a user is disallowed from being granted admin privileges.

DisallowInstallApps

Specifies if a user is disallowed from installing applications.

DisallowInstallUnknownSources

Specifies if a user is disallowed from enabling the "Unknown Sources" setting, that allows installation of apps from unknown sources.

DisallowInstallUnknownSourcesGlobally

This restriction is a device-wide version of #DISALLOW_INSTALL_UNKNOWN_SOURCES.

DisallowMicrophoneToggle

Specifies whether the microphone toggle is available to the user.

DisallowModifyAccounts

Specifies if a user is disallowed from adding and removing accounts, unless they are android.accounts.AccountManager#addAccountExplicitly programmatically added by Authenticator.

DisallowMountPhysicalMedia

Specifies if a user is disallowed from mounting physical external media.

DisallowNetworkReset

Specifies if a user is disallowed from resetting network settings from Settings.

DisallowOutgoingBeam

Specifies if the user is not allowed to use NFC to beam out data from apps.

DisallowOutgoingCalls

Specifies that the user is not allowed to make outgoing phone calls.

DisallowPrinting

Specifies whether the user is allowed to print.

DisallowRemoveManagedProfile

Specifies if managed profiles of this user can be removed, other than by its profile owner.

DisallowRemoveUser

When set on the admin user this specifies if the user can remove users.

DisallowSafeBoot

Specifies if the user is not allowed to reboot the device into safe boot mode.

DisallowSetUserIcon

Specifies if a user is not allowed to change their icon.

DisallowSetWallpaper

User restriction to disallow setting a wallpaper.

DisallowShareIntoManagedProfile

Specifies whether the user can share file / picture / data from the primary user into the managed profile, either by sending them from the primary side, or by picking up data within an app in the managed profile.

DisallowShareLocation

Specifies if a user is disallowed from turning on location sharing.

DisallowSharingAdminConfiguredWifi

Specifies if users are disallowed from sharing Wi-Fi for admin configured networks.

DisallowSms

Specifies that the user is not allowed to send or receive SMS messages.

DisallowSystemErrorDialogs

Specifies that system error dialogs for crashed or unresponsive apps should not be shown.

DisallowUltraWidebandRadio

This user restriction specifies if Ultra-wideband is disallowed on the device.

DisallowUnifiedPassword

Specifies that the managed profile is not allowed to have unified lock screen challenge with the primary user.

DisallowUninstallApps

Specifies if a user is disallowed from uninstalling applications.

DisallowUnmuteMicrophone

Specifies if a user is disallowed from adjusting microphone volume.

DisallowUsbFileTransfer

Specifies if a user is disallowed from transferring files over USB.

DisallowUserSwitch

Specifies if user switching is blocked on the current user.

DisallowWifiDirect

Specifies if a user is disallowed from using Wi-Fi Direct.

DisallowWifiTethering

Specifies if a user is disallowed from using Wi-Fi tethering.

EnsureVerifyApps

Specifies if a user is disallowed from disabling application verification.

KeyRestrictionsPending

Application restriction key that is used to indicate the pending arrival of real restrictions for the app.

QuietModeDisableOnlyIfCredentialNotRequired
Obsolete.

Flag passed to #requestQuietModeEnabled to request disabling quiet mode only if there is no need to confirm the user credentials.

UserCreationFailedNoMoreUsers
Obsolete.

Error result indicating that no more users can be created on this device.

UserCreationFailedNotPermitted
Obsolete.

Error result indicating that this user is not allowed to add other users on this device.

UserOperationErrorCurrentUser
Obsolete.

Indicates user operation failed because the target user is in the foreground.

UserOperationErrorLowStorage
Obsolete.

Indicates user operation failed because device has low data storage.

UserOperationErrorManagedProfile
Obsolete.

Indicates user operation failed because target user is a managed profile.

UserOperationErrorMaxRunningUsers
Obsolete.

Indicates user operation failed because maximum running user limit has been reached.

UserOperationErrorMaxUsers
Obsolete.

Indicates user operation failed because maximum user limit has been reached.

UserOperationErrorUnknown
Obsolete.

Indicates user operation failed for unknown reason.

UserOperationSuccess
Obsolete.

Indicates user operation is successful.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsAdminUser

Used to check if the context user is an admin user.

IsDemoUser

Checks if the context user is a demo user.

IsHeadlessSystemUserMode

Checks whether the device is running in a headless system user mode.

IsManagedProfile

Checks if the context user is a managed profile.

IsProfile

Checks if the calling context user is running in a profile.

IsSystemUser

Used to check if the context user is the system user.

IsUserAGoat

Used to determine whether the user making this call is subject to teleportations.

IsUserForeground

Checks if the context user is running in the foreground.

IsUserUnlocked

Return whether the context user is running in an "unlocked" state.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

UserCount

Return the number of users currently created on the device.

UserName

Returns the user name of the context user.

UserProfiles

Returns a list of UserHandles for profiles associated with the context user, including the user itself.

UserRestrictions
Obsolete.

Returns the user-wide restrictions imposed on the context user. -or- This will no longer work.

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CreateUserCreationIntent(String, String, String, PersistableBundle)

Returns an intent to create a user for the provided name and account name.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetApplicationRestrictions(String)

Returns a Bundle containing any saved application restrictions for the context user, for the given package name.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetSerialNumberForUser(UserHandle)

Return the serial number for a user.

GetUserCreationTime(UserHandle)

Returns creation time of the given user.

GetUserForSerialNumber(Int64)

Return the user associated with a serial number previously returned by #getSerialNumberForUser(UserHandle).

GetUserRestrictions(UserHandle)

Returns the user-wide restrictions imposed on the user specified by userHandle.

HasUserRestriction(String)

Returns whether the context user has been disallowed from performing certain actions or setting certain settings.

InvokeIsUserUnlocked(UserHandle)

Return whether the given user is running in an "unlocked" state.

IsQuietModeEnabled(UserHandle)

Returns whether the given profile is in quiet mode or not.

IsUserRunning(UserHandle)

Return whether the given user is actively running.

IsUserRunningOrStopping(UserHandle)

Return whether the given user is actively running <em>or</em> stopping.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
RequestQuietModeEnabled(Boolean, UserHandle, Int32)

Perform the same operation as #requestQuietModeEnabled(boolean, UserHandle), but with a flag to tweak the behavior of the request.

RequestQuietModeEnabled(Boolean, UserHandle)

Enables or disables quiet mode for a managed profile.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetRestrictionsChallenge(String)

Sets a new challenge PIN for restrictions.

SetUserRestriction(String, Boolean)
Obsolete.

Sets the value of a specific restriction on the context user.

SetUserRestrictions(Bundle, UserHandle)
Obsolete.

This will no longer work.

SupportsMultipleUsers()

Returns whether this device supports multiple users with their own login and customizable space.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to