frida-java-bridge 6.3.9 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
- const getApi = require('./lib/api');
2
- const {
1
+ import getApi from './lib/api.js';
2
+ import {
3
3
  getAndroidVersion,
4
4
  withAllArtThreadsSuspended,
5
5
  withRunnableArtThread,
@@ -9,13 +9,13 @@ const {
9
9
  deoptimizeEverything,
10
10
  deoptimizeBootImage,
11
11
  deoptimizeMethod
12
- } = require('./lib/android');
13
- const ClassFactory = require('./lib/class-factory');
14
- const ClassModel = require('./lib/class-model');
15
- const Env = require('./lib/env');
16
- const Types = require('./lib/types');
17
- const VM = require('./lib/vm');
18
- const { checkJniResult } = require('./lib/result');
12
+ } from './lib/android.js';
13
+ import ClassFactory from './lib/class-factory.js';
14
+ import ClassModel from './lib/class-model.js';
15
+ import Env from './lib/env.js';
16
+ import { initialize } from './lib/types.js';
17
+ import VM from './lib/vm.js';
18
+ import { checkJniResult } from './lib/result.js';
19
19
 
20
20
  const jsizeSize = 4;
21
21
  const pointerSize = Process.pointerSize;
@@ -78,7 +78,7 @@ class Runtime {
78
78
  const vm = new VM(api);
79
79
  this.vm = vm;
80
80
 
81
- Types.initialize(vm);
81
+ initialize(vm);
82
82
  ClassFactory._initialize(vm, api);
83
83
  this.classFactory = new ClassFactory();
84
84
 
@@ -334,7 +334,7 @@ class Runtime {
334
334
  }
335
335
 
336
336
  if (this._pollListener === null) {
337
- this._pollListener = Interceptor.attach(Module.getExportByName('libc.so', 'epoll_wait'), this._makePollHook());
337
+ this._pollListener = Interceptor.attach(Process.getModuleByName('libc.so').getExportByName('epoll_wait'), this._makePollHook());
338
338
  Interceptor.flush();
339
339
  }
340
340
 
@@ -539,7 +539,7 @@ class Runtime {
539
539
  return result;
540
540
  }
541
541
 
542
- const readlink = new NativeFunction(Module.getExportByName(null, 'readlink'), 'pointer', ['pointer', 'pointer', 'pointer'], {
542
+ const readlink = new NativeFunction(Module.getGlobalExportByName('readlink'), 'pointer', ['pointer', 'pointer', 'pointer'], {
543
543
  exceptions: 'propagate'
544
544
  });
545
545
 
@@ -594,4 +594,4 @@ function initFactoryFromLoadedApk (factory, apk) {
594
594
  const runtime = new Runtime();
595
595
  Script.bindWeak(runtime, () => { runtime._dispose(); });
596
596
 
597
- module.exports = runtime;
597
+ export default runtime;
package/lib/alloc.js CHANGED
@@ -77,8 +77,6 @@ function abs (nptr) {
77
77
  return nptr.and(mask);
78
78
  }
79
79
 
80
- function makeAllocator (sliceSize) {
80
+ export default function makeAllocator (sliceSize) {
81
81
  return new CodeAllocator(sliceSize);
82
82
  }
83
-
84
- module.exports = makeAllocator;
package/lib/android.js CHANGED
@@ -1,13 +1,13 @@
1
- const makeCodeAllocator = require('./alloc');
2
- const {
1
+ import makeCodeAllocator from './alloc.js';
2
+ import {
3
3
  jvmtiVersion,
4
4
  jvmtiCapabilities,
5
5
  EnvJvmti
6
- } = require('./jvmti');
7
- const { parseInstructionsAt } = require('./machine-code');
8
- const memoize = require('./memoize');
9
- const { checkJniResult, JNI_OK } = require('./result');
10
- const VM = require('./vm');
6
+ } from './jvmti.js';
7
+ import { parseInstructionsAt } from './machine-code.js';
8
+ import memoize from './memoize.js';
9
+ import { checkJniResult, JNI_OK } from './result.js';
10
+ import VM from './vm.js';
11
11
 
12
12
  const jsizeSize = 4;
13
13
  const pointerSize = Process.pointerSize;
@@ -46,7 +46,7 @@ const ARM64_ADRP_MAX_DISTANCE = 0xfffff000;
46
46
  const ENV_VTABLE_OFFSET_EXCEPTION_CLEAR = 17 * pointerSize;
47
47
  const ENV_VTABLE_OFFSET_FATAL_ERROR = 18 * pointerSize;
48
48
 
49
- const DVM_JNI_ENV_OFFSET_SELF = 12;
49
+ export const DVM_JNI_ENV_OFFSET_SELF = 12;
50
50
 
51
51
  const DVM_CLASS_OBJECT_OFFSET_VTABLE_COUNT = 112;
52
52
  const DVM_CLASS_OBJECT_OFFSET_VTABLE = 116;
@@ -81,13 +81,13 @@ const SOCK_STREAM = 1;
81
81
 
82
82
  const getArtRuntimeSpec = memoize(_getArtRuntimeSpec);
83
83
  const getArtInstrumentationSpec = memoize(_getArtInstrumentationSpec);
84
- const getArtMethodSpec = memoize(_getArtMethodSpec);
85
- const getArtThreadSpec = memoize(_getArtThreadSpec);
84
+ export const getArtMethodSpec = memoize(_getArtMethodSpec);
85
+ export const getArtThreadSpec = memoize(_getArtThreadSpec);
86
86
  const getArtManagedStackSpec = memoize(_getArtManagedStackSpec);
87
87
  const getArtThreadStateTransitionImpl = memoize(_getArtThreadStateTransitionImpl);
88
- const getAndroidVersion = memoize(_getAndroidVersion);
88
+ export const getAndroidVersion = memoize(_getAndroidVersion);
89
89
  const getAndroidCodename = memoize(_getAndroidCodename);
90
- const getAndroidApiLevel = memoize(_getAndroidApiLevel);
90
+ export const getAndroidApiLevel = memoize(_getAndroidApiLevel);
91
91
  const getArtQuickFrameInfoGetterThunk = memoize(_getArtQuickFrameInfoGetterThunk);
92
92
 
93
93
  const makeCxxMethodWrapperReturningPointerByValue =
@@ -118,7 +118,7 @@ let socketpair = null;
118
118
 
119
119
  let trampolineAllocator = null;
120
120
 
121
- function getApi () {
121
+ export function getApi () {
122
122
  if (cachedApi === null) {
123
123
  cachedApi = _getApi();
124
124
  }
@@ -570,7 +570,7 @@ function tryGetEnvJvmti (vm, runtime) {
570
570
  return env;
571
571
  }
572
572
 
573
- function ensureClassInitialized (env, classRef) {
573
+ export function ensureClassInitialized (env, classRef) {
574
574
  const api = getApi();
575
575
  if (api.flavor !== 'art') {
576
576
  return;
@@ -957,7 +957,7 @@ function tryGetArtClassLinkerSpec (runtime, runtimeSpec) {
957
957
  return spec;
958
958
  }
959
959
 
960
- function getArtClassSpec (vm) {
960
+ export function getArtClassSpec (vm) {
961
961
  let apiLevel;
962
962
  try {
963
963
  apiLevel = getAndroidApiLevel();
@@ -1056,7 +1056,7 @@ function _getArtMethodSpec (vm) {
1056
1056
  return spec;
1057
1057
  }
1058
1058
 
1059
- function getArtFieldSpec (vm) {
1059
+ export function getArtFieldSpec (vm) {
1060
1060
  const apiLevel = getAndroidApiLevel();
1061
1061
 
1062
1062
  if (apiLevel >= 23) {
@@ -1250,7 +1250,7 @@ function parseArtQuickTrampolineArm64 (insn) {
1250
1250
  return null;
1251
1251
  }
1252
1252
 
1253
- function getArtThreadFromEnv (env) {
1253
+ export function getArtThreadFromEnv (env) {
1254
1254
  return env.handle.add(pointerSize).readPointer();
1255
1255
  }
1256
1256
 
@@ -1271,14 +1271,18 @@ const PROP_VALUE_MAX = 92;
1271
1271
 
1272
1272
  function getAndroidSystemProperty (name) {
1273
1273
  if (systemPropertyGet === null) {
1274
- systemPropertyGet = new NativeFunction(Module.getExportByName('libc.so', '__system_property_get'), 'int', ['pointer', 'pointer'], nativeFunctionOptions);
1274
+ systemPropertyGet = new NativeFunction(
1275
+ Process.getModuleByName('libc.so').getExportByName('__system_property_get'),
1276
+ 'int',
1277
+ ['pointer', 'pointer'],
1278
+ nativeFunctionOptions);
1275
1279
  }
1276
1280
  const buf = Memory.alloc(PROP_VALUE_MAX);
1277
1281
  systemPropertyGet(Memory.allocUtf8String(name), buf);
1278
1282
  return buf.readUtf8String();
1279
1283
  }
1280
1284
 
1281
- function withRunnableArtThread (vm, env, fn) {
1285
+ export function withRunnableArtThread (vm, env, fn) {
1282
1286
  const perform = getArtThreadStateTransitionImpl(vm, env);
1283
1287
 
1284
1288
  const id = getArtThreadFromEnv(env).toString();
@@ -1305,7 +1309,7 @@ function onThreadStateTransitionComplete (thread) {
1305
1309
  fn(thread);
1306
1310
  }
1307
1311
 
1308
- function withAllArtThreadsSuspended (fn) {
1312
+ export function withAllArtThreadsSuspended (fn) {
1309
1313
  const api = getApi();
1310
1314
 
1311
1315
  const threadList = api.artThreadList;
@@ -1335,7 +1339,7 @@ class ArtClassVisitor {
1335
1339
  }
1336
1340
  }
1337
1341
 
1338
- function makeArtClassVisitor (visit) {
1342
+ export function makeArtClassVisitor (visit) {
1339
1343
  const api = getApi();
1340
1344
 
1341
1345
  if (api['art::ClassLinker::VisitClasses'] instanceof NativeFunction) {
@@ -1364,7 +1368,7 @@ class ArtClassLoaderVisitor {
1364
1368
  }
1365
1369
  }
1366
1370
 
1367
- function makeArtClassLoaderVisitor (visit) {
1371
+ export function makeArtClassLoaderVisitor (visit) {
1368
1372
  return new ArtClassLoaderVisitor(visit);
1369
1373
  }
1370
1374
 
@@ -1373,7 +1377,7 @@ const WalkKind = {
1373
1377
  'skip-inlined-frames': 1
1374
1378
  };
1375
1379
 
1376
- class ArtStackVisitor {
1380
+ export class ArtStackVisitor {
1377
1381
  constructor (thread, context, walkKind, numFrames = 0, checkSuspended = true) {
1378
1382
  const api = getApi();
1379
1383
 
@@ -1452,7 +1456,7 @@ class ArtStackVisitor {
1452
1456
  }
1453
1457
  }
1454
1458
 
1455
- class ArtMethod {
1459
+ export class ArtMethod {
1456
1460
  constructor (handle) {
1457
1461
  this.handle = handle;
1458
1462
  }
@@ -1535,17 +1539,17 @@ function _getArtQuickFrameInfoGetterThunk (impl) {
1535
1539
  }
1536
1540
 
1537
1541
  const thunkRelocators = {
1538
- ia32: global.X86Relocator,
1539
- x64: global.X86Relocator,
1540
- arm: global.ThumbRelocator,
1541
- arm64: global.Arm64Relocator
1542
+ ia32: globalThis.X86Relocator,
1543
+ x64: globalThis.X86Relocator,
1544
+ arm: globalThis.ThumbRelocator,
1545
+ arm64: globalThis.Arm64Relocator
1542
1546
  };
1543
1547
 
1544
1548
  const thunkWriters = {
1545
- ia32: global.X86Writer,
1546
- x64: global.X86Writer,
1547
- arm: global.ThumbWriter,
1548
- arm64: global.Arm64Writer
1549
+ ia32: globalThis.X86Writer,
1550
+ x64: globalThis.X86Writer,
1551
+ arm: globalThis.ThumbWriter,
1552
+ arm64: globalThis.Arm64Writer
1549
1553
  };
1550
1554
 
1551
1555
  function makeThunk (size, write) {
@@ -2313,15 +2317,15 @@ function instrumentGetOatQuickMethodHeaderInlinedCopyArm64 ({ address, size, val
2313
2317
  });
2314
2318
  }
2315
2319
 
2316
- function makeMethodMangler (methodId) {
2320
+ export function makeMethodMangler (methodId) {
2317
2321
  return new MethodMangler(methodId);
2318
2322
  }
2319
2323
 
2320
- function translateMethod (methodId) {
2324
+ export function translateMethod (methodId) {
2321
2325
  return artController.replacedMethods.translate(methodId);
2322
2326
  }
2323
2327
 
2324
- function backtrace (vm, options = {}) {
2328
+ export function backtrace (vm, options = {}) {
2325
2329
  const { limit = 16 } = options;
2326
2330
 
2327
2331
  const env = vm.getEnv();
@@ -2792,7 +2796,7 @@ std_string_get_data (StdString * str)
2792
2796
  translate_location: api['art::Monitor::TranslateLocation'],
2793
2797
  get_class_location: api['art::mirror::Class::GetLocation'],
2794
2798
  cxx_delete: api.$delete,
2795
- strtoul: Module.getExportByName('libc.so', 'strtoul')
2799
+ strtoul: Process.getModuleByName('libc.so').getExportByName('strtoul')
2796
2800
  });
2797
2801
 
2798
2802
  const _create = new NativeFunction(cm._create, 'pointer', ['pointer', 'uint'], nativeFunctionOptions);
@@ -2842,7 +2846,7 @@ class Backtrace {
2842
2846
  }
2843
2847
  }
2844
2848
 
2845
- function revertGlobalPatches () {
2849
+ export function revertGlobalPatches () {
2846
2850
  patchedClasses.forEach(entry => {
2847
2851
  entry.vtablePtr.writePointer(entry.vtable);
2848
2852
  entry.vtableCountPtr.writeS32(entry.vtableCount);
@@ -3660,15 +3664,15 @@ function cloneArtMethod (method, vm) {
3660
3664
  return Memory.dup(method, getArtMethodSpec(vm).size);
3661
3665
  }
3662
3666
 
3663
- function deoptimizeMethod (vm, env, method) {
3667
+ export function deoptimizeMethod (vm, env, method) {
3664
3668
  requestDeoptimization(vm, env, kSelectiveDeoptimization, method);
3665
3669
  }
3666
3670
 
3667
- function deoptimizeEverything (vm, env) {
3671
+ export function deoptimizeEverything (vm, env) {
3668
3672
  requestDeoptimization(vm, env, kFullDeoptimization);
3669
3673
  }
3670
3674
 
3671
- function deoptimizeBootImage (vm, env) {
3675
+ export function deoptimizeBootImage (vm, env) {
3672
3676
  const api = getApi();
3673
3677
 
3674
3678
  if (getAndroidApiLevel() < 26) {
@@ -3748,8 +3752,9 @@ class JdwpSession {
3748
3752
  * We partially stub out the ADB JDWP transport to ensure we always
3749
3753
  * succeed in starting JDWP. Failure will crash the process.
3750
3754
  */
3751
- const acceptImpl = Module.getExportByName('libart.so', '_ZN3art4JDWP12JdwpAdbState6AcceptEv');
3752
- const receiveClientFdImpl = Module.getExportByName('libart.so', '_ZN3art4JDWP12JdwpAdbState15ReceiveClientFdEv');
3755
+ const libart = Process.getModuleByName('libart.so');
3756
+ const acceptImpl = libart.getExportByName('_ZN3art4JDWP12JdwpAdbState6AcceptEv');
3757
+ const receiveClientFdImpl = libart.getExportByName('_ZN3art4JDWP12JdwpAdbState15ReceiveClientFdEv');
3753
3758
 
3754
3759
  const controlPair = makeSocketPair();
3755
3760
  const clientPair = makeSocketPair();
@@ -3791,8 +3796,7 @@ class JdwpSession {
3791
3796
  try {
3792
3797
  await output.writeAll(handshakePacket);
3793
3798
  await input.readAll(handshakePacket.length);
3794
- } catch (e) {
3795
- }
3799
+ } catch (e) { /* empty */ }
3796
3800
  }
3797
3801
  }
3798
3802
 
@@ -3837,7 +3841,7 @@ function makeJdwpOptions () {
3837
3841
  function makeSocketPair () {
3838
3842
  if (socketpair === null) {
3839
3843
  socketpair = new NativeFunction(
3840
- Module.getExportByName('libc.so', 'socketpair'),
3844
+ Process.getModuleByName('libc.so').getExportByName('socketpair'),
3841
3845
  'int',
3842
3846
  ['int', 'int', 'int', 'pointer']);
3843
3847
  }
@@ -4864,7 +4868,7 @@ class StdVector {
4864
4868
  }
4865
4869
  }
4866
4870
 
4867
- class HandleVector extends StdVector {
4871
+ export class HandleVector extends StdVector {
4868
4872
  static $new () {
4869
4873
  const vector = new HandleVector(getApi().$new(STD_VECTOR_SIZE));
4870
4874
  vector.init();
@@ -4937,7 +4941,7 @@ const VSHS_OFFSET_SELF = alignPointerOffset(BHS_SIZE);
4937
4941
  const VSHS_OFFSET_CURRENT_SCOPE = VSHS_OFFSET_SELF + pointerSize;
4938
4942
  const VSHS_SIZE = VSHS_OFFSET_CURRENT_SCOPE + pointerSize;
4939
4943
 
4940
- class VariableSizedHandleScope extends BaseHandleScope {
4944
+ export class VariableSizedHandleScope extends BaseHandleScope {
4941
4945
  static $new (thread, vm) {
4942
4946
  const scope = new VariableSizedHandleScope(getApi().$new(VSHS_SIZE));
4943
4947
  scope.init(thread, vm);
@@ -5129,7 +5133,7 @@ const objectVisitorPredicateFactories = {
5129
5133
  }
5130
5134
  };
5131
5135
 
5132
- function makeObjectVisitorPredicate (needle, onMatch) {
5136
+ export function makeObjectVisitorPredicate (needle, onMatch) {
5133
5137
  const factory = objectVisitorPredicateFactories[Process.arch] || makeGenericObjectVisitorPredicate;
5134
5138
  return factory(needle, onMatch);
5135
5139
  }
@@ -5150,32 +5154,3 @@ function alignPointerOffset (offset) {
5150
5154
  }
5151
5155
  return offset;
5152
5156
  }
5153
-
5154
- module.exports = {
5155
- getApi,
5156
- ensureClassInitialized,
5157
- getAndroidVersion,
5158
- getAndroidApiLevel,
5159
- getArtClassSpec,
5160
- getArtMethodSpec,
5161
- getArtFieldSpec,
5162
- getArtThreadSpec,
5163
- getArtThreadFromEnv,
5164
- withRunnableArtThread,
5165
- withAllArtThreadsSuspended,
5166
- makeArtClassVisitor,
5167
- makeArtClassLoaderVisitor,
5168
- ArtStackVisitor,
5169
- ArtMethod,
5170
- makeMethodMangler,
5171
- translateMethod,
5172
- backtrace,
5173
- revertGlobalPatches,
5174
- deoptimizeEverything,
5175
- deoptimizeBootImage,
5176
- deoptimizeMethod,
5177
- HandleVector,
5178
- VariableSizedHandleScope,
5179
- makeObjectVisitorPredicate,
5180
- DVM_JNI_ENV_OFFSET_SELF
5181
- };
package/lib/api.js CHANGED
@@ -1,7 +1,9 @@
1
- let { getApi, getAndroidVersion } = require('./android');
1
+ import { getApi as androidGetApi, getAndroidVersion } from './android.js';
2
+ import { getApi as jvmGetApi } from './jvm.js';
3
+ let getApi = androidGetApi;
2
4
  try {
3
5
  getAndroidVersion();
4
6
  } catch (e) {
5
- getApi = require('./jvm').getApi;
7
+ getApi = jvmGetApi;
6
8
  }
7
- module.exports = getApi;
9
+ export default getApi;
@@ -1,20 +1,20 @@
1
- const Env = require('./env');
2
- const android = require('./android');
3
- const jvm = require('./jvm');
1
+ import Env from './env.js';
2
+ import * as android from './android.js';
3
+ import { ensureClassInitialized as jvmEnsureClassInitialized, makeMethodMangler as jvmMakeMethodMangler } from './jvm.js';
4
+ import ClassModel from './class-model.js';
5
+ import LRU from './lru.js';
6
+ import mkdex from './mkdex.js';
7
+ import {
8
+ getType,
9
+ getPrimitiveType,
10
+ getArrayType,
11
+ makeJniObjectTypeName
12
+ } from './types.js';
4
13
  const jsizeSize = 4;
5
14
  let {
6
15
  ensureClassInitialized,
7
16
  makeMethodMangler
8
17
  } = android;
9
- const ClassModel = require('./class-model');
10
- const LRU = require('./lru');
11
- const mkdex = require('./mkdex');
12
- const {
13
- getType,
14
- getPrimitiveType,
15
- getArrayType,
16
- makeJniObjectTypeName
17
- } = require('./types');
18
18
 
19
19
  const kAccStatic = 0x0008;
20
20
 
@@ -58,14 +58,14 @@ let cachedLoaderMethod = null;
58
58
 
59
59
  const ignoredThreads = new Map();
60
60
 
61
- class ClassFactory {
61
+ export default class ClassFactory {
62
62
  static _initialize (_vm, _api) {
63
63
  vm = _vm;
64
64
  api = _api;
65
65
  isArtVm = _api.flavor === 'art';
66
66
  if (_api.flavor === 'jvm') {
67
- ensureClassInitialized = jvm.ensureClassInitialized;
68
- makeMethodMangler = jvm.makeMethodMangler;
67
+ ensureClassInitialized = jvmEnsureClassInitialized;
68
+ makeMethodMangler = jvmMakeMethodMangler;
69
69
  }
70
70
  }
71
71
 
@@ -2357,5 +2357,3 @@ function makeSourceFileName (className) {
2357
2357
  const tokens = className.split('.');
2358
2358
  return tokens[tokens.length - 1] + '.java';
2359
2359
  }
2360
-
2361
- module.exports = ClassFactory;
@@ -1,3 +1,5 @@
1
+ import { withRunnableArtThread, getArtClassSpec, getArtMethodSpec, getArtFieldSpec, getApi } from './android.js';
2
+
1
3
  const code = `#include <json-glib/json-glib.h>
2
4
  #include <string.h>
3
5
 
@@ -1161,14 +1163,12 @@ std_string_c_str (StdString * self)
1161
1163
  }
1162
1164
  `;
1163
1165
 
1164
- const android = require('./android');
1165
-
1166
1166
  const methodQueryPattern = /(.+)!([^/]+)\/?([isu]+)?/;
1167
1167
 
1168
1168
  let cm = null;
1169
1169
  let unwrap = null;
1170
1170
 
1171
- class Model {
1171
+ export default class Model {
1172
1172
  static build (handle, env) {
1173
1173
  ensureInitialized(env);
1174
1174
 
@@ -1215,7 +1215,7 @@ class Model {
1215
1215
  cm.dealloc(json);
1216
1216
  }
1217
1217
  } else {
1218
- android.withRunnableArtThread(env.vm, env, thread => {
1218
+ withRunnableArtThread(env.vm, env, thread => {
1219
1219
  const json = cm.enumerateMethodsArt(classQuery, methodQuery,
1220
1220
  boolToNative(includeSignature), boolToNative(ignoreCase), boolToNative(skipSystemClasses));
1221
1221
  try {
@@ -1296,11 +1296,11 @@ function compileModule (env) {
1296
1296
 
1297
1297
  const artApi = javaApi.add(javaApiSize);
1298
1298
  const { vm } = env;
1299
- const artClass = android.getArtClassSpec(vm);
1299
+ const artClass = getArtClassSpec(vm);
1300
1300
  if (artClass !== null) {
1301
1301
  const c = artClass.offset;
1302
- const m = android.getArtMethodSpec(vm);
1303
- const f = android.getArtFieldSpec(vm);
1302
+ const m = getArtMethodSpec(vm);
1303
+ const f = getArtFieldSpec(vm);
1304
1304
 
1305
1305
  let s = artApi;
1306
1306
  [
@@ -1314,13 +1314,13 @@ function compileModule (env) {
1314
1314
  s = s.writeUInt(value).add(4);
1315
1315
  });
1316
1316
 
1317
- const api = android.getApi();
1317
+ const api = getApi();
1318
1318
  [
1319
1319
  api.artClassLinker.address,
1320
1320
  api['art::ClassLinker::VisitClasses'],
1321
1321
  api['art::mirror::Class::GetDescriptor'],
1322
1322
  api['art::ArtMethod::PrettyMethod'],
1323
- Module.getExportByName('libc.so', 'free')
1323
+ Process.getModuleByName('libc.so').getExportByName('free')
1324
1324
  ]
1325
1325
  .forEach((value, i) => {
1326
1326
  if (value === undefined) {
@@ -1360,8 +1360,7 @@ function makeHandleUnwrapper (cm, vm) {
1360
1360
  return nullUnwrap;
1361
1361
  }
1362
1362
 
1363
- const { withRunnableArtThread } = android;
1364
- const decodeGlobal = android.getApi()['art::JavaVMExt::DecodeGlobal'];
1363
+ const decodeGlobal = getApi()['art::JavaVMExt::DecodeGlobal'];
1365
1364
 
1366
1365
  return function (handle, env, fn) {
1367
1366
  let result;
@@ -1382,5 +1381,3 @@ function nullUnwrap (handle, env, fn) {
1382
1381
  function boolToNative (val) {
1383
1382
  return val ? 1 : 0;
1384
1383
  }
1385
-
1386
- module.exports = Model;
package/lib/env.js CHANGED
@@ -1,4 +1,4 @@
1
- function Env (handle, vm) {
1
+ export default function Env (handle, vm) {
2
2
  this.handle = handle;
3
3
  this.vm = vm;
4
4
  }
@@ -947,5 +947,3 @@ Env.prototype.stringFromJni = function (str) {
947
947
  this.releaseStringChars(str, utf);
948
948
  }
949
949
  };
950
-
951
- module.exports = Env;