I have Users with rooted Android 2.2+ smartphone devices. Whenever any on-device App accesses the device's Contacts List, Microphone or Camera resource, I want to Suspend that App, pop up a warning message to the User, and let the User decide whether to Abort or Continue.
Even though at App install-time the User might have (blindly) granted those Apps permission to access those Resources.
So, I want to write an Android System Service to continuously scan the File Descriptors (or whatever) representing the Contacts List, Microphone and Camera. If any other application or service/process/thread attempts to open any of the above file descriptors, I suspend it and pop up a Toast message to the User, something like: "Application "CHESS" is trying to access the CAMERA!!! Close the app, or Continue?";
I could find absolutely nothing on the Android SDK or NDK which would help me achieve my above goal.
Not even a quick-and-dirty-and-dangerous Linux command approach like "./data/lsof -w | grep audio" inserted and run on the device was of any help whatsoever -- I don't know what precise Android resource names to grep for, and moreover the Resources' file descriptors seem to be open all the time whether they are being accessed or not!
Thank you, any advice would be greatly appreciated.