java.lang.Object |
↳ |
com.samsung.android.knox.restriction.AdvancedRestrictionPolicy |
Class Overview
This class provides APIs to restrict advanced features.
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()
|
|
Constants
public
static
final
int
CCMODE_STATE_DISABLED
Since: API level 15
This state is returned by getCCModeState()
API specifying
the device has failed to enable CC mode. This Device blocked by Lockscreen and need factory-reset for restore.
Constant Value:
1
(0x00000001)
public
static
final
int
CCMODE_STATE_ENABLED
Since: API level 15
This state is returned by getCCModeState()
API specifying
CC mode is enabled on device.
Constant Value:
4
(0x00000004)
public
static
final
int
CCMODE_STATE_ENFORCING
Since: API level 15
Deprecated
in API level 27
Constant Value:
3
(0x00000003)
public
static
final
int
CCMODE_STATE_NONE
Since: API level 15
Constant Value:
0
(0x00000000)
public
static
final
int
CCMODE_STATE_NOT_SUPPORTED
Since: API level 15
This state is returned by getCCModeState()
API specifying
the device doesn't support CC mode.
Constant Value:
-1
(0xffffffff)
public
static
final
int
CCMODE_STATE_READY
Since: API level 15
Constant Value:
2
(0x00000002)
Public Methods
public
boolean
allowBLE
(boolean allow)
API to allow or disallow Bluetooth scanning and Bluetooth access.
Parameters
allow
| true to allow, false to disallow. |
Returns
true
if operation is successful, else false
.
Usage
An administrator can use this API to disable Bluetooth scanning and Bluetooth access without user interaction.
NOTE: If disabled, all Bluetooth functionality is disabled.
If Bluetooth scanning is disabled, the device declines location accuracy and does not allow apps and services to scan for and connect to nearby devices automatically via Bluetooth.
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
try {
boolean allow = false; // disallow Bluetooth scanning and Bluetooth access
if (ekm.getAdvancedRestrictionPolicy().allowBLE(allow)) {
Log.w(TAG, "Bluetooth scanning and Bluetooth access are not allowed");
} else {
Log.w(TAG, "Failed to set the policy.");
}
} catch (SecurityException e) {
Log.w(TAG, "Exception" + e);
}
|
Permission
The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission with a protection level of
signature. |
public
boolean
allowFirmwareAutoUpdate
(boolean enable)
API to enforce checking for Firmware Update automatically (Auto update) in the Device Settings.
Returns
true
if operation is successful, else false
.
Usage
An administrator can use this API to enforce checking for Firmware Update automatically option in the device Settings.
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
try {
boolean allow = false; // disallow firmware auto update
if (ekm.getAdvancedRestrictionPolicy().allowFirmwareAutoUpdate(allow)) {
Log.w(TAG, "firmware auto update not allowed");
} else {
Log.w(TAG, "Failed to set the policy.");
}
} catch (SecurityException e) {
Log.w(TAG, "Exception" + e);
}
|
Permission
The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission with a protection level of
signature. |
public
boolean
allowIntelligenceOnlineProcessing
(boolean allow)
API to disallow online processing of Advanced intelligence features provided by Samsung native applications on the device.
Parameters
allow
| true to allow, false to disallow online processing of Advanced intelligence features |
Returns
true
If online processing of Advanced intelligence features provided by Samsung is allowed or disallowed successfully
Usage
An administrator can use this API to disallow online processing of Advanced intelligence features provided by Samsung native applications on the device.
Note: - It is strongly recommended to handle NoSuchMethodError when invoking this function as certain Knox SDK 3.10 devices may not support the Advanced intelligence features and the associated API. If NoSuchMethodError occurs, there are no security concerns since the Advanced intelligence features are unsupported in such cases.
- For devices that do not support Advanced intelligence features provided by Samsung, the policy will have no effect.
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
try {
if (ekm.getAdvancedRestrictionPolicy().allowIntelligenceOnlineProcessing(false)) {
Log.w(TAG, "Online processing of Advanced intelligence features by Samsung is disallowed successfully.");
} else {
Log.w(TAG, "Online processing of Advanced intelligence features by Samsung is not disallowed.");
}
} catch (SecurityException e) {
Log.w(TAG, "SecurityException: " + e);
} catch (NoSuchMethodError ne) {
Log.w(TAG, "NoSuchMethodError: " + ne);
}
|
Permission
The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission which has a
protection level of signature. |
public
boolean
allowLocalContactStorage
(boolean allow)
API to allow or disallow local contact storage.
Parameters
allow
| true to allow, false to disallow. |
Returns
true
if operation is successful, else false
.
Usage
An administrator can use this API to allow or disallow loacal contact storage.
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
try {
boolean allow = false; // disallow local contact storage
if (ekm.getAdvancedRestrictionPolicy().allowLocalContactStorage(allow)) {
Log.w(TAG, "Local contact storage is not allowed");
} else {
Log.w(TAG, "Failed to set the policy.");
}
} catch (SecurityException e) {
Log.w(TAG, "Exception" + e);
}
|
Permission
The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission with a protection level of
signature. |
See Also
- #isLocalContactStorageAllowed(boolean)
public
boolean
allowOnlySecureConnections
(boolean enable)
API to allow only IPsec or SSL/TLS VPN connections.
Parameters
enable
| true to force the use of only secure connections, false to
allow all connections. |
Returns
true
if setting allow/disallow only secure connections was
successful, else false
.
Usage
An administrator can use this API to force the Android
system VPN client to use either IPSec or SSL/TLS when connecting
to networks.
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
try {
boolean enable = true;
if (ekm.getAdvancedRestrictionPolicy().allowOnlySecureConnections(enable)) {
Log.w(TAG, "Policy successfully set. Only VPN connections using IPSec or SSL/TLS are allowed.");
} else {
Log.w(TAG, "Policy not successfully set.");
}
} catch (SecurityException e) {
Log.w(TAG, "Exception" + e);
}
|
Permission
The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission with a protection level of
signature. |
public
boolean
allowRemoteControl
(boolean allow)
Deprecated
in API level 35
API to enable or disable Knox Remote Control feature on device.
Parameters
allow
| true or false to Enable/Disable Remote Control |
Returns
true
If Remote Control is enabled or disabled successfully
Usage
An administrator can use this API to enable or disable remote control feature on device
Note: This API can be called only by Device owner or Profile owner. |
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
try {
if (ekm.getAdvancedRestrictionPolicy().allowRemoteControl(false)) {
Log.w(TAG, "Remote Control is disabled successfully.");
} else {
Log.w(TAG, "Remote Control is not disabled.");
}
} 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);
AdvancedRestrictionPolicy advancedRestrictionPolicy = kcm.getAdvancedRestrictionPolicy();
try {
if (advancedRestrictionPolicy.allowRemoteControl(false)) {
Log.w(TAG, "Remote Control is disabled successfully.");
} else {
Log.w(TAG, "Remote Control is not disabled.");
}
} catch (SecurityException e) {
Log.w(TAG, "Exception" + e);
}
|
Permission
The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission which has a
protection level of signature.
|
public
boolean
allowUserSetAlwaysOn
(boolean allow)
API to prevent the user from changing Always ON configuration.
Parameters
allow
| true to permit user changes on VPN Always ON configuration,
false to block it. |
Returns
true
if the policy was successfully applied, false
otherwise
Usage
An administrator can use this API to block user changes on VPN
Always ON mode. The menu item for that configuration is disabled.
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
try {
boolean allow = false;
if (ekm.getAdvancedRestrictionPolicy().allowUserSetAlwaysOn(allow)) {
Log.w(TAG, "Policy was applied successfully and user changes on Always ON settings are blocked.");
} else {
Log.w(TAG, "Some error occured and the policy was not applied properly.");
}
} catch (SecurityException e) {
Log.w(TAG, "Exception" + e);
}
|
Permission
The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission
with a protection level of signature. |
public
boolean
allowWifiScanning
(boolean allow)
API to allow or disallow Wifi scanning.
Parameters
allow
| true to allow, false to disallow. |
Returns
true
if operation is successful, else false
.
Usage
An administrator can use this API to disable Wifi scanning without user interaction.
NOTE: If Wi-Fi scanning is disabled, the device declines location accuracy and does not allow
apps and services to scan for and connect to nearby devices automatically via Wi-Fi.
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
try {
boolean allow = false; // disallow Wifi scanning
if (ekm.getAdvancedRestrictionPolicy().allowWifiScanning(allow)) {
Log.w(TAG, "Wifi scanning is not allowed");
} else {
Log.w(TAG, "Failed to set the policy.");
}
} catch (SecurityException e) {
Log.w(TAG, "Exception" + e);
}
|
Permission
The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission with a protection level of
signature. |
public
boolean
enableODETrustedBootVerification
(boolean enable)
Deprecated
in API level 27
API to enable or disable ODE Trusted Boot verification.
Parameters
enable
| true to enable, false to disable. |
Returns
true
if operation is successful, else false
.
Usage
When enabled, device decrypts the data partition only when the binary and kernel is official.
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
try {
boolean enable = false;
if (ekm.getAdvancedRestrictionPolicy().enableODETrustedBootVerification(enable)) {
Log.w(TAG, " Enable ODE Trusted Boot verification not allowed");
} else {
Log.w(TAG, "Failed to set the policy.");
}
} catch (SecurityException e) {
Log.w(TAG, "Exception" + e);
}
|
Permission
The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission with a protection level of
signature. |
public
int
getCCModeState
()
Deprecated
in API level 35
API to check state for CC (Common Criteria) mode.
public
boolean
isBLEAllowed
()
API to check whether Bluetooth scanning and Bluetooth are allowed or disallowed.
Returns
true
if Bluetooth scanning and Bluetooth are allowed, false
if disallowed.
public
boolean
isFirmwareAutoUpdateAllowed
(boolean showMsg)
API to check whether or not option for checking Firmware Update automatically (Auto update) is enforced in Device Settings.
Returns
true
if firmware is allowed to auto update, false
if disallowed.
Usage
An administrator can use this API to check whether checking for Firmware Update automatically
is enforced or not. |
public
boolean
isIntelligenceOnlineProcessingAllowed
()
API to check whether online processing of Advanced intelligence features provided by Samsung is allowed or disallowed.
Returns
true
if online processing of Advanced intelligence features provided by Samsung is allowed, false
if disallowed.
Note: It is strongly recommended to handle NoSuchMethodError when invoking this function as certain Knox SDK 3.10 devices may not support the Advanced intelligence features and the associated API. If NoSuchMethodError occurs, there are no security concerns since the Advanced intelligence features are unsupported in such cases.
public
boolean
isLocalContactStorageAllowed
()
API to check local contact storage is allowed or disallowed.
Returns
true
allow local contact storage, false
disallow local contact storage
public
boolean
isODETrustedBootVerificationEnabled
()
Deprecated
in API level 27
API to check whether ODE Trusted Boot verification is enabled or not.
Returns
true
if ODE Trusted Boot verification is enabled, false
if disabled.
Permission
The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission with a protection level of
signature. |
public
boolean
isOnlySecureConnectionsAllowed
()
API to check whether only IPSec or SSL/TLS VPN connections are allowed.
Returns
true
if only IPSec or SSL/TLS VPN connections are allowed, false
otherwise
Usage
An administrator can use this API to check if Android system VPN must use
either IPSec or SSL/TLS when connecting to networks.
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
try {
boolean result = ekm.getAdvancedRestrictionPolicy().isOnlySecureConnectionsAllowed();
if (result) {
Log.w(TAG, "Only IPSec or SSL/TLS VPN connections are allowed.");
} else {
Log.w(TAG, "Any VPN connection is allowed.");
}
} catch (SecurityException e) {
Log.w(TAG, "Exception" + e);
}
|
Permission
The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission which has the
protection level of signature.
|
public
boolean
isRemoteControlAllowed
()
Deprecated
in API level 35
API to check whether Knox Remote Control feature is enabled.
Returns
true
If Remote Control is enabled or false
otherwise
Usage
An administrator can use this API to check if remote control feature is enabled.
|
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
try {
if (ekm.getAdvancedRestrictionPolicy().isRemoteControlAllowed()) {
Log.d(TAG, "Remote Control is enabled");
} else {
Log.d(TAG, "Remote Control is disabled");
}
} 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);
AdvancedRestrictionPolicy advancedRestrictionPolicy = kcm.getAdvancedRestrictionPolicy();
try {
if (advancedRestrictionPolicy.isRemoteControlAllowed()) {
Log.w(TAG, "Remote Control is enabled.");
} else {
Log.w(TAG, "Remote Control is disabled.");
}
} catch (SecurityException e) {
Log.w(TAG, "Exception" + e);
}
|
public
boolean
isUserSetAlwaysOnAllowed
()
API to verify whether the user is allowed to change VPN Always ON mode
configuration or not.
Returns
true
if users are allowed to modify Always ON settings, false
otherwise
Usage
An administrator can use this API to check if user changes on VPN
Always ON mode are allowed or not.
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
try {
boolean result = ekm.getAdvancedRestrictionPolicy().isUserSetAlwaysOnAllowed();
if (result) {
Log.w(TAG, "Users are allowed to change Always ON configuration..");
} else {
Log.w(TAG, "Users are not permitted to change Always ON mode.");
}
} catch (SecurityException e) {
Log.w(TAG, "Exception" + e);
}
|
public
boolean
isWifiScanningAllowed
()
API to check whether Wifi scanning is allowed or disallowed.
Returns
true
if Wifi scanning is allowed, false
if disallowed.
public
boolean
setCCMode
(boolean enable)
Deprecated
in API level 35
API to enable or disable CC (Common Criteria) mode.
Parameters
enable
| true to enable, false to disable. |
Returns
true
if operation is successful, else false
.
Usage
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
try {
boolean enable = false;
ekm.getAdvancedRestrictionPolicy().setCCMode(enable);
Log.w(TAG, "Set CCMode is called.");
} catch (SecurityException e) {
Log.w(TAG, "Exception" + e);
}
|
Permission
The use of this API requires the caller to have the
"com.samsung.android.knox.permission.KNOX_ADVANCED_RESTRICTION" permission with a protection level of
signature. |
See Also
- com.samsung.android.knox.restriction.RestrictionPolicy.isFastEncryptionAllowed(boolean)
getCCModeState()