Since: API level 6
public class

DeviceAccountPolicy

extends Object
java.lang.Object
   ↳ com.samsung.android.knox.accounts.DeviceAccountPolicy

Class Overview

This class provides APIs to control device accounts such as those supported by the native e-mail application and Google accounts.

Since
API level 6
MDM 4.0

Summary

Public Methods
boolean addAccountsToAdditionBlackList(String type, List<String> accounts)
API to add a list of accounts of a specific account type to the account addition blacklist.
boolean addAccountsToAdditionWhiteList(String type, List<String> accounts, boolean defaultBlackList)
API to add a list of accounts of a specific account type to the account addition whitelist and default blacklist all other accounts of that specific account type
boolean addAccountsToAdditionWhiteList(String type, List<String> accounts)
API to add a list of accounts of a specific account type to the account addition whitelist.
boolean addAccountsToRemovalBlackList(String type, List<String> accounts)
API to add a list of accounts of a specific account type to the account removal blacklist.
boolean addAccountsToRemovalWhiteList(String type, List<String> accounts)
API to add a list of accounts of a specific account type to the account removal whitelist.
boolean addAccountsToRemovalWhiteList(String type, List<String> accounts, boolean defaultBlackList)
API to add a list of accounts of a specific account type to the account removal whitelist and default blacklist all other accounts of that specific account type
boolean clearAccountsFromAdditionBlackList(String type)
API to remove all accounts of a specific account type that are blacklisted for addition.
boolean clearAccountsFromAdditionList(String type)
API to remove all accounts of a specific account type from the account addition whitelist and blacklist.
boolean clearAccountsFromAdditionWhiteList(String type)
API to remove all accounts of a specific account type from the account addition whitelist.
boolean clearAccountsFromRemovalBlackList(String type)
API to remove all accounts of a specific account type that are blacklisted for removal.
boolean clearAccountsFromRemovalList(String type)
API to remove all accounts of a specific account type from the account removal whitelist and blacklist.
boolean clearAccountsFromRemovalWhiteList(String type)
API to remove all accounts of a specific account type from the account removal whitelist.
List<AccountControlInfo> getAccountsFromAdditionBlackLists(String type)
API to retrieve the list of accounts of a specific account type that are blacklisted for addition by all administrators.
List<AccountControlInfo> getAccountsFromAdditionWhiteLists(String type)
API to retrieve the addition whitelist across all administrators for accounts of a specific account type.
List<AccountControlInfo> getAccountsFromRemovalBlackLists(String type)
API to retrieve the list of accounts of a specific account type that are blacklisted for removal by all administrators.
List<AccountControlInfo> getAccountsFromRemovalWhiteLists(String type)
API to retrieve the removal whitelist across all administrators for accounts of a specific account type.
List<String> getSupportedAccountTypes()
API to get a list of supported account types.
boolean removeAccountsByType(String type)
API to remove all device accounts of a particular type.
boolean removeAccountsFromAdditionBlackList(String type, List<String> accounts)
API to remove a list of accounts from the account addition blacklist of a specific account type.
boolean removeAccountsFromAdditionWhiteList(String type, List<String> accounts)
API to remove a list of accounts of a specific account type from the account addition whitelist.
boolean removeAccountsFromRemovalBlackList(String type, List<String> accounts)
API to remove a list of accounts from the account removal blacklist of a specific account type.
boolean removeAccountsFromRemovalWhiteList(String type, List<String> accounts)
API to remove a list of accounts of a specific account type from the account removal whitelist.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public boolean addAccountsToAdditionBlackList (String type, List<String> accounts)

Since: API level 6

API to add a list of accounts of a specific account type to the account addition blacklist.

Parameters
type account type
accounts accounts list to be added to blacklist
Returns
  • true if the accounts is successfully added to blacklist else false on failure
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to blacklist accounts based on the type of account. A user cannot add blacklisted accounts. An account is considered blacklisted if any administrator has the account in the blacklist. The whitelist is the exception to the blacklist. If the account name matches the pattern in both the blacklist and whitelist, the whitelist takes priority.

During specification, Wildcard characters (for example, ".*@test.com") are allowed. Wildcard character is a character that may be substituted for any of a defined subset of all possible characters. The asterisk character ("*") substitutes for any zero or more characters, and the question mark ("?") substitutes for any one character or less but not more than the amount of question marks.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     List<String> blackList = new ArrayList<String>();

     blackList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = edm.getDeviceAccountPolicy().addAccountsToAdditionBlackList("com.google", blackList);

     if (success) {

         Log.d(TAG, "Addition to blacklist is a success");

     } else {

         Log.d(TAG, "Addition to blacklist is a failure");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 try {

     List<String> blackList = new ArrayList<String>();

     blackList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = kcm.getDeviceAccountPolicy().addAccountsToAdditionBlackList("com.google", blackList);

     if (success) {

         Log.d(TAG, "Addition to blacklist is a success");

     } else {

         Log.d(TAG, "Addition to blacklist is a failure");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean addAccountsToAdditionWhiteList (String type, List<String> accounts, boolean defaultBlackList)

Since: API level 11

API to add a list of accounts of a specific account type to the account addition whitelist and default blacklist all other accounts of that specific account type

Parameters
type account type
accounts accounts list to be added to whiteList
defaultBlackList true to default blacklist all other accounts of a specific account type, false to keep the blacklist unchanged
Returns
  • true if the account is successfully added in to whiteList and "*@*.*" into the black list if needed, else false on failure of either
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to whitelist accounts based on the account type. A user can remove whitelisted accounts. Also, An administrator can use this API to blacklist all other accounts based on the account type by allowing "*@*.*" in the blaclist. account is considered whitelisted if any administrator has the account in their whitelist and no other administrators have the account in their blacklist. The whitelist is the exception to the blacklist. If the account name matches the pattern in both the blacklist and whitelist, the whitelist takes priority.

Wildcard characters (for example, ".*@test.com") are allowed. Wildcard character is a character that may be substituted for any of a defined subset of all possible characters. The asterisk character ("*") substitutes for any zero or more characters, and the question mark ("?") substitutes for any one character or less but not more than the amount of question marks.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     boolean defaultBlackList = true;

     List<String> whiteList = new ArrayList<String>();

     whiteList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = edm.getDeviceAccountPolicy().addAccountsToAdditionWhiteList("com.google", whiteList, defaultBlackList);

     if (success) {

         Log.d(TAG, "Addition to whiteList and blackList has succeeded");

     } else {

         Log.d(TAG, "Addition to whiteList or blacklist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 try {

     boolean defaultBlackList = true;

     List<String> whiteList = new ArrayList<String>();

     whiteList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = kcm.getDeviceAccountPolicy().addAccountsToAdditionWhiteList("com.google", whiteList, defaultBlackList);

     if (success) {

         Log.d(TAG, "Addition to whiteList and blackList has succeeded");

     } else {

         Log.d(TAG, "Addition to whiteList or blackList has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
User Scope

public boolean addAccountsToAdditionWhiteList (String type, List<String> accounts)

Since: API level 6

API to add a list of accounts of a specific account type to the account addition whitelist.

Parameters
type account type
accounts accounts list to be added to whiteList
Returns
  • true if the account is successfully added in to whiteList else false on failure
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to whitelist accounts based on the account type. A user can add whitelisted accounts. An account is considered whitelisted if any administrator has the account in their whitelist and no other administrators have the account in their blacklist. The whitelist is the exception to the blacklist. If the account name matches the pattern in both the blacklist and whitelist, the whitelist takes priority. .

Wildcard characters (for example, ".*@test.com") are allowed. Wildcard character is a character that may be substituted for any of a defined subset of all possible characters. The asterisk character ("*") substitutes for any zero or more characters, and the question mark ("?") substitutes for any one character or less but not more than the amount of question marks.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     List<String> whiteList = new ArrayList<String>();

     whiteList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = edm.getDeviceAccountPolicy().addAccountsToAdditionWhiteList("com.google", whiteList);

     if (success) {

         Log.d(TAG, "Addition to whiteList has succeeded");

     } else {

         Log.d(TAG, "Addition to whiteList has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 try {

     List<String> whiteList = new ArrayList<String>();

     whiteList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = kcm.getDeviceAccountPolicy().addAccountsToAdditionWhiteList("com.google", whiteList);

     if (success) {

         Log.d(TAG, "Addition to whiteList has succeeded");

     } else {

         Log.d(TAG, "Addition to whiteList has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean addAccountsToRemovalBlackList (String type, List<String> accounts)

Since: API level 6

API to add a list of accounts of a specific account type to the account removal blacklist.

Parameters
type account type
accounts accounts list to be added to blacklist
Returns
  • true if the accounts is successfully added to blacklist else false on failure
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to blacklist accounts based on the type of account. A user cannot remove blacklisted accounts. A blacklisted account still appears in the accounts list in e-mail and settings applications but is disabled, and the user cannot select it. An account is considered blacklisted if any administrator has the account in the blacklist. The whitelist is the exception to the blacklist. If the account name matches the pattern in both the blacklist and whitelist, the whitelist takes priority.

During specification, Wildcard characters (for example, ".*@test.com") are allowed. Wildcard character is a character that may be substituted for any of a defined subset of all possible characters. The asterisk character ("*") substitutes for any zero or more characters, and the question mark ("?") substitutes for any one character or less but not more than the amount of question marks.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     List<String> blackList = new ArrayList<String>();

     blackList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = edm.getDeviceAccountPolicy().addAccountsToRemovalBlackList("com.google", blackList);

     if (success) {

         Log.d(TAG, "Addition to blacklist is a success");

     } else {

         Log.d(TAG, "Addition to blacklist is a failure");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 try {

     List<String> blackList = new ArrayList<String>();

     blackList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = kcm.getDeviceAccountPolicy().addAccountsToRemovalBlackList("com.google", blackList);

     if (success) {

         Log.d(TAG, "Addition to blacklist is a success");

     } else {

         Log.d(TAG, "Addition to blacklist is a failure");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean addAccountsToRemovalWhiteList (String type, List<String> accounts)

Since: API level 6

API to add a list of accounts of a specific account type to the account removal whitelist.

Parameters
type account type
accounts accounts list to be added to whiteList
Returns
  • true if the account is successfully added in to whiteList else false on failure
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to whitelist accounts based on the account type. A user can remove whitelisted accounts. An account is considered whitelisted if any administrator has the account in their whitelist and no other administrators have the account in their blacklist. The whitelist is the exception to the blacklist. If the account name matches the pattern in both the blacklist and whitelist, the whitelist takes priority. .

Wildcard characters (for example, ".*@test.com") are allowed. Wildcard character is a character that may be substituted for any of a defined subset of all possible characters. The asterisk character ("*") substitutes for any zero or more characters, and the question mark ("?") substitutes for any one character or less but not more than the amount of question marks.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     List<String> whiteList = new ArrayList<String>();

     whiteList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = edm.getDeviceAccountPolicy().addAccountsToRemovalWhiteList("com.google", whiteList);

     if (success) {

         Log.d(TAG, "Addition to whiteList has succeeded");

     } else {

         Log.d(TAG, "Addition to whiteList has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 try {

     List<String> whiteList = new ArrayList<String>();

     whiteList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = kcm.getDeviceAccountPolicy().addAccountsToRemovalWhiteList("com.google", whiteList);

     if (success) {

         Log.d(TAG, "Addition to whiteList has succeeded");

     } else {

         Log.d(TAG, "Addition to whiteList has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean addAccountsToRemovalWhiteList (String type, List<String> accounts, boolean defaultBlackList)

Since: API level 11

API to add a list of accounts of a specific account type to the account removal whitelist and default blacklist all other accounts of that specific account type

Parameters
type account type
accounts accounts list to be added to whiteList
defaultBlackList true to default blacklist all other accounts of a specific account type, false to keep the blacklist unchanged
Returns
  • true if the account is successfully added in to whiteList and "*@*.*" into the black list if needed, else false on failure of either
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to whitelist accounts based on the account type. A user can remove whitelisted accounts. Also, An administrator can use this API to blacklist all other accounts based on the account type by allowing "*@*.*" in the blaclist. account is considered whitelisted if any administrator has the account in their whitelist and no other administrators have the account in their blacklist. The whitelist is the exception to the blacklist. If the account name matches the pattern in both the blacklist and whitelist, the whitelist takes priority.

Wildcard characters (for example, ".*@test.com") are allowed. Wildcard character is a character that may be substituted for any of a defined subset of all possible characters. The asterisk character ("*") substitutes for any zero or more characters, and the question mark ("?") substitutes for any one character or less but not more than the amount of question marks.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     boolean defaultBlackList = true;

     List<String> whiteList = new ArrayList<String>();

     whiteList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = edm.getDeviceAccountPolicy().addAccountsToRemovalWhiteList("com.google", whiteList, defaultBlackList);

     if (success) {

         Log.d(TAG, "Addition to whiteList and blackList has succeeded");

     } else {

         Log.d(TAG, "Addition to whiteList or blacklist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 try {

     boolean defaultBlackList = true;

     List<String> whiteList = new ArrayList<String>();

     whiteList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = kcm.getDeviceAccountPolicy().addAccountsToRemovalWhiteList("com.google", whiteList, defaultBlackList);

     if (success) {

         Log.d(TAG, "Addition to whiteList and blackList has succeeded");

     } else {

         Log.d(TAG, "Addition to whiteList or blackList has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
User Scope

public boolean clearAccountsFromAdditionBlackList (String type)

Since: API level 6

API to remove all accounts of a specific account type that are blacklisted for addition.

Parameters
type account type
Returns
  • true if all accounts are successfully removed from blacklist else false on failure
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to remove all accounts of a specific account type from the account addition blacklist.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     boolean success = edm.getDeviceAccountPolicy().clearAccountsFromAdditionBlackList();

     if (success) {

         Log.d(TAG, "Clearing blacklist has succeeded");

     } else {

         Log.d(TAG, "Clearing blacklist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 try {

     boolean success = kcm.getDeviceAccountPolicy().clearAccountsFromAdditionBlackList();

     if (success) {

         Log.d(TAG, "Clearing blacklist has succeeded");

     } else {

         Log.d(TAG, "Clearing blacklist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean clearAccountsFromAdditionList (String type)

Since: API level 11

API to remove all accounts of a specific account type from the account addition whitelist and blacklist.

Parameters
type account type
Returns
  • true if all accounts are successfully removed from whitelist and blacklist else false on failure
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to remove all accounts of a specific account type from the account addition whitelist and blacklist.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     boolean success = edm.getDeviceAccountPolicy().clearAccountsFromAdditionWhiteList();

     if (success) {

         Log.d(TAG, "Clearing whitelist and blacklist has succeeded");

     } else {

         Log.d(TAG, "Clearing whitelist or whitelist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
User Scope

public boolean clearAccountsFromAdditionWhiteList (String type)

Since: API level 6

API to remove all accounts of a specific account type from the account addition whitelist.

Parameters
type account type
Returns
  • true if all accounts are successfully removed from whitelist else false on failure
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to remove all accounts of a specific account type from the account addition whitelist.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     boolean success = edm.getDeviceAccountPolicy().clearAccountsFromAdditionWhiteList();

     if (success) {

         Log.d(TAG, "Clearing whitelist has succeeded");

     } else {

         Log.d(TAG, "Clearing whitelist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 try {

     boolean success = kcm.getDeviceAccountPolicy().clearAccountsFromAdditionWhiteList();

     if (success) {

         Log.d(TAG, "Clearing whitelist has succeeded");

     } else {

         Log.d(TAG, "Clearing whitelist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean clearAccountsFromRemovalBlackList (String type)

Since: API level 6

API to remove all accounts of a specific account type that are blacklisted for removal.

Parameters
type account type
Returns
  • true if all accounts are successfully removed from blacklist else false on failure
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to remove all accounts of a specific account type from the account removal blacklist.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     boolean success = edm.getDeviceAccountPolicy().clearAccountsFromRemovalBlackList();

     if (success) {

         Log.d(TAG, "Clearing blacklist has succeeded");

     } else {

         Log.d(TAG, "Clearing blacklist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 try {

     boolean success = kcm.getDeviceAccountPolicy().clearAccountsFromRemovalBlackList();

     if (success) {

         Log.d(TAG, "Clearing blacklist has succeeded");

     } else {

         Log.d(TAG, "Clearing blacklist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean clearAccountsFromRemovalList (String type)

Since: API level 11

API to remove all accounts of a specific account type from the account removal whitelist and blacklist.

Parameters
type account type
Returns
  • true if all accounts are successfully removed from whitelist and blacklist else false on failure
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to remove all accounts of a specific account type from the account removal whitelist and blacklist.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     boolean success = edm.getDeviceAccountPolicy().clearAccountsFromRemovalWhiteList();

     if (success) {

         Log.d(TAG, "Clearing whitelist and blacklist has succeeded");

     } else {

         Log.d(TAG, "Clearing whitelist or whitelist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 11
MDM 5.0
Multiuser Environment
User Scope

public boolean clearAccountsFromRemovalWhiteList (String type)

Since: API level 6

API to remove all accounts of a specific account type from the account removal whitelist.

Parameters
type account type
Returns
  • true if all accounts are successfully removed from whitelist else false on failure
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to remove all accounts of a specific account type from the account removal whitelist.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     boolean success = edm.getDeviceAccountPolicy().clearAccountsFromRemovalWhiteList();

     if (success) {

         Log.d(TAG, "Clearing whitelist has succeeded");

     } else {

         Log.d(TAG, "Clearing whitelist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 try {

     boolean success = kcm.getDeviceAccountPolicy().clearAccountsFromRemovalWhiteList();

     if (success) {

         Log.d(TAG, "Clearing whitelist has succeeded");

     } else {

         Log.d(TAG, "Clearing whitelist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public List<AccountControlInfo> getAccountsFromAdditionBlackLists (String type)

Since: API level 6

API to retrieve the list of accounts of a specific account type that are blacklisted for addition by all administrators.

Parameters
type account type
Returns
  • AccountControlInfo list of the blacklisted accounts along with the controlling administrator package name if it succeeds else return null
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to retrieve the list of accounts that are blacklisted by all administrators.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 List<AccountControlInfo> whiteList = edm.getDeviceAccountPolicy()

         .getAccountsFromAdditionBlackLists();



 for (List controlInfo : whiteList) {

     Log.d(TAG, "Administrator: " + controlInfo.adminPackageName + " Entries : " + controlInfo.entries);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 List<AccountControlInfo> whiteList = kcm.getDeviceAccountPolicy()

         .getAccountsFromAdditionBlackLists();



 for (List controlInfo : whiteList) {

     Log.d(TAG, "Administrator: " + controlInfo.adminPackageName + " Entries : " + controlInfo.entries);

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public List<AccountControlInfo> getAccountsFromAdditionWhiteLists (String type)

Since: API level 6

API to retrieve the addition whitelist across all administrators for accounts of a specific account type.

Parameters
type account type
Returns
  • AccountControlInfo list of the whitelisted accounts along with the controlling administrator package name if it succeeds else return null
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to retrieve the list of accounts that are whitelisted by all administrators.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 List<AccountControlInfo> whiteList = edm.getDeviceAccountPolicy()

         .getAccountsFromAdditionWhiteLists();



 for (List controlInfo : whiteList) {

     Log.d(TAG, "Administrator: " + controlInfo.adminPackageName + " Entries : " + controlInfo.entries);

 }



 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 List<AccountControlInfo> whiteList = kcm.getDeviceAccountPolicy()

         .getAccountsFromAdditionWhiteLists();



 for (List controlInfo : whiteList) {

     Log.d(TAG, "Administrator: " + controlInfo.adminPackageName + " Entries : " + controlInfo.entries);

 }



 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public List<AccountControlInfo> getAccountsFromRemovalBlackLists (String type)

Since: API level 6

API to retrieve the list of accounts of a specific account type that are blacklisted for removal by all administrators.

Parameters
type account type
Returns
  • AccountControlInfo list of the blacklisted accounts along with the controlling administrator package name if it succeeds else return null
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to retrieve the list of accounts that are blacklisted by all administrators.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 List<AccountControlInfo> whiteList = edm.getDeviceAccountPolicy()

         .getAccountsFromRemovalBlackLists();



 for (List controlInfo : whiteList) {

     Log.d(TAG, "Administrator: " + controlInfo.adminPackageName + " Entries : " + controlInfo.entries);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 List<AccountControlInfo> whiteList = kcm.getDeviceAccountPolicy()

         .getAccountsFromRemovalBlackLists();



 for (List controlInfo : whiteList) {

     Log.d(TAG, "Administrator: " + controlInfo.adminPackageName + " Entries : " + controlInfo.entries);

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public List<AccountControlInfo> getAccountsFromRemovalWhiteLists (String type)

Since: API level 6

API to retrieve the removal whitelist across all administrators for accounts of a specific account type.

Parameters
type account type
Returns
  • AccountControlInfo list of the whitelisted accounts along with the controlling administrator package name if it succeeds else return null
Throws
SecurityException If caller does not have required permissions
Usage

An administrator can use this API to retrieve the list of accounts that are whitelisted by all administrators.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 List<AccountControlInfo> whiteList = edm.getDeviceAccountPolicy()

         .getAccountsFromRemovalWhiteLists();



 for (List controlInfo : whiteList) {

     Log.d(TAG, "Administrator: " + controlInfo.adminPackageName + " Entries : " + controlInfo.entries);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 List<AccountControlInfo> whiteList = kcm.getDeviceAccountPolicy()

         .getAccountsFromRemovalWhiteLists();



 for (List controlInfo : whiteList) {

     Log.d(TAG, "Administrator: " + controlInfo.adminPackageName + " Entries : " + controlInfo.entries);

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public List<String> getSupportedAccountTypes ()

Since: API level 6

API to get a list of supported account types.

Returns
  • string list of supported account types if it succeeds, else null.
Usage
Use this API to get a list of account types that are currently supported for account addition and removal prevention.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean removeAccountsByType (String type)

Since: API level 6

API to remove all device accounts of a particular type.

Parameters
type The type of account to remove
Returns
  • true if accounts are removed, else false.
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to remove any accounts based on type. For example, to remove all Gmail accounts on the device, pass type as "com.google".


  EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

  DeviceAccountPolicy deviceAccPolicy = edm.getDeviceAccountPolicy();

  try {

      boolean result = deviceAccPolicy.removeAccountsByType(

                                                     "com.google.com");

      if(true == result)

      {

          //account deleted successfully

      }

  }catch(SecurityException e) {

      Log.w(TAG,"SecurityException: "+e);

  }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

  EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

  KnoxContainerManager kmcm = ekm.getKnoxContainerManager(containerID);

  DeviceAccountPolicy deviceAccountPolicy = kmcm.getDeviceAccountPolicy();

  try {

      boolean result = deviceAccountPolicy.removeAccountsByType("com.google.com");

      if(true == result)

      {

          //account deleted successfully

      }

  }catch(SecurityException e) {

      Log.w(TAG,"SecurityException: "+e);

  }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 2
MDM 2.0
Multiuser Environment
User Scope

public boolean removeAccountsFromAdditionBlackList (String type, List<String> accounts)

Since: API level 6

API to remove a list of accounts from the account addition blacklist of a specific account type.

Parameters
type account type
accounts accounts list to be removed from blacklist
Returns
  • true if the account is successfully removed from blacklist else false on failure
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to remove accounts from the account blacklist. The user can remove an account with a matching account name that has been removed from the blacklist.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     List<String> blackList = new ArrayList<String>();

     blackList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = edm.getDeviceAccountPolicy().removeAccountsFromAdditionBlackList("com.google", blackList);

     if (success) {

         Log.d(TAG, "Addition from blacklist is a success");

     } else {

         Log.d(TAG, "Addition from blacklist is a failure");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 try {

     List<String> blackList = new ArrayList<String>();

     blackList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = kcm.getDeviceAccountPolicy().removeAccountsFromAdditionBlackList("com.google", blackList);

     if (success) {

         Log.d(TAG, "Addition from blacklist is a success");

     } else {

         Log.d(TAG, "Addition from blacklist is a failure");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean removeAccountsFromAdditionWhiteList (String type, List<String> accounts)

Since: API level 6

API to remove a list of accounts of a specific account type from the account addition whitelist.

Parameters
type account type
accounts accounts list to be removed from whiteList
Returns
  • true if the account is successfully removed from whitelist else false on failure
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to remove accounts from the whitelist. The user cannot add accounts that are removed from the whitelist and match an account name in the blacklist.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     List<String> whiteList = new ArrayList<String>();

     whiteList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = edm.getDeviceAccountPolicy().removeAccountsFromAdditionWhiteList("com.google", whiteList);

     if (success) {

         Log.d(TAG, "Addition from whitelist has succeeded");

     } else {

         Log.d(TAG, "Addition from whitelist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 try {

     List<String> whiteList = new ArrayList<String>();

     whiteList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = kcm.getDeviceAccountPolicy().removeAccountsFromAdditionWhiteList("com.google", whiteList);

     if (success) {

         Log.d(TAG, "Addition from whitelist has succeeded");

     } else {

         Log.d(TAG, "Addition from whitelist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean removeAccountsFromRemovalBlackList (String type, List<String> accounts)

Since: API level 6

API to remove a list of accounts from the account removal blacklist of a specific account type.

Parameters
type account type
accounts accounts list to be removed from blacklist
Returns
  • true if the account is successfully removed from blacklist else false on failure
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to remove accounts from the account blacklist. The user can remove an account with a matching account name that has been removed from the blacklist.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     List<String> blackList = new ArrayList<String>();

     blackList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = edm.getDeviceAccountPolicy().removeAccountsFromRemovalBlackList("com.google", blackList);

     if (success) {

         Log.d(TAG, "Removal from blacklist is a success");

     } else {

         Log.d(TAG, "Removal from blacklist is a failure");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 try {

     List<String> blackList = new ArrayList<String>();

     blackList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = kcm.getDeviceAccountPolicy().removeAccountsFromRemovalBlackList("com.google", blackList);

     if (success) {

         Log.d(TAG, "Removal from blacklist is a success");

     } else {

         Log.d(TAG, "Removal from blacklist is a failure");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean removeAccountsFromRemovalWhiteList (String type, List<String> accounts)

Since: API level 6

API to remove a list of accounts of a specific account type from the account removal whitelist.

Parameters
type account type
accounts accounts list to be removed from whiteList
Returns
  • true if the account is successfully removed from whitelist else false on failure
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to remove accounts from the whitelist. The user cannot remov accounts that are removed from the whitelist and match an account name in the blacklist.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 try {

     List<String> whiteList = new ArrayList<String>();

     whiteList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = edm.getDeviceAccountPolicy().removeAccountsFromRemovalWhiteList("com.google", whiteList);

     if (success) {

         Log.d(TAG, "Removal from whitelist has succeeded");

     } else {

         Log.d(TAG, "Removal from whitelist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
For Container:

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 try {

     List<String> whiteList = new ArrayList<String>();

     whiteList.add(".*@gmail.com");

     // Supported account types can be retrieved from getSupoprtedAccountTypes()

     // For example supported Google account type will be "com.google"

     boolean success = kcm.getDeviceAccountPolicy().removeAccountsFromRemovalWhiteList("com.google", whiteList);

     if (success) {

         Log.d(TAG, "Removal from whitelist has succeeded");

     } else {

         Log.d(TAG, "Removal from whitelist has failed");

     }

 } catch (SecurityException e) {

     Log.w(TAG, "SecurityException: " + e);

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature.
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope