Run the dex deobfuscation. This method may take a long time and should only be called in background thread. Note that if a method is not found, its failed state will be cached. @param i the dex method index @return the target method descriptor, null if the target is not found. @see #isDeobfuscation
(int i)
| 207 | * @see #isDeobfuscationRequiredFor(int) |
| 208 | */ |
| 209 | @Nullable |
| 210 | public static DexMethodDescriptor doFindMethodDesc(int i) { |
| 211 | DexMethodDescriptor ret = getMethodDescFromCache(i); |
| 212 | if (ret != null) { |
| 213 | return ret; |
| 214 | } |
| 215 | int currentHostVersionCode32 = HostInfo.getVersionCode(); |
| 216 | try { |
| 217 | HashSet<DexMethodDescriptor> methods; |
| 218 | String memoirKey = getOriginalClassNameForIndex(i); |
| 219 | ConfigManager cache = ConfigManager.getCache(); |
| 220 | DexDeobfReport report = new DexDeobfReport(); |
| 221 | report.target = i; |
| 222 | report.version = currentHostVersionCode32; |
| 223 | methods = searchFromHostDexForIndex(i, report); |
| 224 | if (methods == null || methods.size() == 0) { |
| 225 | report.v("No method candidate found."); |
| 226 | Utils.logi("Unable to deobf: " + getOriginalClassNameForIndex(i)); |
| 227 | // save failed state |
| 228 | cache.putString("cache_" + memoirKey + "_method", NO_SUCH_METHOD.toString()); |
| 229 | cache.putInt("cache_" + memoirKey + "_code", currentHostVersionCode32); |
| 230 | cache.save(); |
| 231 | return null; |
| 232 | } |
| 233 | report.v(methods.size() + " method(s) found: " + methods); |
| 234 | if (methods.size() == 1) { |
| 235 | ret = methods.iterator().next(); |
| 236 | } else { |
| 237 | ret = verifyFoundCandidateForIndex(i, methods, report); |
| 238 | } |
| 239 | report.v("Final decision:" + (ret == null ? null : ret.toString())); |
| 240 | cache.putString("deobf_log_" + memoirKey, report.toString()); |
| 241 | if (ret == null) { |
| 242 | Utils.logi("Multiple classes candidates found, none satisfactory."); |
| 243 | // save failed state |
| 244 | cache.putString("cache_" + memoirKey + "_method", NO_SUCH_METHOD.toString()); |
| 245 | cache.putInt("cache_" + memoirKey + "_code", currentHostVersionCode32); |
| 246 | cache.save(); |
| 247 | return null; |
| 248 | } |
| 249 | cache.putString("cache_" + memoirKey + "_method", ret.toString()); |
| 250 | cache.putInt("cache_" + memoirKey + "_code", currentHostVersionCode32); |
| 251 | cache.save(); |
| 252 | } catch (Exception e) { |
| 253 | Utils.loge(e); |
| 254 | } |
| 255 | return ret; |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * Get the original class name for a class index. |
no test coverage detected