To find unused Java->Native methods:
* Ensure Monochrome is stripping unused native methods (bug 688465).
* Find all java native methods post-proguard via dexdump/supersize.
* Find all native implementations of these methods using nm/readelf/supersize (symbols that start with JAVA_)
* Report how many dex methods do not have corresponding java methods. These are the unused ones.
To find unused native->java methods (@UsedByNatives):
* Find list of java symbols by recording them during jni_registration_generator().
* Monochrome have one of these, so maybe add one just for this purpose?
* Find which ones are called using nm/supersize to list .bss symbols storing the method references.
E.g. (g_org_chromium_base_Callback_00024Helper_onObjectResultFromNative)
https://cs.chromium.org/chromium/src/out/android-Debug/gen/base/base_jni_headers/base/jni/Callback_jni.h?rcl=5fd41a1dd021a054cd4033a6b8bf7b2470aecfda&l=52
* Report how many java methods exists but native method symbols is missing.
Note: Neither of these approaches has actually been tested! First step should be to prove they actually work.
Note: Might be nice to implemented both of these in "canned_queries.py"
Comment 1 by agrieve@chromium.org
, Sep 25