Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions lib/android.js
Original file line number Diff line number Diff line change
Expand Up @@ -967,14 +967,14 @@ export function getArtClassSpec (vm) {
const fInfo = {
artArrayLengthSize: 4,
artArrayEntrySize: fieldSpec.size,
// java/io/File has 15 fields on Android 16.
artArrayMax: 25
// java/lang/Thread has 36 fields on Android 16.
artArrayMax: 50
};

const mInfo = {
artArrayLengthSize: pointerSize,
artArrayEntrySize: methodSpec.size,
// java/io/File has 63 methods on Android 16.
// java/lang/Thread has 79 methods on Android 16.
artArrayMax: 100
};

Expand Down Expand Up @@ -1015,7 +1015,7 @@ export function getArtClassSpec (vm) {
return false;
};

const clazz = env.findClass('java/io/File');
const clazz = env.findClass('java/lang/Thread');
const clazzRef = env.newGlobalRef(clazz);

try {
Expand All @@ -1024,8 +1024,8 @@ export function getArtClassSpec (vm) {
object = getApi()['art::JavaVMExt::DecodeGlobal'](vm, thread, clazzRef);
});

const fieldInstance = env.getFieldId(clazzRef, 'path', 'Ljava/lang/String;');
const fieldStatic = env.getStaticFieldId(clazzRef, 'separatorChar', 'C');
const fieldInstance = env.getFieldId(clazzRef, 'name', 'Ljava/lang/String;');
const fieldStatic = env.getStaticFieldId(clazzRef, 'MAX_PRIORITY', 'I');

let offsetStatic = -1;
let offsetInstance = -1;
Expand All @@ -1038,20 +1038,20 @@ export function getArtClassSpec (vm) {
}
}
if (offsetInstance === -1 || offsetStatic === -1) {
throw new Error('Unable to find fields in java/io/File; please file a bug');
throw new Error('Unable to find fields in java/lang/Thread; please file a bug');
}
const sfieldOffset = (offsetInstance !== offsetStatic) ? offsetStatic : 0;
const ifieldOffset = offsetInstance;

let offsetMethods = -1;
const methodInstance = env.getMethodId(clazzRef, 'length', '()J');
const methodInstance = env.getMethodId(clazzRef, 'getName', '()Ljava/lang/String;');
for (let offset = 0; offset !== MAX_OFFSET; offset += 4) {
if (offsetMethods === -1 && hasEntry(object, offset, methodInstance, mInfo)) {
offsetMethods = offset;
}
}
if (offsetMethods === -1) {
throw new Error('Unable to find methods in java/io/File; please file a bug');
throw new Error('Unable to find methods in java/lang/Thread; please file a bug');
}

let offsetCopiedMethods = -1;
Expand All @@ -1064,7 +1064,7 @@ export function getArtClassSpec (vm) {
}
}
if (offsetCopiedMethods === -1) {
throw new Error('Unable to find copied methods in java/io/File; please file a bug');
throw new Error('Unable to find copied methods in java/lang/Thread; please file a bug');
}

spec = {
Expand Down
Loading