Knox configure & KPE License

Hello, I am Android developer and I am developing an application with Knox SDK functions for my company. Currently, I am facing some issues, hope you can help me to figure it out.

First, somehow there will be a situation that the Knox function is not working(test function: applicationPolicy.setEnableApplication & applicationPolicy.setDisableApplication).

EnterpriseDeviceManagerService: is permission granted: false
KnoxManager: hide apps Exception: java.lang.SecurityException: Admin does not have android.permission.sec.MDM_APP_MGMT OR com.samsung.android.knox.permission.KNOX_APP_MGMT

Non-fatal Exception: java.lang.SecurityException
Admin does not have android.permission.sec.MDM_APP_MGMT OR com.samsung.android.knox.permission.KNOX_APP_MGMT
android.os.Parcel.createException (Parcel.java:2088)
android.os.Parcel.readException (Parcel.java:2056)
android.os.Parcel.readException (Parcel.java:2004)
com.samsung.android.knox.application.IApplicationPolicy$Stub$Proxy.setApplicationState (IApplicationPolicy.java:4484)
com.samsung.android.knox.application.ApplicationPolicy.setEnableApplication (ApplicationPolicy.java:880)
com.hk180c.parsonkid.knox.knox.KnoxManager.setEnableApplication (KnoxManager.kt:399)
com.hk180c.parsonkid.knox.knox.KnoxJobScheduler.showAllApps (KnoxJobScheduler.kt:914)
com.hk180c.parsonkid.knox.knox.KnoxJobScheduler.access$showAllApps (KnoxJobScheduler.kt:49)
com.hk180c.parsonkid.knox.knox.KnoxJobScheduler$UnLockAppAsyncTask.doInBackground (KnoxJobScheduler.kt:1497)
com.hk180c.parsonkid.knox.knox.KnoxJobScheduler$UnLockAppAsyncTask.doInBackground (KnoxJobScheduler.kt:1487)
android.os.AsyncTask$3.call (AsyncTask.java:378)
java.util.concurrent.FutureTask.run (FutureTask.java:266)
android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:289)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
java.lang.Thread.run (Thread.java:919)

But the fact is I have add those permissions in AndroidManifest.xml. The flow is I am using Knox Configure to set the profile for the device. The Knox Configure Profile will help me to download the application and set up some restriction that had set on the profile and grant app’s device admin. During the setting up of Knox configure Profile on the device, I see a Toast that said “Knox activation success”, that is why I am not going to use KPE license and “KnoxEnterpriseLicenseManager.activateLicense” to activate Knox License, since Knox Configure has done this for me.

I do not know the exact problem is, is it somehow the license get deactivated or permission get missed, until I activate the license again, then the functions work again. When I was facing this issue, I activate the KPE license using “KnoxEnterpriseLicenseManager.activateLicense” in the app by myself before only using Knox Configure, but this is not the efficiency way to fix that issue, since I do not sure when does it will happen. And other way to fix that issue is that I need to reboot the device, then the functions will work again. Those methods are not ideal to fix the issue.

I have tested on two device Samsung A51 & A71. Most likely, the issue was happened on A51. Both devices are only using Knox Configure Profile and not using “KnoxEnterpriseLicenseManager.activateLicense” to activate Knox functions.

Second, I found out that devices with Knox Configure Profile, the searchBar in app page has a problem. When I click or touch the searchBar, all the apps will disappear and a Toast with message “no apps can perform this action” pop up, until I click Home Button, the apps will show up again. the searchBar looks like that is being disabled like using “applicationPolicy.setDisableApplication)”

Those are my findings, hope there is someone can help. Thank you very much.