In my custom DPC app (which is configured as device owner), I would like to set a third-party app in kiosk mode.
I did some tests with DevicePolicyManager.addPersistentPreferredActivity() but it seems to only work if the target app is a launcher, i.e if the provided component is an activity that supports the HOME and DEFAULT intent categories. But I need it to work with any app.
Google DPC Android Device Policy can make it, as explained in "Apps that don't support lock task mode" by providing only the package name (not the full activity component name) in the persistentPreferredActivities
section of the policy. Therefore I assume that it is possible to do it in my DPC, but how ?
The solution I have found is to set the DPC as the default launcher, and auto-start the third-party app from the DPC.