Skip to content

Commit

Permalink
android: Fix Java.choose() on newer ART APEXes
Browse files Browse the repository at this point in the history
Equivalent to the system version on Android 14.
  • Loading branch information
mbricchi authored and oleavr committed Jul 17, 2024
1 parent 0dd9041 commit dd80a24
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/android.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ function _getArtRuntimeSpec (api) {

const apiLevel = getAndroidApiLevel();
const codename = getAndroidCodename();
const isApiLevel34OrApexEquivalent = Module.findExportByName('libart.so', '_ZN3art7AppInfo29GetPrimaryApkReferenceProfileEv') !== null;

let spec = null;

Expand Down Expand Up @@ -645,7 +646,7 @@ function _getArtRuntimeSpec (api) {
const threadListOffset = internTableOffset - pointerSize;

let heapOffset;
if (apiLevel >= 34) {
if (isApiLevel34OrApexEquivalent) {
heapOffset = threadListOffset - (9 * pointerSize);
} else if (apiLevel >= 24) {
heapOffset = threadListOffset - (8 * pointerSize);
Expand Down

0 comments on commit dd80a24

Please sign in to comment.