0

My app is a system signed Device-owner app, and i would like to set my own app in lock task mode.

However the method in DevicePolicyManager setLockTaskPackages doesn't work for system apps even if its the same app calling.

 if(BuildConfig.DEFAULT_OWNERSHIP.equals(Constants.OWNERSHIP_DEVICE_OWNER)) {
            devicePolicyManager.setLockTaskPackages(componentName, new String[]{context.getPackageName()});            
            startLockTask();
        }

I am looking for a work around for the same in which i am able to set my same app in lock task mode which is system signed

  • "setLockTaskPackages doesn't work for system apps" - is this documented somewhere or do you get an exception or something? Also, I would check devicePolicyManager.isDeviceOwnerApp(getPackageName()) prior to calling setLockTaskPackages and devicePolicyManager.isLockTaskPermitted(getPackageName()) prior to startLockTask(). Any failure may give you a hint. Finally, it looks like you're calling setLockTaskPackages from the activity, right? Try calling it from your receiver or a service. – Steve Miskovetz Apr 01 '19 at 22:22
  • @SteveMiskovetz The only thing it says in the andorid documentation is "System and privileged apps, however, can run in lock task mode without being whitelisted." but is unclear. No significant logs have been seen for the same, https://developer.android.com/work/dpc/dedicated-devices/lock-task-mode I can confirm my app is device owner, themethod isLocktaskPermitted returns true and the same was working on a non-system-signed build. – bhavya Shah Apr 02 '19 at 05:53

0 Answers0