diff --git a/android/jni/com/mapswithme/core/jni_helper.cpp b/android/jni/com/mapswithme/core/jni_helper.cpp index f980cd90e1..db458a76aa 100644 --- a/android/jni/com/mapswithme/core/jni_helper.cpp +++ b/android/jni/com/mapswithme/core/jni_helper.cpp @@ -29,7 +29,6 @@ jclass g_httpPayloadClazz; jclass g_httpBackgroundUploaderClazz; jclass g_httpUploaderResultClazz; jclass g_networkPolicyClazz; -jclass g_storageUtilsClazz; jclass g_elevationInfoClazz; jclass g_parsingResultClazz; @@ -59,7 +58,6 @@ JNI_OnLoad(JavaVM * jvm, void *) jni::GetGlobalClassRef(env, "com/mapswithme/util/HttpBackgroundUploader"); g_httpUploaderResultClazz = jni::GetGlobalClassRef(env, "com/mapswithme/util/HttpUploader$Result"); g_networkPolicyClazz = jni::GetGlobalClassRef(env, "com/mapswithme/util/NetworkPolicy"); - g_storageUtilsClazz = jni::GetGlobalClassRef(env, "com/mapswithme/util/StorageUtils"); g_elevationInfoClazz = jni::GetGlobalClassRef(env, "com/mapswithme/maps/bookmarks/data/ElevationInfo"); g_parsingResultClazz = jni::GetGlobalClassRef(env, "com/mapswithme/maps/api/ParsingResult"); @@ -86,7 +84,6 @@ JNI_OnUnload(JavaVM *, void *) env->DeleteGlobalRef(g_httpBackgroundUploaderClazz); env->DeleteGlobalRef(g_httpUploaderResultClazz); env->DeleteGlobalRef(g_networkPolicyClazz); - env->DeleteGlobalRef(g_storageUtilsClazz); env->DeleteGlobalRef(g_elevationInfoClazz); env->DeleteGlobalRef(g_parsingResultClazz); } diff --git a/android/jni/com/mapswithme/core/jni_helper.hpp b/android/jni/com/mapswithme/core/jni_helper.hpp index 1cc3ec5720..5e684856af 100644 --- a/android/jni/com/mapswithme/core/jni_helper.hpp +++ b/android/jni/com/mapswithme/core/jni_helper.hpp @@ -30,7 +30,6 @@ extern jclass g_httpPayloadClazz; extern jclass g_httpBackgroundUploaderClazz; extern jclass g_httpUploaderResultClazz; extern jclass g_networkPolicyClazz; -extern jclass g_storageUtilsClazz; extern jclass g_elevationInfoClazz; extern jclass g_parsingResultClazz; diff --git a/android/jni/com/mapswithme/maps/MwmApplication.cpp b/android/jni/com/mapswithme/maps/MwmApplication.cpp index cf78f25b2c..f06d8bb65d 100644 --- a/android/jni/com/mapswithme/maps/MwmApplication.cpp +++ b/android/jni/com/mapswithme/maps/MwmApplication.cpp @@ -7,6 +7,13 @@ extern "C" { + // static void nativePreparePlatform(String settingsPath); + JNIEXPORT void JNICALL + Java_com_mapswithme_maps_MwmApplication_nativePreparePlatform(JNIEnv * env, jclass clazz, jstring settingsPath) + { + android::Platform::Instance().SetSettingsDir(jni::ToNativeString(env, settingsPath)); + } + // void nativeInitPlatform(String apkPath, String storagePath, String privatePath, String tmpPath, // String obbGooglePath, String flavorName, String buildType, boolean isTablet); JNIEXPORT void JNICALL diff --git a/android/jni/com/mapswithme/platform/Platform.cpp b/android/jni/com/mapswithme/platform/Platform.cpp index 8abd6b686d..9f6eeac40a 100644 --- a/android/jni/com/mapswithme/platform/Platform.cpp +++ b/android/jni/com/mapswithme/platform/Platform.cpp @@ -136,18 +136,6 @@ platform::NetworkPolicy GetCurrentNetworkPolicy() namespace android { -Platform::Platform() -{ - auto env = jni::GetEnv(); - static auto const getSettingsPathId = - jni::GetStaticMethodID(env, g_storageUtilsClazz, "getSettingsPath", "()Ljava/lang/String;"); - - auto const settingsDir = - static_cast(env->CallStaticObjectMethod(g_storageUtilsClazz, getSettingsPathId)); - - SetSettingsDir(jni::ToNativeString(env, settingsDir)); -} - void Platform::Initialize(JNIEnv * env, jobject functorProcessObject, jstring apkPath, jstring storagePath, jstring privatePath, jstring tmpPath, jstring flavorName, jstring buildType, bool isTablet) diff --git a/android/jni/com/mapswithme/platform/Platform.hpp b/android/jni/com/mapswithme/platform/Platform.hpp index 72f0b76738..bc3c419934 100644 --- a/android/jni/com/mapswithme/platform/Platform.hpp +++ b/android/jni/com/mapswithme/platform/Platform.hpp @@ -17,8 +17,6 @@ namespace android class Platform : public ::Platform { public: - Platform(); - void Initialize(JNIEnv * env, jobject functorProcessObject, jstring apkPath, jstring storagePath, jstring privatePath, jstring tmpPath, jstring flavorName, jstring buildType, bool isTablet); diff --git a/android/multidex-config.txt b/android/multidex-config.txt index 44108d379e..5aef164106 100644 --- a/android/multidex-config.txt +++ b/android/multidex-config.txt @@ -26,5 +26,4 @@ com/mapswithme/util/log/LoggerFactory.class com/mapswithme/util/log/ZipLogsTask.class com/mapswithme/util/NetworkPolicy.class com/mapswithme/util/sharing/ShareableInfoProvider.class -com/mapswithme/util/StorageUtils.class com/mapswithme/util/Utils.class diff --git a/android/src/com/mapswithme/maps/MwmApplication.java b/android/src/com/mapswithme/maps/MwmApplication.java index 6bbd7bd801..9be57af27f 100644 --- a/android/src/com/mapswithme/maps/MwmApplication.java +++ b/android/src/com/mapswithme/maps/MwmApplication.java @@ -195,6 +195,7 @@ public class MwmApplication extends Application implements AppBackgroundTracker. return; // First we need initialize paths and platform to have access to settings and other components. + nativePreparePlatform(settingsPath); nativeInitPlatform(StorageUtils.getApkPath(this), StorageUtils.getStoragePath(settingsPath), filesPath, tempPath, @@ -312,6 +313,7 @@ public class MwmApplication extends Application implements AppBackgroundTracker. return mPlayer; } + private static native void nativePreparePlatform(String settingsPath); private native void nativeInitPlatform(String apkPath, String storagePath, String privatePath, String tmpPath, String flavorName, String buildType, boolean isTablet);