Since: API level 6
public class

BluetoothSecureModePolicy

extends Object
java.lang.Object
   ↳ com.samsung.android.knox.bluetooth.BluetoothSecureModePolicy

Class Overview

This class provides APIs to control Bluetooth Secure Mode Settings. The user cannot overwrite any disabled settings provided by this policy.
Bluetooth secure mode enables MDM administrator to
- Enable/disable Bluetooth profiles
- Limit device discoverability and device pairing
- Device white listing based on name, class of device and UUIDs.
Bluetooth secure mode configuration takes effect after secure mode is enabled and Bluetooth is turned ON the next time. All Bluetooth secure mode configurations are turned off when secure mode is disabled and Bluetooth is turned ON the next time.

Since
API level 6
MDM 4.0

Summary

Public Methods
boolean addBluetoothDevicesToWhiteList(List<BluetoothSecureModeWhitelistConfig> whiteListConfig)
Deprecated in API level 33
boolean disableSecureMode()
Deprecated in API level 30
NOTE: This API is not available since Android 10.
boolean enableDeviceWhiteList(boolean enable)
Deprecated in API level 33
boolean enableSecureMode(BluetoothSecureModeConfig configObj, List<BluetoothSecureModeWhitelistConfig> whiteList)
Deprecated in API level 30
NOTE: This API is not available since Android 10.
List<BluetoothSecureModeWhitelistConfig> getBluetoothDevicesFromWhiteList()
Deprecated in API level 33
BluetoothSecureModeConfig getSecureModeConfiguration()
Deprecated in API level 30
NOTE: This API is not available since Android 10.
boolean isDeviceWhiteListEnabled()
Deprecated in API level 33
boolean isSecureModeEnabled()
Deprecated in API level 30
NOTE: This API is not available since Android 10.
boolean removeBluetoothDevicesFromWhiteList(List<BluetoothSecureModeWhitelistConfig> whiteListConfig)
Deprecated in API level 33
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public boolean addBluetoothDevicesToWhiteList (List<BluetoothSecureModeWhitelistConfig> whiteListConfig)

Since: API level 6

Deprecated in API level 33

API to add a specific device to the list of white listed devices by specifying the device configuration through name, cod and list of UUIDs. When Bluetooth secure mode is enable and device whitelist is enabled, only devices which are present in whitelist are allowed to interact with device through Bluetooth.

Returns
  • true if successful else false
Throws
SecurityException If caller does not have required permissions
Usage
Used to add devices to whitelist by specifying device configuration through friendly name, class of device and list of UUIDs.
1. Administrator creates a list of whitelist objects to add to whitelist.
2. Administrator adds devices to whitelist.
3. The whitelist setting takes effect after secure mode enabled and next time Bluetooth is turned ON.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothSecureModePolicy bluetoothSecureModePolicy = edm.getBluetoothSecureModePolicy();

 try {

     String name = "bai2ndGen";

     int cod = BluetoothClass.Device.Major.UNCATEGORIZED;

     String uuids[] = {

             "00001101-0000-1000-8000-00805f9b34fb", "00001200-0000-1000-8000-00805f9b34fb"

     };

     BluetoothSecureModeWhitelistConfig whiteListConfig = new BluetoothSecureModeWhitelistConfig();

     whiteListConfig.name = name;

     whiteListConfig.cod = cod;

     whiteListConfig.uuids = uuids;

     boolean result = bluetoothSecureModePolicy

             .addBluetoothDevicesToWhiteList(whiteListConfig);

 } catch (RemoteException e) {

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

 }



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

public boolean disableSecureMode ()

Since: API level 6

Deprecated in API level 30
NOTE: This API is not available since Android 10.

API to disable secure mode, if it is enabled. All profiles are reset on disabling secure mode and set to false.
If any device configurations are white listed, all whitelists are cleared on disable secure mode.

Returns
  • true if successful else false
Throws
SecurityException If caller does not have required permissions
Usage
Used to disable secure mode on device and clear all blocked Bluetooth profiles and white listed devices.
1. Administrator disables secure mode.
2. Administrator resets Bluetooth for secure mode settings to be cleared.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothSecureModePolicy bluetoothSecureModePolicy = edm.getBluetoothSecureModePolicy();

 try {

     boolean result = bluetoothSecureModePolicy.disableSecureMode();

 } catch (RemoteException e) {

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

 }



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

public boolean enableDeviceWhiteList (boolean enable)

Since: API level 6

Deprecated in API level 33

API to enable or disable device whitelist to check for white listed devices when Bluetooth secure mode is enabled. If device whitelist is enabled, only devices whose configuration has been added to whitelist are allowed to interact through Bluetooth.

Parameters
enable boolean value to enable or disable whitelist
Returns
  • true if successful else false
Throws
SecurityException If caller does not have required permissions
Usage
Used to enable/disable checking for white listed devices while Bluetooth secure mode is enabled.
1. Administrator enables/disables device white listing.
2. The whitelist setting takes effect after secure mode enabled and next time Bluetooth is turned ON


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothSecureModePolicy bluetoothSecureModePolicy = edm.getBluetoothSecureModePolicy();

 try {

     boolean result = bluetoothSecureModePolicy.enableDeviceWhiteList();

 } catch (RemoteException e) {

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

 }



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

public boolean enableSecureMode (BluetoothSecureModeConfig configObj, List<BluetoothSecureModeWhitelistConfig> whiteList)

Since: API level 6

Deprecated in API level 30
NOTE: This API is not available since Android 10.

API to enable secure mode, with the settings configured by administrator. Administrator can configure which Bluetooth profiles to enable/disable on enabling secure mode. Administrator can choose to enable/disable device white listed while enabling secure mode. Administrator can also create a device whitelist allowing specific device configurations which will be checked when device white listed is enabled.

Parameters
configObj Object specifying boolean values for every Bluetooth profile set by administrator
whiteList List of device configurations to be added to whitelist while enabling secure mode
Returns
  • true if successful else false
Throws
SecurityException If caller does not have required permissions
Usage
Used to enable secure mode and configure which Bluetooth profiles are allowed or disallowed and also whitelist specific device configurations which are allowed to interact through Bluetooth.
1. Administrator selects which profiles are to be enabled.
2. Administrator selects if scan mode, pairing mode, white listing is to be enabled and creates a configuration object config which stores required settings.
3. Administrator enters devices into whitelist if needed.
4. Administrator enables secure mode.
5. Administrator resets Bluetooth for secure mode settings to take effect.
6. For every Bluetooth profile, the cumulative strictest value set through Bluetooth Secure Mode Policy and Bluetooth Policy will be applied and enforced on device.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothSecureModePolicy bluetoothSecureModePolicy = edm.getBluetoothSecureModePolicy();

 try {

     BluetoothSecureModeConfig config = new BluetoothSecureModeConfig();

     config.scanEnable = true;

     config.a2dpEnable = true;

     config.whitelistEnable = true;

 

     BluetoothSecureModeWhitelist whitelist = new BluetoothSecureModeWhitelist();

     String name = "bai2ndGen";

     int cod = BluetoothClass.Device.Major.UNCATEGORIZED;

     String uuids[] = {

             "00001101-0000-1000-8000-00805f9b34fb", "00001200-0000-1000-8000-00805f9b34fb"

     };

     whiteListConfig.name = name;

     whiteListConfig.cod = cod;

     whiteListConfig.uuids = uuids;

     boolean result = bluetoothSecureModePolicy.enableSecureMode(config, whitelist);

 } catch (RemoteException e) {

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

 }



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

public List<BluetoothSecureModeWhitelistConfig> getBluetoothDevicesFromWhiteList ()

Since: API level 6

Deprecated in API level 33

API to retrieve the device configuration for each device that has been added to the whitelist in Bluetooth secure mode.

Returns
  • List of BluetoothSecureModeWhitelistConfig objects with configuration for every device.
Usage
Used to get list of devices configurations that have been added to Bluetooth secure mode whitelist.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothSecureModePolicy bluetoothSecureModePolicy = edm.getBluetoothSecureModePolicy();

 try {

     BluetoothSecureModeWhitelistConfig config = bluetoothSecureModePolicy

             .getBluetoothDeviceFromWhiteList();

 } catch (RemoteException e) {

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

 }



 
Multiuser Environment
Global Scope
Since
API level 6
MDM 4.0

public BluetoothSecureModeConfig getSecureModeConfiguration ()

Since: API level 6

Deprecated in API level 30
NOTE: This API is not available since Android 10.

API to retrieve the current secure mode configuration for all profiles.

Returns
  • BluetoothSecureModeConfig object with the current configuration set for all profiles
Usage
Used to retrieve the current configuration set by administrator while enabling Bluetooth secure mode.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothSecureModePolicy bluetoothSecureModePolicy = edm.getBluetoothSecureModePolicy();

 try {

     BluetoothSecureModeConfig config = bluetoothSecureModePolicy

             .getSecureModeConfiguration();

 } catch (RemoteException e) {

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

 }



 
Multiuser Environment
Global Scope
Since
API level 6
MDM 4.0

public boolean isDeviceWhiteListEnabled ()

Since: API level 6

Deprecated in API level 33

API to check if device whitelist is enabled in Bluetooth secure mode.

Returns
  • true if successful else false
Usage
Used to check if device white listing is enabled in Bluetooth secure mode.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothSecureModePolicy bluetoothSecureModePolicy = edm.getBluetoothSecureModePolicy();

 try {

     boolean result = bluetoothSecureModePolicy.isDeviceWhiteListEnabled();

 } catch (RemoteException e) {

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

 }



 
Multiuser Environment
Global Scope
Since
API level 6
MDM 4.0

public boolean isSecureModeEnabled ()

Since: API level 6

Deprecated in API level 30
NOTE: This API is not available since Android 10.

API to check if Bluetooth secure mode is currently enabled .

Returns
  • true if successful else false
Usage
Used to check if Bluetooth secure ode is currently enabled.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothSecureModePolicy bluetoothSecureModePolicy = edm.getBluetoothSecureModePolicy();

 try {

     boolean result = bluetoothSecureModePolicy.isSecureModeEnabled();

 } catch (RemoteException e) {

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

 }



 
Multiuser Environment
Global Scope
Since
API level 6
MDM 4.0

public boolean removeBluetoothDevicesFromWhiteList (List<BluetoothSecureModeWhitelistConfig> whiteListConfig)

Since: API level 6

Deprecated in API level 33

API to remove a specific device from the list of white listed devices by specifying the device configuration through name, cod and list of UUIDs.

Returns
  • true if successful else false
Throws
SecurityException If caller does not have required permissions
Usage
Used to remove devices from whitelist in Bluetooth secure mode.
1. Administrator creates a list of whitelist objects to remove from whitelist.
2. Administrator removes devices from whitelist.
3. The whitelist setting takes effect after secure mode enabled and next time Bluetooth is turned ON.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 BluetoothSecureModePolicy bluetoothSecureModePolicy = edm.getBluetoothSecureModePolicy();

 try {

     String name = "bai2ndGen";

     int cod = BluetoothClass.Device.Major.UNCATEGORIZED;

     String uuids[] = {

             "00001101-0000-1000-8000-00805f9b34fb", "00001200-0000-1000-8000-00805f9b34fb"

     };

     BluetoothSecureModeWhitelistConfig whiteListConfig = new BluetoothSecureModeWhitelistConfig();

     whiteListConfig.name = name;

     whiteListConfig.cod = cod;

     whiteListConfig.uuids = uuids;

     boolean result = bluetoothSecureModePolicy

             .removeBluetoothDevicesFromWhiteList(whiteListConfig);

 } catch (RemoteException e) {

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

 }



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