0

I am using Android Management API to run my APP in Kiosk Mode. It's relying on a USB Device to work correctly, but the prompt for accepting the connection throws an LOCK TASK MODE VIOLATION Error. At this moment my App gets stuck (propably since the authorization prompt can't be displayed) and can only be reset by reboot.

As explained in this post you can whitelist com.android.systemui, but how can this be applied to the Android Management API?

  • Hello, can you add code snippet, so you could get help faster – Sana'a Al-ahdal Mar 03 '21 at 21:04
  • There is no actual code snippet, because the error is not caused by custom code. It seems to be default behaviour from Android in Lock Task Mode, which itself is configured by an Android Management API Policy. The specify my question: Is there a way to access the DevicePolicyManager used by the Android-Management API, to whitelist com.android.systemui? – Philipp Alker Mar 04 '21 at 17:07
  • Uh sorry, I really don't know, but hope you get what yy want as fast as possible – Sana'a Al-ahdal Mar 04 '21 at 19:25

1 Answers1

2

Alright, i figured it out. I reread this section of the management api documentation. Seems like this is the way to "whitelist" apps for Lock Task Mode, although it's a bit misleading.

So you simply just add the packages as "FORCE_INSTALLED" to your policy, even already installed packages from your system. So in my case:

{
...
"applications": [
 {
   "packageName": "com.example.app",
   "installType": "KIOSK",
   "defaultPermissionPolicy": "GRANT"
 },
 {
   "packageName": "com.android.systemui",
   "installType": "FORCE_INSTALLED",
   "defaultPermissionPolicy": "GRANT"
 }
]
}