aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-02-27 15:02:41 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-02-27 15:02:41 +0000
commitdfe7ba2aa3ea0fa192b661c9485378c80cc1dd35 (patch)
tree6e4cbf82d5d61d7ac8ec5c41165df7761978f1d7
parent44923a0494c315a409b2b876273905e3956a35f8 (diff)
parentcafd02a652efb6def5d814efdf35b144850a4c46 (diff)
downloadgamesdk-snap-temp-L30700030002177912.tar.gz
Merge cherrypicks of ['android-review.googlesource.com/2962714', 'android-review.googlesource.com/2962715'] into android-games-sdk-games-performance-tuner-release.snap-temp-L91500030002188473snap-temp-L30700030002177912snap-temp-L23000030002173673android-games-sdk-games-performance-tuner-release
Change-Id: Ie40149c99e0a52a259b9917974823189eb26caff
-rw-r--r--games-memory-advice/CMakeLists.txt2
-rw-r--r--src/common/JNIUtil.h5
2 files changed, 5 insertions, 2 deletions
diff --git a/games-memory-advice/CMakeLists.txt b/games-memory-advice/CMakeLists.txt
index 08645aef..368788f3 100644
--- a/games-memory-advice/CMakeLists.txt
+++ b/games-memory-advice/CMakeLists.txt
@@ -110,7 +110,7 @@ file(APPEND ${mri_file} "end\n")
set(output_archive_placeholder_file ${CMAKE_CURRENT_BINARY_DIR}/${output_archive}.placeholder.cpp)
add_custom_command(OUTPUT ${output_archive_placeholder_file}
- COMMAND touch ${output_archive_placeholder_file}
+ COMMAND echo > ${output_archive_placeholder_file}
DEPENDS memory_advice_static_pre)
diff --git a/src/common/JNIUtil.h b/src/common/JNIUtil.h
index 702e24d0..2907eba6 100644
--- a/src/common/JNIUtil.h
+++ b/src/common/JNIUtil.h
@@ -24,6 +24,7 @@
#include <string>
#include "Log.h"
+#include "system_utils.h"
// The code in this file will dynamically load Java classes from a binary
// resource linked to the library. The binary data is in DEX format, accessible
@@ -145,7 +146,9 @@ static jclass loadClass(JNIEnv* env, jobject activity, const char* name,
classLoaderObj, loadClass, dexLoaderClassName));
env->DeleteLocalRef(dexLoaderClassName);
- if (env->ExceptionCheck() || !imclassloaderClass) {
+ int sdkVersion = gamesdk::GetSystemPropAsInt("ro.build.version.sdk");
+
+ if (env->ExceptionCheck() || !imclassloaderClass || sdkVersion < 26) {
env->ExceptionClear();
// For older SDK versions <26, where InMemoryDexClassLoader is not
// available