From 82f82a6b7d727ff3dcc8b4e5a4d7fc9a214a8596 Mon Sep 17 00:00:00 2001 From: zackhow Date: Sun, 19 Aug 2018 17:38:29 -0400 Subject: Android: Add usage statistics to android. Added an option in General config to enable/disable usage statistics. Added a popup on first open if the user would like to engage in reporting. Clicking cancel or out of the box opts out. Only clicking 'Ok' will enable reporting. Also added a new android specific values to report. --- Source/Android/jni/AndroidCommon/IDCache.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'Source/Android/jni/AndroidCommon/IDCache.cpp') diff --git a/Source/Android/jni/AndroidCommon/IDCache.cpp b/Source/Android/jni/AndroidCommon/IDCache.cpp index 2c457d6c9d..42a5632139 100644 --- a/Source/Android/jni/AndroidCommon/IDCache.cpp +++ b/Source/Android/jni/AndroidCommon/IDCache.cpp @@ -20,6 +20,10 @@ static jmethodID s_game_file_constructor; static jclass s_game_file_cache_class; static jfieldID s_game_file_cache_pointer; +static jclass s_analytics_class; +static jmethodID s_send_analytics_report; +static jmethodID s_get_analytics_value; + namespace IDCache { JavaVM* GetJavaVM() @@ -37,6 +41,20 @@ jmethodID GetDisplayAlertMsg() return s_display_alert_msg; } +jclass GetAnalyticsClass() +{ + return s_analytics_class; +} + +jmethodID GetSendAnalyticsReport() +{ + return s_send_analytics_report; +} + +jmethodID GetAnalyticsValue() +{ + return s_get_analytics_value; +} jclass GetGameFileClass() { return s_game_file_class; @@ -91,6 +109,13 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) s_game_file_cache_class = reinterpret_cast(env->NewGlobalRef(game_file_cache_class)); s_game_file_cache_pointer = env->GetFieldID(game_file_cache_class, "mPointer", "J"); + const jclass analytics_class = env->FindClass("org/dolphinemu/dolphinemu/utils/Analytics"); + s_analytics_class = reinterpret_cast(env->NewGlobalRef(analytics_class)); + s_send_analytics_report = + env->GetStaticMethodID(s_analytics_class, "sendReport", "(Ljava/lang/String;[B)V"); + s_get_analytics_value = env->GetStaticMethodID(s_analytics_class, "getValue", + "(Ljava/lang/String;)Ljava/lang/String;"); + return JNI_VERSION; } @@ -103,6 +128,7 @@ void JNI_OnUnload(JavaVM* vm, void* reserved) env->DeleteGlobalRef(s_native_library_class); env->DeleteGlobalRef(s_game_file_class); env->DeleteGlobalRef(s_game_file_cache_class); + env->DeleteGlobalRef(s_analytics_class); } #ifdef __cplusplus -- cgit v1.2.3