From dd80a24a5d76c5e3d00caa7e381923ca0e987142 Mon Sep 17 00:00:00 2001 From: mbricchi Date: Tue, 16 Jul 2024 15:46:32 +0200 Subject: [PATCH] android: Fix Java.choose() on newer ART APEXes Equivalent to the system version on Android 14. --- lib/android.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/android.js b/lib/android.js index 06b2adc8..bdf1ace0 100644 --- a/lib/android.js +++ b/lib/android.js @@ -618,6 +618,7 @@ function _getArtRuntimeSpec (api) { const apiLevel = getAndroidApiLevel(); const codename = getAndroidCodename(); + const isApiLevel34OrApexEquivalent = Module.findExportByName('libart.so', '_ZN3art7AppInfo29GetPrimaryApkReferenceProfileEv') !== null; let spec = null; @@ -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);