diff --git a/android/jni/com/mapswithme/platform/Platform.cpp b/android/jni/com/mapswithme/platform/Platform.cpp index eda3bfde9f..de1befd9f6 100644 --- a/android/jni/com/mapswithme/platform/Platform.cpp +++ b/android/jni/com/mapswithme/platform/Platform.cpp @@ -41,6 +41,26 @@ std::string Platform::GetMemoryInfo() const return jni::ToNativeString(env, memInfoString); } +std::string Platform::DeviceName() const +{ + JNIEnv * env = jni::GetEnv(); + static jmethodID const getDeviceNameId = jni::GetStaticMethodID(env, g_utilsClazz, "getDeviceName", + "()Ljava/lang/String;"); + auto const deviceName = static_cast(env->CallStaticObjectMethod(g_utilsClazz, + getDeviceNameId)); + return jni::ToNativeString(env, deviceName); +} + +std::string Platform::DeviceModel() const +{ + JNIEnv * env = jni::GetEnv(); + static jmethodID const getDeviceModelId = jni::GetStaticMethodID(env, g_utilsClazz, "getDeviceModel", + "()Ljava/lang/String;"); + auto const deviceModel = static_cast(env->CallStaticObjectMethod(g_utilsClazz, + getDeviceModelId)); + return jni::ToNativeString(env, deviceModel); +} + void Platform::RunOnGuiThread(base::TaskLoop::Task && task) { android::Platform::Instance().RunOnGuiThread(std::move(task)); diff --git a/android/src/com/mapswithme/util/Utils.java b/android/src/com/mapswithme/util/Utils.java index caeaffa9f5..5969b1eedb 100644 --- a/android/src/com/mapswithme/util/Utils.java +++ b/android/src/com/mapswithme/util/Utils.java @@ -32,7 +32,6 @@ import com.mapswithme.maps.BuildConfig; import com.mapswithme.maps.MwmApplication; import com.mapswithme.maps.R; import com.mapswithme.maps.activity.CustomNavigateUpListener; -import com.mapswithme.maps.taxi.TaxiManager; import com.mapswithme.util.concurrency.UiThread; import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.LoggerFactory; @@ -165,7 +164,7 @@ public class Utils return Uri.parse(uriString); } - public static String getDeviceModel() + public static String getFullDeviceModel() { String model = Build.MODEL; if (!model.startsWith(Build.MANUFACTURER)) @@ -469,6 +468,18 @@ public class Utils return INVALID_ID; } + @NonNull + public static String getDeviceName() + { + return Build.MANUFACTURER; + } + + @NonNull + public static String getDeviceModel() + { + return Build.MODEL; + } + private static class OnZipCompletedCallback implements LoggerFactory.OnZipCompletedListener { @NonNull diff --git a/android/src/com/mapswithme/util/log/FileLoggerStrategy.java b/android/src/com/mapswithme/util/log/FileLoggerStrategy.java index 6f335ec8ab..d22f605067 100644 --- a/android/src/com/mapswithme/util/log/FileLoggerStrategy.java +++ b/android/src/com/mapswithme/util/log/FileLoggerStrategy.java @@ -168,7 +168,7 @@ class FileLoggerStrategy implements LoggerStrategy static void writeSystemInformation(FileWriter fw) throws IOException { fw.write("Android version: " + Build.VERSION.SDK_INT + "\n"); - fw.write("Device: " + Utils.getDeviceModel() + "\n"); + fw.write("Device: " + Utils.getFullDeviceModel() + "\n"); fw.write("App version: " + BuildConfig.APPLICATION_ID + " " + BuildConfig.VERSION_NAME + "\n"); fw.write("Installation ID: " + Utils.getInstallationId() + "\n"); fw.write("Locale : " + Locale.getDefault()); diff --git a/platform/platform_android.cpp b/platform/platform_android.cpp index 78df4b652e..dc19c31d78 100644 --- a/platform/platform_android.cpp +++ b/platform/platform_android.cpp @@ -191,16 +191,6 @@ unique_ptr Platform::GetReader(string const & file, string const & return nullptr; } -string Platform::DeviceName() const -{ - return OMIM_OS_NAME; -} - -string Platform::DeviceModel() const -{ - return {}; -} - void Platform::GetFilesByRegExp(string const & directory, string const & regexp, FilesList & res) { if (ZipFileReader::IsZip(directory))