Since: API level 25
public class

APMPolicy

extends Object
java.lang.Object
   ↳ com.samsung.android.knox.devicesecurity.APMPolicy

Deprecated in API level 30

Class Overview

This class provides APIs to control 'App Permission Monitor' Policy.
App Permission Monitor: The APM(App Permission Monitor) is to show the notification to user, when critical resource(Camera, Screen capture, Microphone..) is accessed in background.

Since
API level 25
KNOX 3.1

Summary

Constants
int APM_ENFORCE_NONE Denotes constant value of APM_ENFORCE_NONE
int APM_ENFORCE_OFF Denotes constant value of APM_ENFORCE_OFF
int APM_ENFORCE_ON Denotes constant value of APM_ENFORCE_ON
int APM_ENFORCING_ON Denotes constant value of APM_ENFORCING_ON If set this flag, accessing to permission in B/G is denied, not notification only.
int APM_FAILED Denotes constant value of APM_FAILED
int APM_SUCCESS Denotes constant value of APM_SUCCESS
Public Constructors
APMPolicy()
Public Methods
int addAppToAPMWhiteList(List<AppIdentity> packageList)
Deprecated in API level 30
int getAPMStatus()
Deprecated in API level 30
List<AppIdentity> getAPMWhiteList()
Deprecated in API level 30
int removeAppFromAPMWhiteList(List<AppIdentity> packageList)
Deprecated in API level 30
int setAPMStatus(int flag)
Deprecated in API level 30
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int APM_ENFORCE_NONE

Since: API level 25

Denotes constant value of APM_ENFORCE_NONE

Since
API level 25
KNOX 3.1
Constant Value: 0 (0x00000000)

public static final int APM_ENFORCE_OFF

Since: API level 25

Denotes constant value of APM_ENFORCE_OFF

Since
API level 25
KNOX 3.1
Constant Value: 1 (0x00000001)

public static final int APM_ENFORCE_ON

Since: API level 25

Denotes constant value of APM_ENFORCE_ON

Since
API level 25
KNOX 3.1
Constant Value: 2 (0x00000002)

public static final int APM_ENFORCING_ON

Since: API level 26

Denotes constant value of APM_ENFORCING_ON If set this flag, accessing to permission in B/G is denied, not notification only.

Since
API level 26
KNOX 3.2
Constant Value: 3 (0x00000003)

public static final int APM_FAILED

Since: API level 25

Denotes constant value of APM_FAILED

Since
API level 25
KNOX 3.1
Constant Value: -1 (0xffffffff)

public static final int APM_SUCCESS

Since: API level 25

Denotes constant value of APM_SUCCESS

Since
API level 25
KNOX 3.1
Constant Value: 0 (0x00000000)

Public Constructors

public APMPolicy ()

Since: API level 25

Public Methods

public int addAppToAPMWhiteList (List<AppIdentity> packageList)

Since: API level 25

Deprecated in API level 30

API to add an appliaction to APM white list.

Parameters
packageList The list of AppIdentity of application package to be added to the APMWhitelist
Returns
Throws
SecurityException If caller does not have required permissions
Usage
Use this API to add an appliaction to APM white list. If app is included in the whitelist, the notification will not be shown to user when critical resource is accessed in background.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 APMPolicy policy = edm.getAPMPolicy();
 int result = -1;
 List packageList = new ArrayList();
 packageList.add(new AppIdentity(String pkgname, String signature));
 try {
     result = policy.addAppToAPMWhiteList(packageList);
 } catch (SecurityException e) {
     Log.e(TAG, "SecurityException: " + e);
 }
 
For Container:

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance();
 KnoxContainerManager kmcm = ekm.getKnoxContainerManager(mContext, containerID);
 APMPolicy policy = kmcm.getAPMPolicy();
 int result = -1;
 List packageList = new ArrayList();
 packageList.add(new AppIdentity(String pkgname, String signature));
 try {
     result = policy.addAppToAPMWhiteList(packageList);
 } catch (SecurityException e) {
     Log.e(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 25
KNOX 3.1
Multiuser Environment
User Scope

public int getAPMStatus ()

Since: API level 25

Deprecated in API level 30

API to get status of 'App Permission Monitor'

Returns
Throws
SecurityException If caller does not have required permissions
Usage
Use this API to get status of APM

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 APMPolicy policy = edm.getAPMPolicy();
 int result = -1;
 try {
     result = policy.getAPMStatus();
 } catch (SecurityException e) {
     Log.e(TAG, "SecurityException: " + e);
 }
 
For Container:

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance();
 KnoxContainerManager kmcm = ekm.getKnoxContainerManager(mContext, containerID);
 APMPolicy policy = kmcm.getAPMPolicy();
 int result = -1;
 try {
     result = policy.getAPMStatus();
 } catch (SecurityException e) {
     Log.e(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 25
KNOX 3.1
Multiuser Environment
User Scope

public List<AppIdentity> getAPMWhiteList ()

Since: API level 25

Deprecated in API level 30

API to get APM whitelist

Returns
  • Returns The list of AppIdentity if success to get APMWhiteList null if fail to get APMWhiteList
Throws
SecurityException If caller does not have required permissions
Usage
Use this API to get APM whitelist

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 APMPolicy policy = edm.getAPMPolicy();
 List result;
 try {
     result = policy.getAPMWhiteList();
 } catch (SecurityException e) {
     Log.e(TAG, "SecurityException: " + e);
 }
 
For Container:

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance();
 KnoxContainerManager kmcm = ekm.getKnoxContainerManager(mContext, containerID);
 APMPolicy policy = kmcm.getAPMPolicy();
 List result;
 try {
     result = policy.getAPMWhiteList();
 } catch (SecurityException e) {
     Log.e(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 25
KNOX 3.1
Multiuser Environment
User Scope

public int removeAppFromAPMWhiteList (List<AppIdentity> packageList)

Since: API level 25

Deprecated in API level 30

API to remove an application from APM white list

Parameters
packageList The list of AppIdentity of application package to be remove from the APMWhitelist
Returns
  • Returns APM_SUCCESS if success remove app from APMWhitelist, APM_FAILED if failed remove app from APMWhitelist.
Throws
SecurityException If caller does not have required permissions
Usage
Use this API to remove an application from APM white list.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 APMPolicy policy = edm.getAPMPolicy();
 int result = -1;
 List packageList = new ArrayList();
 packageList.add(new AppIdentity(String pkgname, String signature));
 try {
     result = policy.removeAppFromAPMWhiteList(packageList);
 } catch (SecurityException e) {
     Log.e(TAG, "SecurityException: " + e);
 }
 
For Container:

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance();
 KnoxContainerManager kmcm = ekm.getKnoxContainerManager(mContext, containerID);
 APMPolicy policy = kmcm.getAPMPolicy();
 int result = -1;
 List packageList = new ArrayList();
 packageList.add(new AppIdentity(String pkgname, String signature));
 try {
     result = policy.removeAppFromAPMWhiteList(packageList);
 } catch (SecurityException e) {
     Log.e(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 25
KNOX 3.1
Multiuser Environment
User Scope

public int setAPMStatus (int flag)

Since: API level 25

Deprecated in API level 30

API to set status of 'App Permission Monitor'

Returns
Throws
SecurityException If caller does not have required permissions
Usage
Use this API to set APM enforce and users can not off APM

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 APMPolicy policy = edm.getAPMPolicy();
 int result = -1;
 try {
     result = policy.setAPMStatus(APM_ENFORCE_NONE);
 } catch (SecurityException e) {
     Log.e(TAG, "SecurityException: " + e);
 }
 
For Container:

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance();
 KnoxContainerManager kmcm = ekm.getKnoxContainerManager(mContext, containerID);
 APMPolicy policy = kmcm.getAPMPolicy();
 int result = -1;
 try {
     result = policy.setAPMStatus(APM_ENFORCE_NONE);
 } catch (SecurityException e) {
     Log.e(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 25
KNOX 3.1
Multiuser Environment
User Scope
See Also