Atacílio Cunha
Jul 05, 2018
10:10 pm

java.lang.SecurityException: Admin does not have android.permission.sec.MDM_APP_MGMT OR com.samsung.android.knox.permission.KNO

I'm trying to develop a application to test Knox API.

 

I have already Activated Admin and tested ELM License Key. But everytime that my application tries to ask permissions during runtime like the following code (obtained in a Knox sample application) :

List<String> runtimePermissions = new ArrayList<>();
runtimePermissions.add(getResources().getString(R.string.permission));
runtimePermissions.add("com.samsung.android.knox.permission.KNOX_APP_MGMT");
runtimePermissions.add("android.permission.sec.MDM_APP_MGMT");
EnterpriseDeviceManager enterpriseDeviceManager = EnterpriseDeviceManager.getInstance(this);
ApplicationPolicy applicationPolicy = enterpriseDeviceManager.getApplicationPolicy();

AppIdentity appIdentity = new AppIdentity(getApplicationContext().getPackageName(), null);
try {
    int ret = applicationPolicy.applyRuntimePermissions(appIdentity, runtimePermissions, PERMISSION_POLICY_STATE_GRANT);
    if (ret == 0) {
        logView(getResources().getString(R.string.permissions_granted, runtimePermissions.get(0)));

    } else {
        logView(getResources().getString(R.string.permissions_failed));
    }

} catch (Exception e) {
    processException(e);
    e.printStackTrace();
}

 

It shows the following error: 

E/MainActivity: java.lang.SecurityException: Admin  does not have android.permission.sec.MDM_APP_MGMT OR com.samsung.android.knox.permission.KNOX_APP_MGMT
java.lang.SecurityException: Admin  does not have android.permission.sec.MDM_APP_MGMT OR com.samsung.android.knox.permission.KNOX_APP_MGMT
java.lang.SecurityException: Admin  does not have android.permission.sec.MDM_APP_MGMT OR com.samsung.android.knox.permission.KNOX_APP_MGMT
        at android.os.Parcel.readException(Parcel.java:1958)
       at android.os.Parcel.readException(Parcel.java:1904)
       at com.samsung.android.knox.application.IApplicationPolicy$Stub$Proxy.applyRuntimePermissions(IApplicationPolicy.java:7344)
       at com.samsung.android.knox.application.ApplicationPolicy.applyRuntimePermissions(ApplicationPolicy.java:3656)
       at com.samsung.knoxsdksample.MainActivity.GrantPermission(MainActivity.java:216)

 

The following permissions are requested at the AndroidManifest:

<uses-permission android:name="com.samsung.android.knox.permission.KNOX_HW_CONTROL" />
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_APP_MGMT"/>
<uses-permission android:name="com.samsung.android.knox.permission.CUSTOM_SETTING" />
<uses-permission android:name="android.permission.sec.MDM_APP_MGMT"/>

 

How can I solve it?

Similar topics

No similar topics found.
Jenna S.Samsung SEAP Moderator
Jul 10, 2018
8:29 pm

Hello,

Please try generating one of the new SKL keys. It should be able to grant permissions successfully. 

Best regards,

Jenna

Aswathy Rajeevan
Jul 13, 2018
10:04 am

We are generated the SKL production key but still we are facing this issue "Admin does not have com.samsung.android.knox.permission.KNOX_CUSTOM_SETTING OR com.sec.enterprise.knox.permission.CUSTOM_SETTING". we are using knox sdk and able to validate the SKL key.Please find the below log. 

Log:

07-13 15:24:07.785 5442-5442/? D/KLMS-2.7.251:: ErrorMapper(): KLM >> MDM error code: 0|Success.
07-13 15:24:10.780 5442-5442/? D/KLMS-2.7.251:: ErrorMapper(): ELM >> MDM error code: 0|success
07-13 15:24:11.950 5442-5442/? D/KLMS-2.7.251:: ErrorMapper(): ELM >> MDM error code: 0|success
07-13 15:24:11.955 5442-5442/? D/KLMS-2.7.251:: ErrorMapper(): ELM >> MDM error code: 0|success
07-13 15:24:12.310 5442-5442/? D/KLMS-2.7.251:: ErrorMapper(): ELM >> MDM error code: 0|success