Since: API level 34
public static class

KnoxContract.Config.Application

extends Object
java.lang.Object
   ↳ com.samsung.android.knox.ex.KnoxContract.Config.Application

Deprecated in API level 37

Class Overview

This class provides application policy


Specific Policy

Summary

Constants
String CONTENT_URI_STRING
String ID
String KEY_DEFAULT_APPS Deprecated in API level 37
String KEY_PACKAGE_BATTERY_OPTIMIZATION_ALLOW_LIST Deprecated in API level 37
String KEY_USB_DEVICES_FOR_DEFAULT_ACCESS Deprecated in API level 37
String PARAM_PACKAGE_BATTERY_OPTIMIZATION_ALLOW_LIST
String PARAM_PACKAGE_NAME
String PARAM_PRODUCT_ID
int PARAM_PRODUCT_ID_COLUMN_INDEX
String PARAM_ROLE_NAME
String PARAM_VENDOR_ID
int PARAM_VENDOR_ID_COLUMN_INDEX
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String CONTENT_URI_STRING

Since: API level 34

Constant Value: "content://com.samsung.android.knox.sdk/config/application"

public static final String ID

Since: API level 34

Constant Value: "application"

public static final String KEY_DEFAULT_APPS

Since: API level 34

Deprecated in API level 37

API to remove default digital assistant


    Param

Usage
 Uri uri = Uri.parse("content://com.samsung.android.knox.sdk/config/application");
 String selection = "key=? AND role-name=?";
 String[] selectionArgs = new String[] {"default-apps", "android.app.role.ASSISTANT"};
 mContext.getContentResolver().delete(uri, selection, selectionArgs);
 
Since
API level 34
Knox 3.7.1
Permission
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_DEVICE_SETTINGS_RT" permission.
See Also
  • android.app.role.RoleManager
Constant Value: "default-apps"

public static final String KEY_PACKAGE_BATTERY_OPTIMIZATION_ALLOW_LIST

Since: API level 34

Deprecated in API level 37

API to manage a package for the Battery Optimization allow list.


    Param

Usage
 Uri uri = Uri.parse("content://com.samsung.android.knox.sdk/config/application");
 ContentValues contentValues = new ContentValues();
 contentValues.put("package-battery-optimization-allow-list", "com.android.settings");
 String selection = "key=?";
 String[] selectionArgs = new String[] {"package-battery-optimization-allow-list"};
 mContext.getContentResolver().update(uri, contentValues, selection, selectionArgs);

 Uri uri = Uri.parse("content://com.samsung.android.knox.sdk/config/application");
 String selection = "key=? AND package-name=?";
 String[] selectionArgs = new String[] {"package-battery-optimization-allow-list", "com.android.settings"};
 mContext.getContentResolver().delete(uri, selection, selectionArgs);

 Uri uri = Uri.parse("content://com.samsung.android.knox.sdk/config/application");
 String selection = "key=?";
 String[] selectionArgs = new String[] {"package-battery-optimization-allow-list"};
 Cursor cursor = mContext.getContentResolver().query(uri, null, selection, selectionArgs, null);
 ArrayList<String> allowList = new ArrayList<>();
 if (cursor != null) {
     cursor.moveToFirst();
     do {
         allowList.add(cursor.getString(0));
     } while (cursor.moveToNext());
 }
 
Since
API level 34
Knox 3.7.1
Permission
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_DEVICE_SETTINGS_RT" permission.
Constant Value: "package-battery-optimization-allow-list"

public static final String KEY_USB_DEVICES_FOR_DEFAULT_ACCESS

Since: API level 34

Deprecated in API level 37

API to grant user permission for one usb device to be used by a particular package


    Param

Usage
 Uri uri = Uri.parse("content://com.samsung.android.knox.sdk/config/application");
 ContentValues contentValues = new ContentValues();
 contentValues.put("package-name", "com.android.settings");
 contentValues.put("vendor-id", "1455");
 contentValues.put("product-id", "2050");
 String selection = "key=?";
 String[] selectionArgs = new String[] {"usb-devices-for-default-access"};
 mContext.getContentResolver().update(uri, contentValues, selection, selectionArgs);

 Uri uri = Uri.parse("content://com.samsung.android.knox.sdk/config/application");
 String selection = "key=? AND package-name=?";
 String[] selectionArgs = new String[] {"usb-devices-for-default-access", "com.android.settings"};
 mContext.getContentResolver().delete(uri, selection, selectionArgs);

 class UsbDeviceConfig {
     int vendorId;
     int productId;
 }

 Uri uri = Uri.parse("content://com.samsung.android.knox.sdk/config/application");
 String selection = "key=? AND package-name=?";
 String[] selectionArgs = new String[] {"usb-devices-for-default-access", "com.android.settings"};
 Cursor cursor = mContext.getContentResolver().query(uri, null, selection, selectionArgs, null);
 ArrayList<UsbDeviceConfig> usbDevices = new ArrayList<>();
 if (cursor != null) {
     cursor.moveToFirst();
     do {
         UsbDeviceConfig usbDevice = new UsbDeviceConfig();
         usbDevice.vendorId = cursor.getInt(0);
         usbDevice.productId = cursor.getInt(1);
         usbDevices.add(usbDevice);
     } while (cursor.moveToNext());
 }
 
Since
API level 34
Knox 3.7.1
Permission
The use of this feature requires the caller to have the "com.samsung.android.knox.permission.KNOX_NDA_DEVICE_SETTINGS_RT" permission.
Constant Value: "usb-devices-for-default-access"

public static final String PARAM_PACKAGE_BATTERY_OPTIMIZATION_ALLOW_LIST

Since: API level 34

Constant Value: "package-battery-optimization-allow-list"

public static final String PARAM_PACKAGE_NAME

Since: API level 34

Constant Value: "package-name"

public static final String PARAM_PRODUCT_ID

Since: API level 34

Constant Value: "product-id"

public static final int PARAM_PRODUCT_ID_COLUMN_INDEX

Since: API level 34

Constant Value: 1 (0x00000001)

public static final String PARAM_ROLE_NAME

Since: API level 34

Constant Value: "role-name"

public static final String PARAM_VENDOR_ID

Since: API level 34

Constant Value: "vendor-id"

public static final int PARAM_VENDOR_ID_COLUMN_INDEX

Since: API level 34

Constant Value: 0 (0x00000000)