2

I am new to Android for work features.

I have written a sample app to test the restriction features provided to a profile owner. My sample app creates a managed work profile and sets itself as the profile owner.

I tried to apply some restriction policies after that, e.g., DevicePolicyManager.addUserRestriction(componentName, UserManager.DISALLOW_UNINSTALL_APPS);

It works and I am unable to uninstall any app from the managed profile. But when I try to apply: DevicePolicyManager.addUserRestriction(componentName, UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES);, it seems to be not working.

I couldn't find the default settings app enabled in the profile. But when I log the apps installed in the managed profile, I can see two setting packages (com.android.settings and com.android.providers.settings) in the list.

What my understanding from the above API is after applying the restriction, Setting->security->Unknown Source switch should be disabled. But I couldn't find any Settings app in the managed profile to verify.

Also, after applying the restriction, I am able to install any apk from adb in the managed profile along with the primary user.

Please let me know if i am missing something.

Paul Ratazzi
  • 6,289
  • 3
  • 38
  • 50
sudipm
  • 31
  • 3
  • Did you tried to install an apk from unknown sources?? – Pankaj Kumar Jan 28 '15 at 05:39
  • Yes i tried to install from adb, its installing. – sudipm Jan 28 '15 at 10:22
  • Also i observed a new behavior :: that even without setting UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES restriction i am unable to install apps from any source except play store. Is there anyway to change this behavior,as enterprise will sometime push app from their store rather using google play store. – sudipm Jan 28 '15 at 10:24
  • possible duplicate of [How to enable Non market application in Managed Profile (Android 5.0) programmatically](http://stackoverflow.com/questions/27375736/how-to-enable-non-market-application-in-managed-profile-android-5-0-programmat) – Paul Ratazzi Jan 29 '15 at 15:08

0 Answers0