Class Overview
This class provides APIs for managing multiple user capability on device.
Client administrator will be able to turn on/off such functionality,
create/remove users, allow/prevent additional users from being created or
removed, among other utility methods.
Summary
|
[Expand]
Inherited Methods |
From class
java.lang.Object
|
Object
|
clone()
|
|
boolean
|
equals(Object arg0)
|
|
void
|
finalize()
|
|
final
Class<?>
|
getClass()
|
|
int
|
hashCode()
|
|
final
void
|
notify()
|
|
final
void
|
notifyAll()
|
|
String
|
toString()
|
|
final
void
|
wait(long arg0, int arg1)
|
|
final
void
|
wait(long arg0)
|
|
final
void
|
wait()
|
|
Public Methods
public
boolean
allowMultipleUsers
(boolean allow)
Deprecated
in API level 35
API to enable or disable multiple users from using the device.
Returns
true if success, otherwise false.
Usage
| Administrator can disable multiple user support without any user interaction. User or 3rd
party applications cannot enable multiple user support once disabled.
|
Permission
| The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_MULTI_USER_MGMT" permission which has a
protection level of signature. |
public
boolean
allowUserCreation
(boolean allow)
Deprecated
in API level 35
API to allow or block user creation on device.
Parameters
| allow
| true to enable user creation, false to block it. |
Returns
true if configuration was successfully saved, otherwise false.
Usage
| Administrator can prevent the user and other Administrators from creating more
user accounts onto device. User accounts previously created will remain
intact.
|
Permission
| The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_MULTI_USER_MGMT" permission which has a
protection level of signature. |
public
boolean
allowUserRemoval
(boolean allow)
Deprecated
in API level 35
API to allow or block user removal from device.
Parameters
| allow
| true to enable user removal, false to block it. |
Returns
true if configuration was successfully saved, otherwise false.
Usage
| Administrator can prevent the user and other Administrators from removing existing
user accounts from device.
|
Permission
| The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_MULTI_USER_MGMT" permission which has a
protection level of signature. |
public
int
createUser
(String name)
Deprecated
in API level 35
API to create a guest user on device.
Returns
- user ID if creation was successful, otherwise -1.
Usage
| Administrator can create a guest user with the given name. There can be only one guest
user on device, so this API fails if a guest user already exists.
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
MultiUserManager muMgr = edm.getMultiUserManager();
try {
int userId = muMgr.createUser("Mary");
if(userId > 0) {
// Guest user "Mary" was successfully created.
} else {
// Guest user creation failed.
}
} catch (UnsupportedOperationException ex) {
Log.w(TAG, "UnsupportedOperationException: " + ex.getMessage());
} catch (SecurityException ex2) {
Log.w(TAG, "SecurityException: " + ex2.getMessage());
}
|
Permission
| The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_MULTI_USER_MGMT" permission which has a
protection level of signature. |
public
int[]
getUsers
()
Deprecated
in API level 35
API to retrieve all users created on device.
Returns
- a list of IDs of installed users or
null if the operation fails.
Usage
| Administrator can obtain the list of all users currently installed on device.
|
Permission
| The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_MULTI_USER_MGMT" permission which has a
protection level of signature. |
public
boolean
isUserCreationAllowed
()
Deprecated
in API level 35
Returns whether user creation is allowed or blocked.
Returns
true if user creation is allowed, false if blocked.
Usage
| Administrator can verify if user creation is allowed.
|
public
boolean
isUserRemovalAllowed
()
Deprecated
in API level 35
Returns whether user removal is allowed or blocked.
Returns
true if user removal is allowed, false if blocked.
Usage
| Administrator can verify if user removal is allowed.
|
public
boolean
multipleUsersAllowed
()
Deprecated
in API level 35
API to check whether multiple user support is allowed.
Returns
true if multiple user is allowed, otherwise false.
public
boolean
multipleUsersSupported
()
Deprecated
in API level 35
API to check whether multiple users are supported on the device.
Returns
true if multiple user is supported, otherwise false.
public
boolean
removeUser
(int userId)
Deprecated
in API level 35
API to remove a user from device.
Parameters
| userId
| ID of the user to be removed. |
Returns
true if the user was successfully removed, otherwise false.
Usage
| Administrator can remove an existing user by providing its user ID. If there isn't
any user associated with the given ID or if the provided ID refers to the
owner account, this operation will fail.
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
MultiUserManager muMgr = edm.getMultiUserManager();
//integer "userId" refers to a previously created user.
try {
boolean result = muMgr.removeUser(userId);
if(result) {
// User whose ID is "userId" was successfully removed from device.
} else {
// User removal failed.
}
} catch (UnsupportedOperationException ex) {
Log.w(TAG, "UnsupportedOperationException: " + ex.getMessage());
} catch (SecurityException ex2) {
Log.w(TAG, "SecurityException: " + ex2.getMessage());
}
|
Permission
| The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_MULTI_USER_MGMT" permission which has a
protection level of signature. |