Search code examples
android-sourcerestrictionandroid-permissionsandroid-app-ops

AOSP: How to restrict app accessing Camera, Location?


I'm trying to restrict apps in Android by modifying source code. I was able to get it working for Internet, but I was not able to restrict apps from using Camera or Location?

Internet permission is enforced at linux process level with group-id. But I Camera/Location are not enforced the same way.

So I want to know what is the best place to restrict the apps for these permissions. Are checkCallingPermission() enforceCallingPermission() methods the right ones?


Solution

  • Yes, you're right. In these methods you can put your hooks where you will check if a permission should be restricted for an application. We did similar check when we were implementing CRePE (enter link description here).