如何改变Android的打开文件,以便它触发系统服务功能功能、文件、系统、Android

2023-09-07 01:03:28 作者:活出尼玛的姿态

凡在AOSP code我想看看添加code触发当用户试图打开一个特别命名文件的自定义系统服务?

Where in AOSP code would I look to add code that triggers a custom system service whenever the user attempts to open a specifically named file?

例如,如果用户打开微软的Excel文件在Android上,我假设应用程序创建一个FileInputStream阅读在S preadsheet。

For example, if a user opens a file on Microsoft Excel on Android, I'm assuming the application is creating a fileinputstream to read in the spreadsheet.

我也跟着上 http://processors.wiki.ti.com的说明/index.php/Android-Adding_SystemService

推荐答案

所有的文件被任何进程打开都反映在的/ proc 。我要么修改的procfs得到立即全面跟踪此类事件,或者要求允许,撤退到一个较小的渗透方法,监测的/ proc 曾经在很短的,而

All files open by any process are reflected in /proc. I would either modify the procfs to get immediate and full track of such events, or if the requirements allow, retreat to a less penetrating approach, monitoring /proc once in a short while.

另请参见 How我监控的实时过程中打开过的文件? 的。

See also How do I monitor opened files of a process in realtime?.