How to find application access for DevicePolicyManager.setApplicationRestrictions

The new Android Lollipop API provides a new pair of methods for getting and setting restrictions for other applications: DevicePolicyManager.getApplicationRestrictions and DevicePolicyManager.setApplicationRestrictions

Here's an example of how they are used in a BasicManagedProfile example application to set limits in a Chrome application by passing a set of key / value pairs that seem to correlate with the published list of Chrome policies . This works great for me.

But I can not find documentation for other applications that may be limited in this way. Does anyone know of any other applications that may be limited by these methods, and keys that may be installed?

DevicePolicyManager.getApplicationRestrictions returns only those restrictions that you have already set for this application, and not a list of all available restrictions. I also tried using RestrictionsManager.getManifestRestrictions in Chrome, but this returns an empty list, so I think this is something else.

+7
android google-chrome android-5.0-lollipop device-policy-manager
source share
1 answer

I suggest reading the Google documentation to create a work policy controller .

The managed application will include the constraint file declared in the manifest. An enterprise mobility partner can get this information through the Google APIs. Read Implementing Application Restrictions

The following steps can be used to find the available restrictions in the Android application:

  • Get apk from device. Example. Use the following steps:

    $ adb shell pm path com.android.chrome package:/data/app/com.android.chrome-2/base.apk $ adb pull /data/app/com.android.chrome-2/base.apk 4722 KB/s (32575247 bytes in 6.735s) 
  • Expand the apk file. Locate the app_restrictions.xml file in the res/ folder.

  • Use aapt tool to extract the contents of this file from apk. Example:

     aapt d xmltree DivideProductivity_1.2_RC05_6-1.apk res/xml/app_restrictions.xml aapt d xmltree base.apk res/xml-v21/app_restrictions.xml 

Please note that with this mechanism you can only view restriction keys. You will need the type of restriction and other information to actually set restrictions on the managed application. The correct way is to use the Google game API on the server.

+1
source share

All Articles