Since: API level 17
public class

ProKioskManager

extends Object
java.lang.Object
   ↳ com.samsung.android.knox.custom.ProKioskManager

Class Overview

This class provides APIs to control device in ProKiosk mode.
The API will return ERROR_FAIL, if the API fails for an unknown reason or because the service was not available.

NOTE: Since version 2.5, the architecture of the SDK changed.
Now, all APIs are members of different classes according to their permission type. (APIs with permission type KNOX_CUSTOM_PROKIOSK, KNOX_CUSTOM_SETTING & KNOX_CUSTOM_SYSTEM are placed in ProKioskManager, SettingsManager & SystemManager classes respectively).
Additionally, a main interface class has been created, CustomDeviceManager, which allows public access to the above classes and provides some utility APIs.

Since
API level 17
Version 2.5

Summary

Public Methods
String getExitUI(int stringType)
This method gets the exit UI package name or class name.
boolean getHardKeyIntentState()
Deprecated in API level 35
NOTE: This API is not available since android 14.
int getHideNotificationMessages()
This method gets the mask that determines which notification messages will be hidden from the user when in ProKiosk mode.
String getHomeActivity()
This method gets the home activity package when the device is in ProKiosk Home.
boolean getInputMethodRestrictionState()
This method gets the input method restriction state when the device is in ProKiosk mode.
List<PowerItem> getPowerDialogCustomItems()
This method gets the custom items currently set for power dialog option.
boolean getPowerDialogCustomItemsState()
Return the current status of the power dialog custom items.
int getPowerDialogItems()
This method gets the turned on items in power dialog screen as a bit-mask.
int getPowerDialogOptionMode()
This method gets the ProKiosk mode power off dialog option mode.
boolean getProKioskState()
This method gets the ProKiosk mode state of the device.
String getProKioskString(int stringType)
This method gets the specified ProKiosk mode string.
int getSettingsEnabledItems()
This method gets the currently turned on UI elements in ProKiosk mode in the Settings app on the device.
boolean getStatusBarClockState()
This method gets the display state of the clock on the status bar.
boolean getStatusBarIconsState()
This method gets the display state of the notification icons on the status bar.
int getStatusBarMode()
This method gets the state of the status bar.
boolean getStatusBarNotificationsState()
Deprecated in API level 35
boolean getUsbMassStorageState()
Deprecated in API level 35
NOTE: This API is not available since android 14.
String getUsbNetAddress(int addressType)
Deprecated in API level 35
NOTE: This API is not available since android 14.
boolean getUsbNetState()
Deprecated in API level 35
NOTE: This API is not available since android 14.
boolean getVolumeKeyAppState()
This method gets the state of Volume Key app switching.
List<String> getVolumeKeyAppsList()
This method gets the list of apps to be cycled with the volume keys if Volume Key app switching is turned on in ProKiosk mode.
int setExitUI(String exitUIPackage, String exitUIClass)
This method sets the UI class to be called when exiting ProKiosk mode.
int setHardKeyIntentState(boolean state)
Deprecated in API level 35
NOTE: This API is not available since android 14.
int setHideNotificationMessages(int mask)
This method turns on/off individual system notification messages displayed to the user in when the device is in ProKiosk mode.
int setHomeActivity(String homePackage)
This method sets the activity that is activated when the home button is pressed while the device is in ProKiosk mode.
int setInputMethodRestrictionState(boolean state)
This method restrict the user from changing the input method type in ProKiosk mode.
int setPassCode(String currentPassCode, String passCode)
This method allows the pass code provided in the setProKioskState(boolean, String) method to be modified.
int setPowerDialogCustomItems(List<PowerItem> item)
This method sets the power dialog custom items, this will clear previously assigned items.
int setPowerDialogCustomItemsState(boolean state)
This method turn on or turn off the power dialog custom items.
int setPowerDialogItems(int value)
This method turns on/off individual items displayed in the power dialog screen.
int setPowerDialogOptionMode(int mode)
When the power button is long pressed, a dialog is displayed containing the option to turn off ProKiosk mode if ProKiosk mode is active.
int setProKioskState(boolean status, String passCode)
Deprecated in API level 35
NOTE: This API is not available since android 14.
int setProKioskString(int stringType, String stringValue)
When the power button is long pressed, a dialog is displayed containing the option to turn off ProKiosk mode if ProKiosk mode is active.
int setSettingsEnabledItems(boolean state, int elements)
This method turns on/off UI elements in ProKiosk mode in the Settings app on the device.
int setStatusBarClockState(boolean state)
This method shows or hides the display of the clock on the status bar.
int setStatusBarIconsState(boolean state)
This method shows or hides the display of the notification icons on the status bar.
int setStatusBarMode(int mode)
This method shows or hides the status bar.
int setStatusBarNotificationsState(boolean state)
Deprecated in API level 35
int setUsbMassStorageState(boolean state)
Deprecated in API level 35
NOTE: This API is not available since android 14.
int setUsbNetAddresses(String sourceAddress, String destinationAddress)
Deprecated in API level 35
NOTE: This API is not available since android 14.
int setUsbNetState(boolean status)
Deprecated in API level 35
NOTE: This API is not available since android 14.
int setVolumeKeyAppState(boolean state)
This method turns on/off volume key app switching in ProKiosk mode.
int setVolumeKeyAppsList(List<String> appList)
This method sets (or clears) the list of apps to be cycled with the volume keys if Volume Key app switching is turned on in ProKiosk mode.
int startProKioskMode(String packageName, String passCode)
This method turns on the ProKiosk mode functionality.
int stopProKioskMode(String passCode)
This method turns off the ProKiosk mode functionality.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public String getExitUI (int stringType)

Since: API level 17

This method gets the exit UI package name or class name. The default package and class point to the built-in password entry screen.

Parameters
stringType The value to return: PACKAGE_STRING or CLASS_STRING.
Returns
  • String for specified stringType parameter.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 String exitUiPackage = kcpkm.getExitUI(CustomDeviceManager.PACKAGE_STRING);
 String exitUiClass = kcpkm.getExitUI(CustomDeviceManager.CLASS_STRING);
 
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public boolean getHardKeyIntentState ()

Since: API level 17

Deprecated in API level 35
NOTE: This API is not available since android 14.

This method gets the state of hard key intent reporting.

Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 if (kcpkm.getHardKeyIntentState()) {
     Log.d(TAG, "Hard key intents are turned on in ProKiosk mode");
 }
 
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int getHideNotificationMessages ()

Since: API level 17

This method gets the mask that determines which notification messages will be hidden from the user when in ProKiosk mode. The default value for the mask zero (all notifications displayed).

Returns
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 if (kcpkm.getHideNotificationMessages() &
     CustomDeviceManager.NOTIFICATIONS_BATTERY_LOW != 0) {
     Log.d(TAG, "Battery Low Warning Notification is turned off in ProKiosk mode");
 }
 
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public String getHomeActivity ()

Since: API level 17

This method gets the home activity package when the device is in ProKiosk Home.

Returns
  • The package name string (or null if the package has not been set).
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 String HomeActivity = kcpkm.getHomeActivity();
 
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public boolean getInputMethodRestrictionState ()

Since: API level 17

This method gets the input method restriction state when the device is in ProKiosk mode. The default input method restriction state is turned off.

Returns
  • true if input method switching is restricted, false if not.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 if (kcpkm.getInputMethodRestrictionState()) {
     Log.d(TAG, "input Method Restriction is on");
 }
 
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public List<PowerItem> getPowerDialogCustomItems ()

Since: API level 17

This method gets the custom items currently set for power dialog option.

Returns
  • The list of custom items.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 ArrayList list = kcpkm.getPowerDialogCustomItems();
 for (PowerItem item : list) {
     Log.d(TAG, "Text:"+ item.getText());
 }
 
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public boolean getPowerDialogCustomItemsState ()

Since: API level 17

Return the current status of the power dialog custom items.

Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 if (kcpkm.getPowerDialogCustomItemsState()) {
     Log.d(TAG, "Custom items  on");
 }
 
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int getPowerDialogItems ()

Since: API level 17

This method gets the turned on items in power dialog screen as a bit-mask.

Returns
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 int mask = kcpkm.getPowerDialogItems();
 if(mask & CustomDeviceManager.POWER_DIALOG_POWEROFF !=  0) {
     Log.d(TAG, "POWEROFF turned on in ProKiosk mode");
 }
 
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int getPowerDialogOptionMode ()

Since: API level 17

This method gets the ProKiosk mode power off dialog option mode. The default ProKiosk mode power off dialog option mode is SHOW.

Returns
  • SHOW The ProKiosk mode option will be shown in the power dialog.
    HIDE The ProKiosk mode option will be shown in the power dialog only after the volume up key has been pressed.
    OFF The ProKiosk mode option not will be shown in the power dialog.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 if (kcpkm.getPowerDialogOptionMode() == CustomDeviceManager.HIDE) {
     Log.d(TAG, "ProKiosk mode option in power off dialog is hidden");
 }
 
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public boolean getProKioskState ()

Since: API level 17

This method gets the ProKiosk mode state of the device. The default ProKiosk mode state is false.

Returns
  • true if the device is in ProKiosk mode, false if not.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 if (kcpkm.getProKioskState()) {
     Log.d(TAG, "ProKiosk mode is on");
 }
 
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public String getProKioskString (int stringType)

Since: API level 17

This method gets the specified ProKiosk mode string.

Parameters
stringType The string to return: PRO_KIOSK_OPTION_STRING, PRO_KIOSK_ON_STRING or PRO_KIOSK_OFF_STRING.
Returns
  • String for specified stringType parameter.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 String proKioskModeOnString =
     kcpkm.getProKioskString(CustomDeviceManager.PRO_KIOSK_ON_STRING);
 
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int getSettingsEnabledItems ()

Since: API level 17

This method gets the currently turned on UI elements in ProKiosk mode in the Settings app on the device.

Returns
  • The turned on elements as a mask.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 int elements = kcpkm.getSettingsEnabledItems();
 Log.d("Wi-Fi setting: " + (((elements & CustomDeviceManager.PRO_KIOSK_SETTINGS_WIFI) != 0) ? "enabled" : "disabled"));
 Log.d("Bluetooth setting: " + (((elements & CustomDeviceManager.PRO_KIOSK_SETTINGS_BLUETOOTH) != 0) ? "enabled" : "disabled"));
 // etc.
 
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public boolean getStatusBarClockState ()

Since: API level 17

This method gets the display state of the clock on the status bar. The default status bar icon state is true (show).

Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 if (kcpkm.getStatusBarClockState()) {
     Log.d(TAG, "Clock is shown on status bar");
 }
 
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public boolean getStatusBarIconsState ()

Since: API level 17

This method gets the display state of the notification icons on the status bar. The default status bar icon state is true (show).

Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 if (kcpkm.getStatusBarIconsState()) {
     Log.d(TAG, "Icons are shown on status bar");
 }
 
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int getStatusBarMode ()

Since: API level 17

This method gets the state of the status bar. The default status bar mode is SHOW.

Returns
  • SHOW The status bar is shown (but not usable).
    HIDE The status bar is hidden.
    DEFAULT The status bar is in its default state.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 if (kcpkm.getStatusBarMode() == CustomDeviceManager.HIDE) {
     Log.d(TAG, "Status bar is hidden");
 }
 
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public boolean getStatusBarNotificationsState ()

Since: API level 17

Deprecated in API level 35

This method gets the display state of Notifications and ability to expand the status bar. The default status bar Notifications state is true (show).

Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcsm = cdm.getProKioskManager();
 if (kcsm.getStatusBarNotificationsState()) {
     Log.d(TAG, "Notifications are shown on status bar");
 }
 
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public boolean getUsbMassStorageState ()

Since: API level 17

Deprecated in API level 35
NOTE: This API is not available since android 14.

This method gets the USB mass storage (MTP) state when the device is connected to a PC.

Returns
  • true if the device acts as a mass storage device, false if not.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 if (kcpkm.getUsbMassStorageState()) {
     Log.d(TAG, "USB mass storage (MTP) is on");
 }
 
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public String getUsbNetAddress (int addressType)

Since: API level 17

Deprecated in API level 35
NOTE: This API is not available since android 14.

This method gets the source or destination IP address for the USB Net functionality. The function returns null if the address has not been set.

Parameters
addressType The address to retrieve: SOURCE_ADDRESS or DESTINATION_ADDRESS.
Returns
  • IP Address string for specified addressType or null if the address has not been set.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 String sourceAddress = kcpkm.getUsbNetAddress(CustomDeviceManager.SOURCE_ADDRESS);
 
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public boolean getUsbNetState ()

Since: API level 17

Deprecated in API level 35
NOTE: This API is not available since android 14.

This method gets the USB Net functionality state. By default, the USB Net state is turned off.

Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 if (kcpkm.getUsbNetState()) {
     Log.d(TAG, "USB Net functionality is on");
 }
 
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public boolean getVolumeKeyAppState ()

Since: API level 17

This method gets the state of Volume Key app switching.

Returns
  • true if on, false if off.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 if (kcpkm.getVolumeKeyAppState()) {
     Log.d(TAG, "Volume Key app switching is on");
 }
 
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public List<String> getVolumeKeyAppsList ()

Since: API level 17

This method gets the list of apps to be cycled with the volume keys if Volume Key app switching is turned on in ProKiosk mode.

Returns
  • The list of applications to be cycled through. This list will be null, if not set.
Usage
 CustomDeviceManager cdm = CustomDeviceManager.getInstance();
 ProKioskManager kcpkm = cdm.getProKioskManager();
 List list = kcpkm.getVolumeAppsList();
 for(String item : list) {
     Log.d(TAG, "App name: " + item);
 }
 
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setExitUI (String exitUIPackage, String exitUIClass)

Since: API level 17

This method sets the UI class to be called when exiting ProKiosk mode. The package and the class name should point at an activity that provides a method to enter a PIN/password and exit the ProKiosk mode. If the class does not exist, the built-in UI screen is used instead.

Parameters
exitUIPackage The package name of the activity to be displayed. If this is null, the default screen will be used.
exitUIClass The class name for the activity to be displayed. If this is null, the default screen will be used.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     String exitUIPackage = "com.example.mypackage";
     String exitUIClass = "com.example.mypackage.customui";
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setExitUI(exitUIPackage, exitUIClass);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setHardKeyIntentState (boolean state)

Since: API level 17

Deprecated in API level 35
NOTE: This API is not available since android 14.

This method turns on/off hard key intent reporting in ProKiosk mode.
If this state is turned on, and the device is in ProKiosk mode with the screen on, then the device will broadcast the intent -
ACTION_HARD_KEY_PRESS EXTRA_KEY_CODE, specifying the actual key pressed.
The keys that are responded to are -
KeyEvent.KEYCODE_VOLUME_UP
KeyEvent.KEYCODE_VOLUME_DOWN
KeyEvent.KEYCODE_HOME
KeyEvent.KEYCODE_BACK
KeyEvent.KEYCODE_MENU
KeyEvent.KEYCODE_APP_SWITCH
KeyEvent.KEYCODE_POWER

Parameters
state true to turn on, false to turn off.
Returns
  • SUCCESS The state was successfully set.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setHardKeyIntentState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setHideNotificationMessages (int mask)

Since: API level 17

This method turns on/off individual system notification messages displayed to the user in when the device is in ProKiosk mode. The mask allows individual notification messages such as low battery warning to be shown/hidden.
NOTE: The specified notifications are hidden when the bit in the mask is set to 1.
NOTE: CustomDeviceManager.NOTIFICATIONS_SAFE_VOLUME is no longer supported for legal reasons.

Parameters
mask Specified notification elements as a mask.
NOTIFICATIONS_BATTERY_LOW |
NOTIFICATIONS_BATTERY_FULL |
NOTIFICATIONS_STATUS_BAR |
NOTIFICATIONS_NITZ_SET_TIME |
NOTIFICATIONS_ALL (= all of the above)
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     int mask = CustomDeviceManager.NOTIFICATIONS_BATTERY_LOW | CustomDeviceManager.NOTIFICATIONS_STATUS_BAR;
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setHideNotificationMessages(mask);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int setHomeActivity (String homePackage)

Since: API level 17

This method sets the activity that is activated when the home button is pressed while the device is in ProKiosk mode. When the ProKiosk mode is exited, the normal home application is returned as the default home application.
NOTE: The device must be rebooted for this change to take full effect unless the specified application overrides the Activity.onBackPressed() function.

NOTE: This feature should be tested before deploying. Some applications take quite a time to start and this can cause undesirable behavior when selecting the home application. To workaround this feature, a small application can be started that immediately launches the required application and then exits.

Parameters
homePackage The name of the package to be set as the home application. If this is null, the default home application will be used.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     String homePackage = "com.example.mypackage";
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setHomeActivity(homePackage);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setInputMethodRestrictionState (boolean state)

Since: API level 17

This method restrict the user from changing the input method type in ProKiosk mode.

Parameters
state true to turn on restriction and prevent the user from switching input types, false to turn off the restriction.
Returns
  • SUCCESS The restriction was set successfully.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setInputMethodRestrictionState(true);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setPassCode (String currentPassCode, String passCode)

Since: API level 17

This method allows the pass code provided in the setProKioskState(boolean, String) method to be modified. The current pass code will need to be provided for security.

Parameters
currentPassCode The current pass code required for security.
passCode The updated pass code to be used when exiting ProKiosk mode.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     String oldPassCode = "12345";
     String newPassCode = "56789";
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setPassCode(oldPassCode, newPassCode);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setPowerDialogCustomItems (List<PowerItem> item)

Since: API level 17

This method sets the power dialog custom items, this will clear previously assigned items. The items are stored persistently.

Parameters
item List has to be less than 5 items, in case of empty or null the current custom items will be deleted.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
  CustomDeviceManager cdm = CustomDeviceManager.getInstance();
  ProKioskManager kcpkm = cdm.getProKioskManager();

  Intent intent = new Intent();
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  intent.setClassName("com.company.testapp",
      "com.company.testapp.testactivity");
  try {
      ArrayList list = new ArrayList();

      PowerItem object = new PowerItem(0,
                (BitmapDrawable) getResources().getDrawable(com.company.testapp.R.drawable.icon),
                intent,
                PowerItem.ACTION_START_ACTIVITY,
                "ACTION_START_ACTIVITY");
        list.add(object);
        object = new PowerItem(1,
                (BitmapDrawable) getResources().getDrawable(com.company.testapp.R.drawable.icon),
                intent,
                PowerItem.ACTION_SEND_BROADCAST,
                "ACTION_SEND_BROADCAST");
        list.add(object);
        object = new PowerItem(2,
                (BitmapDrawable) getResources().getDrawable(com.company.testapp.R.drawable.icon),
                intent,
                PowerItem.ACTION_SEND_STICKY_BROADCAST,
                "ACTION_SEND_STICKY_BROADCAST");
       list.add(object);

      if( kcpkm.setPowerDialogCustomItems(list) != CustomDeviceManager.SUCCESS ) {
          Log.d(TAG, "set custom items FAIL or INVALID_LENGTH");
      }
  } catch(SecurityException ex) {
      ex.printStackTrace();
  }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int setPowerDialogCustomItemsState (boolean state)

Since: API level 17

This method turn on or turn off the power dialog custom items.

Parameters
state true to turn on, false to turn off.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     if (kcpkm.setPowerDialogCustomItemsState(true) == CustomDeviceManager.SUCCESS) {
         Log.d(TAG, "Custom items  on");
     }
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int setPowerDialogItems (int value)

Since: API level 17

This method turns on/off individual items displayed in the power dialog screen.

NOTE: Not all of the flags work on all devices.

Parameters
value Bit-mask value as below -
POWER_DIALOG_POWEROFF |
POWER_DIALOG_RESTART |
POWER_DIALOG_EMERGENCY |
POWER_DIALOG_BUGREPORT |
POWER_DIALOG_ALL | (=all of the above)
POWER_DIALOG_NONE | (=none of the above)
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     int mask = CustomDeviceManager.POWER_DIALOG_POWEROFF | CustomDeviceManager.POWER_DIALOG_RESTART;
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setPowerDialogItems(mask);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 2.0
Multiuser Environment
Global Scope

public int setPowerDialogOptionMode (int mode)

Since: API level 17

When the power button is long pressed, a dialog is displayed containing the option to turn off ProKiosk mode if ProKiosk mode is active. This method allows the option mode to be set to show, hide or turned off. If the mode is set to hide, the menu option is not shown until the volume up key is pressed.

Parameters
mode The mode for the option string: SHOW, HIDE or OFF.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setPowerDialogOptionMode(CustomDeviceManager.HIDE);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setProKioskState (boolean status, String passCode)

Since: API level 17

Deprecated in API level 35
NOTE: This API is not available since android 14.

This method turns on/off the ProKiosk mode functionality. ProKiosk mode generally restricts the device to a single application and restricts the functionality of the device.

NOTE: This feature should be tested before deploying. Some applications take quite a time to start and this can cause undesirable behavior when selecting the home application. As a workaround, a small application can be started that immediately launches the required application and then exits.

Parameters
status true to turn on, false to turn off.
passCode If ProKiosk mode is being turned on, sets the pass code to be used to exit.
If ProKiosk mode is being turned off, specifies the pass code to be validated against the pass code originally supplied.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     String defaultPassCode = "12345";
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setProKioskState(true, defaultPassCode);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setProKioskString (int stringType, String stringValue)

Since: API level 17

When the power button is long pressed, a dialog is displayed containing the option to turn off ProKiosk mode if ProKiosk mode is active. This method allows the strings that are displayed to be modified. The string specified by stringType will be modified.

Parameters
stringType The string value to be modified: PRO_KIOSK_OPTION_STRING, PRO_KIOSK_ON_STRING or PRO_KIOSK_OFF_STRING.
stringValue The new value for the string. If the value is null, the default value will be used.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     String proKioskModeOnString = "ProKiosk mode is Active";
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setProKioskString(CustomDeviceManager.PRO_KIOSK_ON_STRING, proKioskModeOnString);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setSettingsEnabledItems (boolean state, int elements)

Since: API level 17

This method turns on/off UI elements in ProKiosk mode in the Settings app on the device.

Parameters
state true to turn on the specified UI elements, false to turn them off.
elements The specified elements as a mask, or PRO_KIOSK_SETTINGS_ALL to turn on (or turn off) all available elements.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setSettingsEnabledItems(true, CustomDeviceManager.PRO_KIOSK_SETTINGS_WIFI |
      CustomDeviceManager.PRO_KIOSK_SETTINGS_BLUETOOTH);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setStatusBarClockState (boolean state)

Since: API level 17

This method shows or hides the display of the clock on the status bar.

Parameters
state true to show the clock, false to hide it.
Returns
  • SUCCESS The clock state was set successfully.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setStatusBarClockState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setStatusBarIconsState (boolean state)

Since: API level 17

This method shows or hides the display of the notification icons on the status bar.

Parameters
state true to show the notification icons, false to hide them.
Returns
  • SUCCESS The notification icons state was set successfully.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setStatusBarIconState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setStatusBarMode (int mode)

Since: API level 17

This method shows or hides the status bar. If the status bar is hidden in normal mode, every application will use the entire display space for itself. Notifications will therefore be hidden from the user. The status bar will still be available if you drag it down. Soft Navigation bar will be hidden from the user as well and available if you drag it up.

Parameters
mode The status bar mode: SHOW or HIDE.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setStatusBar(CustomDeviceManager.HIDE);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setStatusBarNotificationsState (boolean state)

Since: API level 17

Deprecated in API level 35

This method shows or hides the display of Notifications and ability to expand the status bar.

Parameters
state true to show the notifications, false to hide them.
Returns
  • SUCCESS The notifications state was set successfully.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcsm = cdm.getProKioskManager();
     kcsm.setStatusBarNotificationsState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setUsbMassStorageState (boolean state)

Since: API level 17

Deprecated in API level 35
NOTE: This API is not available since android 14.

This method turns on/off USB mass storage (MTP) when the device is connected to a PC.

Parameters
state true to turn on mass storage, false to turn it off .
Returns
  • SUCCESS The mass storage state was changed.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setUsbMassStorageState(false);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setUsbNetAddresses (String sourceAddress, String destinationAddress)

Since: API level 17

Deprecated in API level 35
NOTE: This API is not available since android 14.

This method sets source and destination IP addresses for the USB Net functionality.

Parameters
sourceAddress The source IP address.
destinationAddress The destination IP address.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     String sourceAddress = "10.43.48.100";
     String destinationAddress = "10.43.48.101";
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setUsbNetAddresses(sourceAddress, destinationAddress);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setUsbNetState (boolean status)

Since: API level 17

Deprecated in API level 35
NOTE: This API is not available since android 14.

This method turns on/off the USB Net functionality. USB Net functionality offers Ethernet connectivity over USB using pre-configured fixed IP addresses.
NOTE: Enabling USB Net functionality automatically disables the USB mass storage setting. Also, USB Net functionality cannot be turned on if USB Debugging mode is active.

Parameters
status true to turn on USB Net, false to turn it off.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setUsbNetState(true);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 1.0
Multiuser Environment
Global Scope

public int setVolumeKeyAppState (boolean state)

Since: API level 17

This method turns on/off volume key app switching in ProKiosk mode.
When turned on, the hard volume keys will cycle between the packages named in the Volume Key Apps List with setVolumeKeyAppsList(List).

Parameters
state true to turn on, false to turn off.
Returns
  • SUCCESS The state was set successfully.
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.setVolumeKeyAppState(true);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int setVolumeKeyAppsList (List<String> appList)

Since: API level 17

This method sets (or clears) the list of apps to be cycled with the volume keys if Volume Key app switching is turned on in ProKiosk mode.
NOTE: Errors are only returned if a list item is not a syntactically valid package name. A package which does not exist, or which has no launch activity, will be accepted in the app list, but will simply be ignored in the volume key cycle.
NOTE: If volume key app switching is turned on, and the list is empty or null, or contains no existing or launchable apps, then the volume keys are effectively turned off in ProKiosk mode.

Parameters
appList The list of apps (can be empty or null).
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     ArrayList appList = new ArrayList();
     appList.add("com.android.mms");
     appList.add("com.android.contacts");
     appList.add("com.android.chrome");
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     if( kcpkm.setVolumeKeyAppsList(appList) != CustomDeviceManager.SUCCESS ) {
         Log.d(TAG, "set volume apps list failed");
     }
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 17
Version 2.5
Multiuser Environment
Global Scope

public int startProKioskMode (String packageName, String passCode)

Since: API level 26

This method turns on the ProKiosk mode functionality. ProKiosk mode generally restricts the device to a single application and restricts the functionality of the device.

NOTE: This feature should be tested before deploying. Some applications take quite a time to start and this can cause undesirable behavior when selecting the home application. As a workaround, a small application can be started that immediately launches the required application and then exits.

Parameters
passCode The pass code to be used to exit prokiosk mode.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     String defaultPassCode = "12345";
     String pkgName = "com.sec.android.app.sbrowser";
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.startProKioskMode(pkgName, defaultPassCode);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 26
KNOX 3.2
Multiuser Environment
Global Scope

public int stopProKioskMode (String passCode)

Since: API level 26

This method turns off the ProKiosk mode functionality. ProKiosk mode generally restricts the device to a single application and restricts the functionality of the device.

Parameters
passCode The pass code to be used to exit prokiosk mode.
Returns
Throws
SecurityException The calling application does not have the required permission.
Usage
 try {
     String defaultPassCode = "12345";
     CustomDeviceManager cdm = CustomDeviceManager.getInstance();
     ProKioskManager kcpkm = cdm.getProKioskManager();
     kcpkm.stopProKioskMode(defaultPassCode);
 } catch(SecurityException e) {
     Log.w(TAG, "SecurityException:" + e);
 }
 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_CUSTOM_PROKIOSK" permission.
Since
API level 26
KNOX 3.2
Multiuser Environment
Global Scope