Since: API level 36
public class

ProfilePolicy

extends Object
java.lang.Object
   ↳ com.samsung.android.knox.profile.ProfilePolicy

Class Overview

This class provides APIs to control profiles activated on device.

Summary

Constants
String RESTRICTION_PROPERTY_CALENDAR_SHARE_TO_OWNER This constant is a property for setRestriction and getRestriction.
String RESTRICTION_PROPERTY_MOVE_FILES_TO_OWNER This constant is a property for setRestriction and getRestriction.
String RESTRICTION_PROPERTY_MOVE_FILES_TO_PROFILE This constant is a property for setRestriction and getRestriction.
String RESTRICTION_PROPERTY_SCREENCAPTURE_SAVE_TO_OWNER This constant is a property for setRestriction and getRestriction.
Public Methods
boolean getRestriction(String property)
API to get restriction policy for profile.
boolean setRestriction(String property, boolean value)
API to set restriction policy for profile.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String RESTRICTION_PROPERTY_CALENDAR_SHARE_TO_OWNER

Since: API level 36

This constant is a property for setRestriction and getRestriction. For the Calendar application it is set to true, will be allowed to share data out of the work profile.

Note : Effects on only Samsung Calendar application.

Since
API level 35
KNOX 3.8
Constant Value: "restriction_property_calendar_share_to_owner"

public static final String RESTRICTION_PROPERTY_MOVE_FILES_TO_OWNER

Since: API level 37

This constant is a property for setRestriction and getRestriction. Allow to move file(s) from work profile to owner area if this is set true. Otherwise it will not allowed to move file(s) from work profile to owner area.

Since
API level 37
KNOX 3.10
Constant Value: "restriction_property_move_files_to_owner"

public static final String RESTRICTION_PROPERTY_MOVE_FILES_TO_PROFILE

Since: API level 37

This constant is a property for setRestriction and getRestriction. Allow to move file(s) from owner to work profile area if this is set true. Otherwise it will not allowed to move file(s) from owner to work profile area.

Since
API level 37
KNOX 3.10
Constant Value: "restriction_property_move_files_to_profile"

public static final String RESTRICTION_PROPERTY_SCREENCAPTURE_SAVE_TO_OWNER

Since: API level 36

This constant is a property for setRestriction and getRestriction. Screencapture image will be saved in owner area if this is set true. Otherwise it will be saved inside work profile.

Since
API level 36
KNOX 3.9
Constant Value: "restriction_property_screencapture_save_to_owner"

Public Methods

public boolean getRestriction (String property)

Since: API level 36

API to get restriction policy for profile.
Note : This API can be called by not only profile owner or device owner but other normal applications.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 
 try {
     boolean result = edm.getProfilePolicy().getRestriction({PROERTY});
 } catch (SecurityException e) {
     Log.e(TAG, "SecurityException: " + e);
 }
 

Parameters
property The corresponding value for the property.
Returns
  • true if the operation of given property is allowed. otherwise false
Since
API level 35
KNOX 3.8

public boolean setRestriction (String property, boolean value)

Since: API level 36

API to set restriction policy for profile.
Note : Only profile owner or device owner can call this API.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 
 try {
     boolean result = edm.getProfilePolicy().setRestriction({PROERTY}, {VALUE});
 } catch (SecurityException e) {
     Log.e(TAG, "SecurityException: " + e);
 }
 

Parameters
property The corresponding value for the property.
value A boolean value which either enables or disables the operation of given property.
Returns
  • true if the policy gets added successfully. otherwise false
Throws
SecurityException If caller is not a profile owner.
Since
API level 35
KNOX 3.8