Is there any app, tool, ROM, etc. for Android that lets you restrict selected individual permissions of an app, ONLY when it is in the background?
This should function similarly to the "Restrict background data" feature that help reduce mobile data usage by preventing background apps from using network resources.
For example, you may want an app to have access to your location when you're actively using it, but you don't want it to keep the GPS on in the background, either because it drains the battery and/or is tracking your movements.
Same thing with other permissions like accessing the microphone and camera; because it is very rare for most people to intentionally record audio/video/photos from a background app. Other examples are: send SMS, reading/modifying contacts, write to internal/external storage.