Browse Source

fix JNI string release before executing C++ functions, update gradle to 7.1.3

Signed-off-by: R4SAS <r4sas@i2pmail.org>
pull/44/head
R4SAS 3 years ago
parent
commit
578a97f549
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 4
      app/jni/i2pd_android.cpp
  2. 2
      app/src/main/java/org/purplei2p/i2pd/DaemonWrapper.java
  3. 2
      build.gradle

4
app/jni/i2pd_android.cpp

@ -91,8 +91,8 @@ JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_onNetworkStateChanged
JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_setDataDir JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_setDataDir
(JNIEnv *env, jclass clazz, jstring jdataDir) { (JNIEnv *env, jclass clazz, jstring jdataDir) {
auto dataDir = env->GetStringUTFChars(jdataDir, NULL); auto dataDir = env->GetStringUTFChars(jdataDir, NULL);
env->ReleaseStringUTFChars(jdataDir, dataDir);
i2p::android::SetDataDir(dataDir); i2p::android::SetDataDir(dataDir);
env->ReleaseStringUTFChars(jdataDir, dataDir);
} }
JNIEXPORT jint JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_getTransitTunnelsCount JNIEXPORT jint JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_getTransitTunnelsCount
@ -111,8 +111,8 @@ JNIEXPORT jstring JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_getWebConsAddr
JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_setLanguage JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_setLanguage
(JNIEnv *env, jclass clazz, jstring jlanguage) { (JNIEnv *env, jclass clazz, jstring jlanguage) {
auto language = env->GetStringUTFChars(jlanguage, NULL); auto language = env->GetStringUTFChars(jlanguage, NULL);
env->ReleaseStringUTFChars(jlanguage, language);
i2p::android::SetLanguage(language); i2p::android::SetLanguage(language);
env->ReleaseStringUTFChars(jlanguage, language);
} }
JNIEXPORT jboolean JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_getHTTPProxyState JNIEXPORT jboolean JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_getHTTPProxyState

2
app/src/main/java/org/purplei2p/i2pd/DaemonWrapper.java

@ -29,7 +29,7 @@ public class DaemonWrapper {
private static final String TAG = "i2pd"; private static final String TAG = "i2pd";
private final AssetManager assetManager; private final AssetManager assetManager;
private final ConnectivityManager connectivityManager; private final ConnectivityManager connectivityManager;
private String i2pdpath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/i2pd/"; private String i2pdpath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/i2pd";
private boolean assetsCopied; private boolean assetsCopied;
private static final String appLocale = Locale.getDefault().getDisplayLanguage(Locale.ENGLISH).toLowerCase(); // lower-case system language (like "english") private static final String appLocale = Locale.getDefault().getDisplayLanguage(Locale.ENGLISH).toLowerCase(); // lower-case system language (like "english")

2
build.gradle

@ -4,7 +4,7 @@ buildscript {
google() google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.1.2' classpath 'com.android.tools.build:gradle:7.1.3'
} }
} }

Loading…
Cancel
Save