diff --git a/lib/android.js b/lib/android.js index fc51b64..a2f404f 100644 --- a/lib/android.js +++ b/lib/android.js @@ -555,7 +555,8 @@ function findString (string, moduleName) { const size = range.size; const result = Memory.scanSync(base, size, pattern); if (result.length > 0) return result; - }).filter((element => element != null)).flat(); + return null; + }).filter(element => element !== null).flat(); } function createAdd (address, register) { @@ -574,6 +575,7 @@ function findPatternInModule (pattern, moduleName) { const size = range.size; const result = Memory.scanSync(base, size, pattern); if (result.length != 0) return result; + return null; }).filter(element => element != null).flat(); } @@ -587,7 +589,7 @@ function findEnsurePlugIn () { if (disasm.mnemonic === 'b') { return new NativePointer(disasm.operands[0].value); } - }).filter((element => element != null)).flat(); + }).filter(element => element !== null).flat(); } function findPrologue (address) { @@ -626,11 +628,13 @@ function tryGetEnvJvmti (vm, runtime) { let ensurePluginLoaded; if (Module.findExportByName('libart.so', '_ZN3art7Runtime18EnsurePluginLoadedEPKcPNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE') === null) { // on some devices calling the ensurePluginLoaded make the app really slow so for is commented + if (false) { + const candidates = findEnsurePlugIn(); + ensurePluginLoaded = new NativeFunction(candidates[0], + 'bool', + ['pointer', 'pointer', 'pointer']); + } return; - // const candidates = findEnsurePlugIn(); - // ensurePluginLoaded = new NativeFunction(candidates[0], - // 'bool', - // ['pointer', 'pointer', 'pointer']); } else { ensurePluginLoaded = new NativeFunction(Module.getExportByName('libart.so', '_ZN3art7Runtime18EnsurePluginLoadedEPKcPNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE'), 'bool', @@ -1961,7 +1965,8 @@ function findDoCalls () { return findPrologue(possibleBranch); } } - }).filter(element => element!=null).flat(); + return null; + }).filter(element => element !== null).flat(); } function instrumentArtMethodInvocationFromInterpreter () {