Root Android:当任何应用程序访问联系人列表、麦克风或相机时暂停并警告用户?
我的用户拥有 root 权限的 Android 2.2+ 智能手机设备。 每当任何设备上的应用程序访问设备的联系人列表、麦克风或相机资源时,我想暂停该应用程序,向用户弹出警告消息,并让用户决定是否中止或继续。
即使在应用程序安装时,用户可能(盲目地)授予这些应用程序访问这些资源的权限。
因此,我想编写一个 Android 系统服务来连续扫描代表联系人列表、麦克风和摄像头的文件描述符(或其他内容)。 如果任何其他应用程序或服务/进程/线程尝试打开任何上述文件描述符,我将挂起它并向用户弹出一条Toast消息,如下所示: “应用程序“CHESS”正在尝试访问相机!!!关闭应用程序,还是继续?”;
我在 Android SDK 或 NDK 上找不到任何可以帮助我实现上述目标的东西。
甚至在设备上插入并运行“./data/lsof -w | grep audio”这样的快速、肮脏和危险的 Linux 命令方法也没有任何帮助——我不知道确切的 Android 资源是什么grep 查找的名称,而且资源的文件描述符似乎一直打开,无论它们是否被访问!
谢谢您,任何建议将不胜感激。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我同意之前的帖子,说这可能是不可能的。但是,如果您要部署自己的内核,那么这里有一个很好的建议线程:Android Kernel修改
也这里的线程与您想要的类似的低级挂钩: http://groups.google.com/group/android-developers/browse_thread/thread/821e5a413f0014d9
以下是编写 Android 驱动程序的方法: http://www.kandroid.org/online-pdk/guide/display_drivers.html。可能您需要编写一个通用驱动程序,仅替换您想要的现有驱动程序。然后,该驱动程序将指向旧驱动程序的备份位置,从而有效地包装旧驱动程序。这样,您应该希望保留您编写的通用驱动程序,以及制造商驱动程序提供的相同行为和良好抽象。
I would agree with the previous posts saying it might not be possible. But if you were deploying your own kernel, then this has a good suggestion thread here: Android Kernel modifying
also this thread here is along similar low level hooking that you want: http://groups.google.com/group/android-developers/browse_thread/thread/821e5a413f0014d9
Here is how to write a driver for android: http://www.kandroid.org/online-pdk/guide/display_drivers.html. Possibly you need to write a driver that is generic and just replaces the existing drivers that you want. that driver would then point to a backed up location of the old drivers, effectively wrapping the old driver. This way you should hopefully keep a generic driver that you write, and the same behavior and nice abstraction the manufacturer drivers provide.