Since: Knox API Level 5
public class

KioskMode

extends Object
java.lang.Object
   ↳ com.samsung.android.knox.kiosk.KioskMode

Class Overview

This class provides APIs to enable, disable, and define device behavior for kiosk mode. These APIs can be used in conjunction with other MDM APIs. An administrator can use kiosk mode APIs without enabling kiosk mode. Kiosk mode allows enterprises to restrict user access to selected applications and features on the device. These applications and features can be made available through the kiosk home screen.

Since
API level 5
MDM 3.0

Summary

Constants
String ACTION_DISABLE_KIOSK_MODE_RESULT Broadcast Action : Sent to inform administrators about the result of the disable kiosk mode operation.
String ACTION_ENABLE_KIOSK_MODE_RESULT Broadcast Action : Sent to inform administrators about the result of the enable Kiosk mode operation.
String ACTION_UNEXPECTED_KIOSK_BEHAVIOR Broadcast Action : Sent to inform administrators that unexpected kiosk behavior has occurred.
int EDGE_FUNCTION_ALL Bitmask to indicate all edge screen functionalities.
int ERROR_BUSY Indicates that kiosk mode service is busy with other request.
int ERROR_KIOSK_ALREADY_ENABLED Indicates that kiosk mode is already enabled.
int ERROR_NONE Indicates that kiosk mode operation was successful.
int ERROR_PACKAGE_NOT_FOUND Indicates that the kiosk home package cannot be found.
int ERROR_PERMISSION_DENIED Indicates that kiosk mode is enabled by another administrator.
int ERROR_UNKNOWN Indicates an unknown error.
String EXTRA_KIOSK_RESULT Used as an int extra field with ACTION_ENABLE_KIOSK_MODE_RESULT and ACTION_DISABLE_KIOSK_MODE_RESULT.
Public Methods
boolean allowAirCommandMode(boolean allow)
API to allow or deny Air Command on device.
boolean allowAirViewMode(boolean allow)
API to allow or deny Air View on device.
boolean allowEdgeScreen(int edgeScreenFunction, boolean allow)
API to allow or deny edge screen functionalities on device.
List<Integer> allowHardwareKeys(List<Integer> hwKeyId, boolean allow)
API to allow or block hardware keys on the device.
boolean allowMultiWindowMode(boolean allow)
API to allow or deny multi window mode on device.
boolean allowTaskManager(boolean allow)
API to allow or deny task manager application and recent applications window.
boolean clearAllNotifications()
API to clear all notifications from status bar, except those flagged with Notification.FLAG_ONGOING_EVENT or Notification.FLAG_NO_CLEAR.
void disableKioskMode()
API to disable kiosk mode.
void disableKioskMode(KioskSetting kiosk)
API to disable Kiosk Mode with predefined Kiosk settings.
void enableKioskMode(String kioskPackage)
API to enable kiosk mode with an administrator-specified home screen.
void enableKioskMode(KioskSetting kiosk)
API to enable Kiosk Mode with default Kiosk home screen and predefined Kiosk settings.
void enableKioskMode()
API to enable kiosk mode with the default kiosk home screen.
List<Integer> getAllBlockedHardwareKeys()
API to get a list of all blocked hardware keys.
int getBlockedEdgeScreen()
API to check whether edge screen functionalities are blocked on device.
List<Integer> getHardwareKeyList()
API to get the list of hardware keys available on the device.
String getKioskHomePackage()
API to return package name of kiosk home screen.
boolean hideNavigationBar(boolean hide)
API to hide the device navigation bar.
boolean hideStatusBar(boolean hide)
API to hide the device status bar.
boolean hideSystemBar(boolean hide)
API to hide the device status bar, system bar, or navigation bar.
boolean isAirCommandModeAllowed()
API to check whether Air Command is allowed.
boolean isAirViewModeAllowed()
API to check whether Air View is allowed.
boolean isHardwareKeyAllowed(int hwKeyId)
API to check whether a hardware key is allowed.
boolean isKioskModeEnabled()
API to check whether kiosk mode is enabled.
boolean isMultiWindowModeAllowed()
API to check if multi window mode is allowed or not allowed.
boolean isNavigationBarHidden()
API to check whether the navigation bar is hidden
boolean isStatusBarHidden()
API to check whether the status bar is hidden.
boolean isSystemBarHidden()
API to check whether the status bar, the system bar, or the navigation bar is hidden.
boolean isTaskManagerAllowed()
API to check whether task manager and recent applications are allowed.
boolean wipeRecentTasks()
API to clear recent tasks list.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String ACTION_DISABLE_KIOSK_MODE_RESULT

Since: Knox API Level 5

Broadcast Action : Sent to inform administrators about the result of the disable kiosk mode operation. The receiver must hold "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" to receive this broadcast. This targeted broadcast is sent only to the administrator who called the API. The intent has the following extra value:
EXTRA_KIOSK_RESULT :

ERROR_NONE for success
ERROR_PERMISSION_DENIED if kiosk mode is enabled by another administrator
ERROR_UNKNOWN for unknown error
ERROR_BUSY if another request in progress

Since
API level 5
MDM 3.0
Constant Value: "com.samsung.android.knox.intent.action.DISABLE_KIOSK_MODE_RESULT"

public static final String ACTION_ENABLE_KIOSK_MODE_RESULT

Since: Knox API Level 5

Broadcast Action : Sent to inform administrators about the result of the enable Kiosk mode operation. The receiver must hold "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" to receive this broadcast. This targeted broadcast is sent only to the administrator who calls the API. The intent has the following extra value:
EXTRA_KIOSK_RESULT:

ERROR_NONE for success
ERROR_KIOSK_ALREADY_ENABLED if kiosk mode is already enabled
ERROR_PACKAGE_NOT_FOUND if the administrator-specified home screen package is not found on the device
ERROR_UNKNOWN for unknown error
ERROR_BUSY if another request in progress

Since
API level 5
MDM 3.0
Constant Value: "com.samsung.android.knox.intent.action.ENABLE_KIOSK_MODE_RESULT"

public static final String ACTION_UNEXPECTED_KIOSK_BEHAVIOR

Since: Knox API Level 5

Broadcast Action : Sent to inform administrators that unexpected kiosk behavior has occurred. Kiosk mode is forcefully disabled before broadcasting this intent. The receiver must hold "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" to receive this broadcast. This targeted broadcast is sent only to the administrator that enabled kiosk mode.

Since
API level 5
MDM 3.0
Constant Value: "com.samsung.android.knox.intent.action.UNEXPECTED_KIOSK_BEHAVIOR"

public static final int EDGE_FUNCTION_ALL

Since: Knox API Level 17

Bitmask to indicate all edge screen functionalities.

Since
API level 17
MDM 5.5
Multiuser Environment
Global Scope
Constant Value: 31 (0x0000001f)

public static final int ERROR_BUSY

Since: Knox API Level 5

Indicates that kiosk mode service is busy with other request.

Since
API level 5
MDM 3.0
Constant Value: -4 (0xfffffffc)

public static final int ERROR_KIOSK_ALREADY_ENABLED

Since: Knox API Level 5

Indicates that kiosk mode is already enabled.

Since
API level 5
MDM 3.0
Constant Value: -1 (0xffffffff)

public static final int ERROR_NONE

Since: Knox API Level 5

Indicates that kiosk mode operation was successful.

Since
API level 5
MDM 3.0
Constant Value: 0 (0x00000000)

public static final int ERROR_PACKAGE_NOT_FOUND

Since: Knox API Level 5

Indicates that the kiosk home package cannot be found.

Since
API level 5
MDM 3.0
Constant Value: -3 (0xfffffffd)

public static final int ERROR_PERMISSION_DENIED

Since: Knox API Level 5

Indicates that kiosk mode is enabled by another administrator.

Since
API level 5
MDM 3.0
Constant Value: -2 (0xfffffffe)

public static final int ERROR_UNKNOWN

Since: Knox API Level 5

Indicates an unknown error.

Since
API level 5
MDM 3.0
Constant Value: -2000 (0xfffff830)

public static final String EXTRA_KIOSK_RESULT

Since: Knox API Level 5

Used as an int extra field with ACTION_ENABLE_KIOSK_MODE_RESULT and ACTION_DISABLE_KIOSK_MODE_RESULT. Contains the result of the enable or disable kiosk mode operation.

Since
API level 5
MDM 3.0
Constant Value: "com.samsung.android.knox.intent.extra.KIOSK_RESULT"

Public Methods

public boolean allowAirCommandMode (boolean allow)

Since: Knox API Level 13

API to allow or deny Air Command on device.

Parameters
allow true to allow Air Command on device, false to block.

NOTE: Since MDM 5.5, true will enable aircommand mode as user does not have UI option to enable it.

Returns
  • true if successful, false if failed.
Throws
SecurityException If caller does not have required permissions
Usage
Administrator could set this policy to block Air Command feature on device. If it set to false, user will not be able use the stylus air command. Otherwise if it is set to true, this mode will be allowed again.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     // Administrator wishes to block air command functionality.
     kioskModeService.allowAirCommandMode(false);
 } catch (RemoteException e) {
     Log.e(TAG, "Remote exception : " + e);
 }
 

Permission
The API usage requires the caller to have the "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" permission with a protection level of signature.
Since
API level 13
MDM 5.2
Multiuser Environment
Global Scope

public boolean allowAirViewMode (boolean allow)

Since: Knox API Level 13

API to allow or deny Air View on device.

Parameters
allow true to allow Air View on device, false to block
Returns
  • true if successful, false if failed
Throws
SecurityException If caller does not have required permissions
Usage
Administrator could set this policy to block Air View feature on device. If it set to false, user will not be able use the stylus pen air view mode. Otherwise if it is set to true, this mode will be allowed again.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     // Administrator wishes to block air view functionality.
     kioskModeService.allowAirViewMode(false);
 } catch (RemoteException e) {
     Log.e(TAG, "Remote exception : " + e);
 }
 

Permission
The API usage requires the caller to have the "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" permission with a protection level of signature.
Since
API level 13
MDM 5.2
Multiuser Environment
Global Scope

public boolean allowEdgeScreen (int edgeScreenFunction, boolean allow)

Since: Knox API Level 17

API to allow or deny edge screen functionalities on device.

Parameters
edgeScreenFunction Administrator can pass EDGE_FUNCTION_ALL to block all edge screen functionalities.

Calling this API with any other flags will return false.

allow true to allow edge screen functionalities on device, false to block
Returns
  • true if successful, false if failed
Throws
SecurityException If caller does not have required permissions
Usage
Administrator could use this policy to block or allow edge screen functionalities on device. EDGE_FUNCTION_ALL can be provided to block all the edge screen functionalities. Calling this API with any other flags will return false.
 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 boolean result = false;
 try {
     int edgeScreenFunctions = KioskMode.EDGE_FUNCTION_ALL;
     result = kioskModeService.allowEdgeScreen(edgeScreenFunctions, false);
 } catch (RemoteException e) {
     Log.e(TAG, "Remote exception : " + e);
 }
 if (result == true) {
     // Policy has been successfully applied
 }
 

Permission
The API usage requires the caller to have the "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" permission with a protection level of signature.
Since
API level 17
MDM 5.5
Multiuser Environment
Global Scope

public List<Integer> allowHardwareKeys (List<Integer> hwKeyId, boolean allow)

Since: Knox API Level 5

API to allow or block hardware keys on the device.

Parameters
hwKeyId The list of Ids corresponding to the hardware keys.
allow true to allow the list of hardware keys, false to block them.
Returns
  • The list of the keys that were successfully allowed or blocked. Returns null on failure.
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to block the user from using some hardware keys. If a list of hardware keys is set to false, the keys are disabled, and the user cannot use them until the administrator enables them again. If a list is set to true, user can use the keys. The list returned identifies those keys successfully blocked or allowed. If the administrator blocks a key that is not a hardware key, the key is not effectively blocked at runtime. To obtain the corresponding actions for each key Id, see Android Developer KeyEvent Page..

NOTE: Since MDM 5.3, only owner (User 0) administrator can call this API. For guest users, API will return false.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 // disable
 try {
     List availableHwKeys = new ArrayList();
     avaiableHwKeys.add(new Integer(24)); //24 is keycode for Volume Up
     avaiableHwKeys.add(new Integer(25)); //25 is keycode for Volume Down

     // disable provided keys
     List successBlockedKeys = kioskModeService.allowHardwareKeys(availableHwKeys, false)) {
     // successBlockedKeys is the list of the keys that were successfully blocked

     // enable blocked keys
     List successEnabledKeys = kioskModeService.allowHardwareKeys(availableHwKeys, true)) {
     // successEnabledKeys is the list of the keys that were successfully allowed
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
 
For Container:

NOTE: Since MDM 5.3, only COM (Kiosk) container administrator can call this API. For other container types, API will return false.

 // 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);
 KioskMode kioskModeService = kcm.getKioskMode();
 try {
     List availableHwKeys = new ArrayList();
     avaiableHwKeys.add(new Integer(24)); //24 is keycode for Volume Up
     avaiableHwKeys.add(new Integer(25)); //25 is keycode for Volume Down

     // disable provided keys
     List successBlockedKeys = kioskModeService.allowHardwareKeys(availableHwKeys, false)) {
     // successBlockedKeys is the list of the keys that were successfully blocked

     // enable blocked keys
     List successEnabledKeys = kioskModeService.allowHardwareKeys(availableHwKeys, true)) {
     // successEnabledKe
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" permission with a protection level of signature.
Since
API level 5
MDM 3.0
Multiuser Environment
User Scope

public boolean allowMultiWindowMode (boolean allow)

Since: Knox API Level 6

API to allow or deny multi window mode on device.

Parameters
allow true to allow multi window mode, false to disallow multi window mode.

NOTE: Since MDM 5.5, true will enable multi window mode as user does not have UI option to enable it.

Returns
  • true on set multi window mode allowance success, false on set multi window mode allowance failure.
Throws
SecurityException If caller does not have required permissions
Usage
Administrator could set this policy to block using multi window feature on device. If it set to false, user will not be able to launch flash bar that supports to launch apps with multi window by long pressing back key administrator allows it again. If it is set to true, this mode will be allowed again.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 // disable
 try {
     if (kioskModeService.allowMultiWindowMode(false)) {
         // multi window mode will be disabled.
     } else {
         // failure enabling policy
     }
     // enable
     if (kioskModeService.allowMultiWindowMode(true)) {
         // multi window mode will be enabled.
     } else {
         // failure disabling policy
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: "; + e);
 }
 
For Container:

NOTE: Since MDM 5.3, only COM (Kiosk) container administrator can call this API. For other container types, API will return false. false.

 // 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);
 KioskMode kioskModeService = kcm.getKioskMode();
 try {
     if (kioskModeService.allowMultiWindowMode(false)) {
         // multi window mode will be disabled.
     } else {
         // failure enabling policy
     }
     // enable
     if (kioskModeService.allowMultiWindowMode(true)) {
         // multi window mode will be enabled.
     } else {
         // failure disabling policy
     }
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

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

public boolean allowTaskManager (boolean allow)

Since: Knox API Level 5

API to allow or deny task manager application and recent applications window.

Parameters
allow true to allow task manager and recent applications, false to disallow task manager and recent applications.
Returns
  • true if allowing/disallowing task manager was successful, else false.
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to block the user from using the task manager and accessing recent applications. If set to false, the task manager application is disabled (and force stopped if it is running), and user cannot launch it until the administrator enables it again. In addition, if the user long presses the Home key, the recent applications window does not appear. If set to true, the task manager and recent applications window are enabled.

NOTE 1: Since MDM 5.3, only owner (User 0) administrator can call this API. For guest users, API will return false.

NOTE 2: Since MDM 5.5, if Task Manager is not pre-loaded in the device, this API will return false regardless of the value set and user will be able to access recent applications.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 // disable
 try {
     if (kioskModeService.allowTaskManager(false)) {
         // task manager and recent applications are disabled.
     } else {
         // failure enabling policy
     }
     // enable
     if (kioskModeService.allowTaskManager(true)) {
         // task manager and recent applications are enabled.
     } else {
         // failure disabling policy
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: "; + e);
 }
 

For Container:

NOTE 1: Since MDM 5.3, only COM (Kiosk) container administrator can call this API. For other container types, API will return false.

NOTE 2: Since MDM 5.5, if Task Manager is not pre-loaded in the device, this API will return false regardless of the value set and user will be able to access recent applications.

 // 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);
 KioskMode kioskModeService = kcm.getKioskMode();
 try {
     if (kioskModeService.allowTaskManager(false)) {
         // task manager and recent applications are disabled.
     } else {
         // failure enabling policy
     }
     // enable
     if (kioskModeService.allowTaskManager(true)) {
         // task manager and recent applications are enabled.
     } else {
         // failure disabling policy
     }
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" permission with a protection level of signature.
Since
API level 5
MDM 3.0
Multiuser Environment
User Scope

public boolean clearAllNotifications ()

Since: Knox API Level 11

API to clear all notifications from status bar, except those flagged with Notification.FLAG_ONGOING_EVENT or Notification.FLAG_NO_CLEAR.

Returns
  • true if successful, false if failed
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to clear notifications from status bar, except those flagged with Notification.FLAG_ONGOING_EVENT or Notification.FLAG_NO_CLEAR. The list of notifications on status bar will be empty when the user views it. The behavior of this API is the same as the button "clear" on the Android's status bar and notification panel.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     // clear all notifications from status bar, except those flagged with
     // Notification.FLAG_ONGOING_EVENT ot Notification.FLAG_NO_CLEAR
     kioskModeService.clearAllNotifications();
 } catch (SecurityException e) {
     Log.e(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);
 KioskMode kioskModeService = kcm.getKioskMode();
 try {
     // clear all notifications from status bar, except those flagged with
     // Notification.FLAG_ONGOING_EVENT ot Notification.FLAG_NO_CLEAR
     kioskModeService.clearAllNotifications();
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

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

public void disableKioskMode ()

Since: Knox API Level 5

API to disable kiosk mode.

Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to disable kiosk mode. Intent ACTION_DISABLE_KIOSK_MODE_RESULT is broadcasted as result of this API call. A home screen that was set as the default before kiosk mode was enabled is reset as the default home screen. All other policies applied by the administrator while in kiosk mode are not reverted. An administrator who attempts to disable kiosk mode receives an error if it was enabled by another administrator.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     kioskModeService.disableKioskMode();
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" permission with a protection level of signature
Since
API level 5
MDM 3.0
Multiuser Environment
Global Scope

public void disableKioskMode (KioskSetting kiosk)

Since: Knox API Level 11

API to disable Kiosk Mode with predefined Kiosk settings.

Throws
SecurityException If caller does not have required permissions
Usage
Administrator can use this API to disable Kiosk Mode on the device. Intent ACTION_DISABLE_KIOSK_MODE_RESULT is broadcasted as result of this API call. The administrator can enforce additional restrictions in kiosk mode if the argument is set. If argument is false, Specific kiosk mode will disabled. When it is called multiple times, the previous value will be changed to new one.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     KioskSetting kiosk;
     kiosk.settingsChanges = false;
     kiosk.statusBarExpansion = false;
     kiosk.homeKey = false;
     kiosk.airCommand = true;
     kiosk.airView = true;
     kiosk.hardwareKey = null;
     kiosk.multiWindow = false;
     kiosk.smartClip = true;
     kiosk.taskManager = false;
     kiosk.clearAllNotifications = false;
     kiosk.navigationBar = false;
     kiosk.statusBar = true
     kiosk.systemBar = false;
     kiosk.wipeRecentTasks = false;

     kioskModeService.disableKioskMode(kiosk);
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 
Permission
The use of this API requires the caller to add the "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" permission with a protection level of signature
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public void enableKioskMode (String kioskPackage)

Since: Knox API Level 5

API to enable kiosk mode with an administrator-specified home screen.

Parameters
kioskPackage Package name of the administrator-specified home screen application
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to enable kiosk mode with an administrator-specified home screen. Intent ACTION_ENABLE_KIOSK_MODE_RESULT is broadcasted as result of this API call. The most recent tasks are cleared, and uninstallation and re-installation of the home application are disabled. The administrator can enforce additional restrictions in kiosk mode using other kiosk mode and EDM policies. This API assumes that the administrator-specified home screen application package is already installed and enabled on the device. An administrator who attempts to enable kiosk mode receives an error if it is already enabled.

NOTE: User can exit the kiosk configured by the administrator by booting the device into Safe Mode or by adding LockScreen widgets or shortcuts via Settings application. It is recommended that administrators call allowSafeMode(boolean) to prevent the user from booting into Safe Mode and allowLockScreenView(int, boolean) to block LockScreen widgets and shortcuts.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     String kioskPackage = "com.abc.kiosk";
     kioskModeService.enableKioskMode(kioskPackage);
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" permission with a protection level of signature
Since
API level 5
MDM 3.0
Multiuser Environment
Global Scope

public void enableKioskMode (KioskSetting kiosk)

Since: Knox API Level 11

API to enable Kiosk Mode with default Kiosk home screen and predefined Kiosk settings.

Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to enable kiosk mode on the device. The administrator can enforce additional restrictions in kiosk mode if the argument is set. If argument is false, Specific kiosk mode will disabled. When it is called multiple times, the previous value will be changed to new one.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     KioskSetting kiosk;
     Kiosk.settingsChanges = false;
     Kiosk.statusBarExpansion = false;
     Kiosk.homeKey = false;
     Kiosk.airCommand = false;
     Kiosk.airView = false;
     Kiosk.hardwareKey = null;
     Kiosk.multiWindow = false;
     Kiosk.smartClip = false;
     Kiosk.taskManager = false;
     Kiosk.clearAllNotifications = false;
     Kiosk.navigationBar = false;
     Kiosk.statusBar = true
     Kiosk.systemBar = false;
     Kiosk.wipeRecentTasks = false;

     kioskModeService.enableKioskMode(kiosk);
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 
Permission
The use of this API requires the caller to add the "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" permissions with a protection level of signature
Since
API level 11
MDM 5.0
Multiuser Environment
Global Scope

public void enableKioskMode ()

Since: Knox API Level 5

API to enable kiosk mode with the default kiosk home screen.

Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to enable kiosk mode on the device. Intent ACTION_ENABLE_KIOSK_MODE_RESULT is broadcasted as result of this API call. When kiosk mode is enabled with no arguments, the user is presented with a restricted version of the native Samsung home screen. No default application shortcuts appear when the home screen is launched for the first time, including the phone application used to make emergency calls. The most recent tasks are cleared. The uninstallation and reinstallation of the default kiosk application is also disabled. The administrator can enforce additional restrictions in kiosk mode using other kiosk mode and EDM policies. An administrator receives an error in an attempt to enable kiosk mode if it is already enabled.

NOTE: User can exit the kiosk configured by the administrator by booting the device into Safe Mode or by adding LockScreen widgets or shortcuts via Settings application. It is recommended that administrators call allowSafeMode(boolean) to prevent the user from booting into Safe Mode and allowLockScreenView(int, boolean) to block LockScreen widgets and shortcuts.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     kioskModeService.enableKioskMode();
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" permission with a protection level of signature
Since
API level 5
MDM 3.0
Multiuser Environment
Global Scope

public List<Integer> getAllBlockedHardwareKeys ()

Since: Knox API Level 5

API to get a list of all blocked hardware keys.

Returns
  • List of blocked hardware keys Ids. Returns null on failure.

    // Sample Output
    // 24 (Volume Down)
    // 25 (Volume Up)
Usage
An administrator can use this API to check the list of all blocked hardware keys on the device. A nonhardware key is effectively allowed at runtime. To obtain the corresponding actions for each key Id, see Android Developer KeyEvent Page..

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     // administrator wants the list of keys blocked in system
     List adminBlockedKeys = kioskModeService.getAllBlockedHardwareKeys();
 } 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);
 KioskMode kioskModeService = kcm.getKioskMode();
 try {
     // administrator wants the list of keys blocked in system
     List adminBlockedKeys = kioskModeService.getAllBlockedHardwareKeys();
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

Since
API level 5
MDM 3.0
Multiuser Environment
User Scope

public int getBlockedEdgeScreen ()

Since: Knox API Level 17

API to check whether edge screen functionalities are blocked on device.

Returns
  • Returns EDGE_FUNCTION_ALL if all edge screen functionalities are blocked, else 0 will be returned.
Usage
An administrator can use this API to check if edge screen functionalities are currently blocked on device. In case no edge screen functionality is blocked, 0 will be returned, otherwise EDGE_FUNCTION_ALL will be returned.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 int blockedEdgeScreenFunctions = 0;
 try {
     blockedEdgeScreenFunctions = kioskModeService.getBlockedEdgeScreen();
 } catch (RemoteException e) {
     Log.e(TAG, "Remote exception : " + e);
 }

 if ((blockedEdgeScreenFunctions & KioskMode.EDGE_FUNCTION_ALL) > 0) {
     // Edge screen functionalities are blocked on device
 }

 

Since
API level 17
MDM 5.5
Multiuser Environment
Global Scope

public List<Integer> getHardwareKeyList ()

Since: Knox API Level 5

API to get the list of hardware keys available on the device.

Returns
  • List of all available hardware keys on the device. The return value is the number in decimal that corresponds to the hardware key.

    // Sample Output
    // 24 (Volume Down)
    // 25 (Volume Up)
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to determine which keys (and the respective ID) can be blocked with allowHardwareKeys(List, boolean). To obtain the corresponding actions for each Key Id, see Android Developer KeyEvent Page. The number of elements in the list depends on the keys available on the device.

NOTE: This API will only return supported hardware keys on device (not soft keys).

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" permission with a protection level of signature.
Since
API level 5
MDM 3.0
Multiuser Environment
User Scope

public String getKioskHomePackage ()

Since: Knox API Level 5

API to return package name of kiosk home screen.

Returns
  • package name if kiosk mode is enabled, null if kiosk mode is disabled
Usage
If Kiosk Mode is enabled, this API returns the package name of the application set as the kiosk home screen. If kiosk mode is disabled, this API returns null.
Since
API level 5
MDM 3.0
Multiuser Environment
User Scope

public boolean hideNavigationBar (boolean hide)

Since: Knox API Level 6

API to hide the device navigation bar.

Parameters
hide true to hide, false to show
Returns
  • true if successful, else false
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to hide the device navigation bar.

Android 3.0 added the system bar, which resides at the bottom of the screen to provide system navigation (Home, Back and so forth), for tablet devices. The system bar is also an interface for elements traditionally provided by the status bar.

Since Android 4.0 a new type of system UI called the navigation bar is supported. The navigation bar is a re-tuned version of the system bar designed for handsets. The navigation bar provides navigation controls for devices that do not have hardware counterparts for navigating the system but leaves out the system bar's notification UI and setting controls. As such, a device that provides the navigation bar also has the status bar on the top.

The administrator may use hideSystemBar(boolean) to hide/show all bars (status, system, and navigation).

NOTE: Since MDM 5.3, only owner (User 0) administrator can call this API. For guest users, API will return false.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     // hide navigation UI
     kioskModeService.hideNavigationBar(true);

     // show navigation UI
     kioskModeService.hideNavigationBar(false);
 } catch (SecurityException e) {
     Log.e(TAG, "SecurityException: " + e);
 }
 
For Container:

NOTE: Since MDM 5.3, only COM (Kiosk) container administrator can call this API. For other container types, API will return false.

 // 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);
 KioskMode kioskModeService = kcm.getKioskMode();
 try {
     // hide navigation UI
     kioskModeService.hideNavigationBar(true);

     // show navigation UI
     kioskModeService.hideNavigationBar(false);
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

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

public boolean hideStatusBar (boolean hide)

Since: Knox API Level 6

API to hide the device status bar.

Parameters
hide true to hide, false to show
Returns
  • true if successful, else false
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to hide only the device status bar.

The status bar resides at the top of the handset devices to deliver information such as carrier signal, time, notifications, and so forth.

The administrator may use hideSystemBar(boolean) to hide/show all bars (status, system, and navigation).

NOTE: Since MDM 5.3, only owner (User 0) administrator can call this API. For guest users, API will return false.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     // hide status UI
     kioskModeService.hideStatusBar(true);

     // show status UI
     kioskModeService.hideStatusBar(false);
 } catch (SecurityException e) {
     Log.e(TAG, "SecurityException: " + e);
 }
 
For Container:

NOTE: Since MDM 5.3, only COM (Kiosk) container administrator can call this API. For other container types, API will return false.

 // 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);
 KioskMode kioskModeService = kcm.getKioskMode();
 try {
     // hide status UI
     kioskModeService.hideStatusBar(true);

     // show status UI
     kioskModeService.hideStatusBar(false);
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

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

public boolean hideSystemBar (boolean hide)

Since: Knox API Level 5

API to hide the device status bar, system bar, or navigation bar.

Parameters
hide true to hide, false to show
Returns
  • true if successful, false if failed
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to hide the status bar, the system bar, or the navigation bar, depending on the device platform.

The status bar resides at the top of the handset devices to deliver information such as the carrier signal, time, notifications, and so forth.

Android 3.0 added the system bar, which resides at the bottom of the screen, for tablet devices to provide system navigation (Home, Back and so forth). The system bar is also an interface for elements traditionally provided by the status bar.

Since Android 4.0 a new type of system UI called the navigation bar has appeared. The navigation bar is a re-tuned version of the system bar designed for handsets. The navigation bar provides navigation controls for devices that do not have hardware counterparts for navigating the system but leaves out the system bar's notification UI and setting controls. As such, a device that provides the navigation bar also has the status bar on the top.

Warning : This API hides the navigation bars required by users to navigate between screens in Android 3.0 and Android 4.0 devices. Use this API cautiously.

NOTE: Since MDM 5.3, only owner (User 0) administrator can call this API. For guest users, API will return false.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     // hide system ui
     kioskModeService.hideSystemBar(true);

     // show system ui
     kioskModeService.hideSystemBar(false);
 } catch (SecurityException e) {
     Log.e(TAG, "SecurityException: " + e);
 }
 
For Container:

NOTE: Since MDM 5.3, only COM (Kiosk) container administrator can call this API. For other container types, API will return false.

 // 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);
 KioskMode kioskModeService = kcm.getKioskMode();
 try {
     // hide system ui
     kioskModeService.hideSystemBar(true);

     // show system ui
     kioskModeService.hideSystemBar(false);
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" permission with a protection level of signature.
Since
API level 5
MDM 3.0
Multiuser Environment
User Scope

public boolean isAirCommandModeAllowed ()

Since: Knox API Level 13

API to check whether Air Command is allowed.

Returns
  • true if air command is allowed, false otherwise.
Usage
An administrator can use this API to check whether Air Command is allowed. The default value is true (allowed).

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 boolean result = true;
 try {
     // Administrator wants to check if Air Command functionality
     // is allowed or not at device
     result = kioskModeService.isAirCommandModeAllowed();
 } catch (RemoteException e) {
     Log.e(TAG, "Remote exception : " + e);
 }
 

Since
API level 13
MDM 5.2
Multiuser Environment
Global Scope

public boolean isAirViewModeAllowed ()

Since: Knox API Level 13

API to check whether Air View is allowed.

Returns
  • true if air view is allowed, false otherwise.
Usage
An administrator can use this API to check whether Air View is allowed. The default value is true (allowed).

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 boolean result = true;
 try {
     // Administrator wants to check if Air View functionality
     // is allowed or not at device
     result = kioskModeService.isAirViewModeAllowed();
 } catch (RemoteException e) {
     Log.e(TAG, "Remote exception : " + e);
 }
 

Since
API level 13
MDM 5.2
Multiuser Environment
Global Scope

public boolean isHardwareKeyAllowed (int hwKeyId)

Since: Knox API Level 5

API to check whether a hardware key is allowed.

Parameters
hwKeyId The Id that corresponds to the hardware key. A nonhardware key is effectively allowed at runtime, even if it returns false.
Returns
  • true if hardware key is allowed, else false.
Usage
An administrator can use this API to check whether a particular hardware key is allowed. The default value is true (allowed).

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     //administrator wants to check whether volume up key is allowed on device
     int keyCodeVolumeUp = KeyEvent.KEYCODE_VOLUME_UP;
     if (kioskModeService.isHardwareKeyAllowed(keyCodeVolumeUp)) {
         // volume key is allowed on device
     } else {
         // volume key is blocked on device
     }
 } 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);
 KioskMode kioskModeService = kcm.getKioskMode();
 try {
     //administrator wants to check whether volume up key is allowed on device
     int keyCodeVolumeUp = KeyEvent.KEYCODE_VOLUME_UP;
     if (kioskModeService.isHardwareKeyAllowed(keyCodeVolumeUp)) {
         // volume key is allowed on device
     } else {
         // volume key is blocked on device
     }
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

Since
API level 5
MDM 3.0
Multiuser Environment
User Scope

public boolean isKioskModeEnabled ()

Since: Knox API Level 5

API to check whether kiosk mode is enabled.

Returns
  • true if kiosk mode is enabled, false if kiosk mode is disabled
Since
API level 5
MDM 3.0
Multiuser Environment
Global Scope

public boolean isMultiWindowModeAllowed ()

Since: Knox API Level 6

API to check if multi window mode is allowed or not allowed.

Returns
  • true if multi window mode is allowed, false if not.
Usage
Administrator can check whether multi window mode are allowed on device or not. The default value will be true.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     // administrator wants to check if multi window mode is allowed on device or not
     if (kioskModeService.isMultiWindowModeAllowed()) {
         // multi window mode is allowed on device
     } else {
         // multi window mode is blocked on device
     }
 } 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);
 KioskMode kioskModeService = kcm.getKioskMode();
 try {
     // administrator wants to check if multi window mode is allowed on device or not
     if (kioskModeService.isMultiWindowModeAllowed()) {
         // multi window mode is allowed on device
     } else {
         // multi window mode is blocked on device
     }
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean isNavigationBarHidden ()

Since: Knox API Level 6

API to check whether the navigation bar is hidden

Returns
  • true if navigation bar is hidden, else false
Usage
An administrator can use this API to check whether the navigation bar is hidden. The default value is false (visible).
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean isStatusBarHidden ()

Since: Knox API Level 6

API to check whether the status bar is hidden.

Returns
  • true if status bar is hidden, else false
Usage
An administrator can use this API to check whether the status bar is hidden. The default value is false (visible).
Since
API level 6
MDM 4.0
Multiuser Environment
User Scope

public boolean isSystemBarHidden ()

Since: Knox API Level 5

API to check whether the status bar, the system bar, or the navigation bar is hidden.

Returns
  • true if hidden, false if visible
Usage
An administrator can use this API to check whether the the status bar, the system bar, or the navigation bar, depending on the device platform, is hidden. The default value is false (visible).
Since
API level 5
MDM 3.0
Multiuser Environment
User Scope

public boolean isTaskManagerAllowed ()

Since: Knox API Level 5

API to check whether task manager and recent applications are allowed.

Returns
  • true if task manager and recent applications are allowed, else false.
Usage
An administrator can use this API to check whether the task manager application and the recent applications window are allowed. The default value is true (allowed).

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     // administrator wants to check if task manager is allowed on device or not
     if (kioskModeService.isTaskManagerAllowed()) {
         // task manager is allowed on device
     } else {
         // task manager is blocked on device
     }
 } 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);
 KioskMode kioskModeService = kcm.getKioskMode();
 try {
     // administrator wants to check if task manager is allowed on device or not
     if (kioskModeService.isTaskManagerAllowed()) {
         // task manager is allowed on device
     } else {
         // task manager is blocked on device
     }
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

Since
API level 5
MDM 3.0
Multiuser Environment
User Scope

public boolean wipeRecentTasks ()

Since: Knox API Level 5

API to clear recent tasks list.

Returns
  • true if successful, false if failed
Throws
SecurityException If caller does not have required permissions
Usage
An administrator can use this API to clear the device list of recent tasks. The list appears empty when the user views it.
 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 KioskMode kioskModeService = edm.getKioskMode();
 try {
     // clear recent tasks
     kioskModeService.wipeRecentTasks();
 } catch (SecurityException e) {
     Log.e(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);
 KioskMode kioskModeService = kcm.getKioskMode();
 try {
     // clear recent tasks
     kioskModeService.wipeRecentTasks();
 } catch (SecurityException se) {
     Log.e(TAG, "Security Exception : " + se);
 }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_KIOSK_MODE" permission with a protection level of signature.
Since
API level 5
MDM 3.0
Multiuser Environment
User Scope