aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Escande <wescande@google.com>2023-11-21 16:23:53 -0800
committerWilliam Escande <wescande@google.com>2023-11-22 00:24:41 -0800
commit1177d560c49443937c1dae2484d8bee89e2d5c9e (patch)
treec26d2d89e1c88ebd2b24cdd596d0194cf906d59f
parenta551bb85deed97ab081bb17652d40d3d3560cab9 (diff)
downloadmodules-utils-1177d560c49443937c1dae2484d8bee89e2d5c9e.tar.gz
Pass expresslog class as parameter
Linking to the expresslog library from an apex require to jarjar the java class. Therefor, we need to provide it as a parameter. Bug: 312557450 Test: Build + flash + check metric report Change-Id: Ic3000d429c6916b4e4bc5f502c15945fbddb718e
-rw-r--r--jni/expresslog/com_android_modules_expresslog_Utils.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/jni/expresslog/com_android_modules_expresslog_Utils.cpp b/jni/expresslog/com_android_modules_expresslog_Utils.cpp
index 973d946..ed4d0ed 100644
--- a/jni/expresslog/com_android_modules_expresslog_Utils.cpp
+++ b/jni/expresslog/com_android_modules_expresslog_Utils.cpp
@@ -48,13 +48,12 @@ static const JNINativeMethod gMethods[] = {
namespace android {
-int register_com_android_modules_expresslog_Utils(JNIEnv* env) {
- static const char* const kUtilsClassName = "com/android/modules/expresslog/Utils";
+int register_com_android_modules_expresslog_Utils(JNIEnv* env, const char* const utilsClassName) {
static const char* const kStringClassName = "java/lang/String";
- ScopedLocalRef<jclass> utilsCls(env, env->FindClass(kUtilsClassName));
+ ScopedLocalRef<jclass> utilsCls(env, env->FindClass(utilsClassName));
if (utilsCls.get() == nullptr) {
- ALOGE("jni expresslog registration failure, class not found '%s'", kUtilsClassName);
+ ALOGE("jni expresslog registration failure, class not found '%s'", utilsClassName);
return JNI_ERR;
}
@@ -78,4 +77,9 @@ int register_com_android_modules_expresslog_Utils(JNIEnv* env) {
return JNI_VERSION_1_4;
}
+int register_com_android_modules_expresslog_Utils(JNIEnv* env) {
+ static const char* const kUtilsClassName = "com/android/modules/expresslog/Utils";
+ return register_com_android_modules_expresslog_Utils(env, kUtilsClassName);
+}
+
} // namespace android