3

AndroidまたはAndroid NDKで、どのアプリケーションがディスクまたはデバイスのメモリでデータを読み書きしているかを知る方法はありますか?

4

3 に答える 3

1

あなたはの出力であなたのファイルを探すかもし​​れません

ls -l / proc / * / fd /

このために特別なツールやルートは必要ありません。

説明

/proc/実行中のすべてのプロセスは、 pidにちなんでnamedのエントリを取得します。すべてのpidについて、はfdファイル名を指すファイルハンドルの名前を持つシンボリックリンクを持つディレクトリです。

たとえば、1つのエントリは...

lr-x ------ app_25 app_25 2012-09-06 12:16 20-> /system/etc/fallback_fonts.xml

残念ながら、PIDは表示されませんが、プロセスの所有者は表示されますapp_25

/data/data/したがって、 (でls -l /data/data)を調べることができます

...
drwxr-x--x app_9    app_9             2012-02-23 08:31 com.android.launcher 
drwxr-x--x app_25   app_25            2012-02-23 08:30 com.android.mms 
drwxr-x--x app_5    app_5             2012-02-23 08:29 com.android.music
...

だからアプリケーションですcom.android.mms

于 2012-09-06T12:20:07.930 に答える
0

「ディスクまたはデバイスメモリ上のデータの読み取りまたは書き込み」の意味は明確ではありませんが、dumpsysツールが役立つことを願っています。

于 2012-09-06T12:23:53.393 に答える
0

それを行うSDKの方法があるかどうかはわかりませんが、Linuxでは、プロセスをリストしたり、ファイルを開いたり、ソケットを開いたりすることができ、そこから何かをつかむことができます。

最初に ps コマンドを使用してプロセスの PID を取得し、次のように入力します。

$ ps -aef | grep {process-name}
$ ps -aef | grep httpd

次に、この PID を pfiles コマンドに渡します。

$ pfiles {PID}
$ pfile 3533

これは、Firefox が使用するすべての開いているファイルを一覧表示する方法です...

lsof -p `ps -C firefox -o pid=`

System.exec() を使用してこれらを実行できますが、root アクセスも必要です。とにかく、その種の情報を表示するために必要だったものは何か..

編集:

これは私がPy2Cmodから得たものです

init.c

/* Generated by py2cmod
*
* py2cmod (c) 2001 Mark Rowe
*/

#include "Python.h"

static PyObject *ErrorObject;

/* ----------------------------------------------------- */

/* List of methods defined in the module */

static struct PyMethodDef iotop/__init___methods[] = {

{NULL,   (PyCFunction)NULL, 0, NULL}        /* sentinel */
};


/* Initialization function for the module (*must* be called initiotop/__init__) */

static char iotop/__init___module_documentation[] =  "";

void initiotop/__init__()
{
PyObject *m, *d;

/* Create the module and add the functions */
m = Py_InitModule4("iotop/__init__", iotop/__init___methods,
    iotop/__init___module_documentation,
    (PyObject*)NULL,PYTHON_API_VERSION);

/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("iotop/__init__.error");
PyDict_SetItemString(d, "error", ErrorObject);

/* XXXX Add constants here */
PyDict_SetItemString(d, "__file__", PyString_FromString("iotop/__init__.py"));
PyDict_SetItemString(d, "__name__", PyString_FromString("iotop/__init__"));


/* Check for errors */
if (PyErr_Occurred())
    Py_FatalError("can't initialize module iotop/__init__");
}
于 2012-09-06T12:12:48.390 に答える