Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Zolotarev <alex@maps.me>2015-09-08 18:11:47 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:06:36 +0300
commitb49f60050f61e974b3e24e9b9157b1b3218387a7 (patch)
tree06e3ebaf4e310e5263ca040965bc1430f9d2d578
parent5c2ae58903de47473b31b8aa504e7b15258dd707 (diff)
[android] Secured sensitive constants.
-rw-r--r--android/build.gradle10
-rw-r--r--android/gradle.properties2
-rw-r--r--android/jni/Android.mk4
-rw-r--r--android/jni/com/mapswithme/maps/PrivateVariables.cpp36
-rw-r--r--android/res/values/donottranslate.xml6
-rw-r--r--android/src/com/mapswithme/maps/MwmApplication.java2
-rw-r--r--android/src/com/mapswithme/maps/PrivateVariables.java13
-rw-r--r--android/src/com/mapswithme/util/statistics/Statistics.java8
8 files changed, 62 insertions, 19 deletions
diff --git a/android/build.gradle b/android/build.gradle
index a7012c0422..231ccd4e71 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -15,6 +15,7 @@ allprojects {
}
apply plugin: 'com.android.application'
+apply from: 'secure.properties'
dependencies {
// android support libs
@@ -56,7 +57,6 @@ android {
minSdkVersion propMinSdkVersion.toInteger()
targetSdkVersion propTargetSdkVersion.toInteger()
applicationId 'com.mapswithme.maps.pro'
- buildConfigField 'String', 'STATISTICS_URL', propStatisticsUrl
buildConfigField 'String', 'SUPPORT_MAIL', '"android@maps.me"'
buildConfigField 'String', 'REVIEW_URL', '"market://details?id=com.mapswithme.maps.pro"'
buildConfigField 'int', 'RATING_THRESHOLD', '5'
@@ -192,10 +192,10 @@ android {
signingConfigs {
mapswithme {
- storeFile file('../tools/android/mapswithme.keystore')
- storePassword '***REMOVED***'
- keyAlias 'mapswithme'
- keyPassword '***REMOVED***'
+ storeFile file(spropStoreFile)
+ storePassword spropStorePassword
+ keyAlias spropKeyAlias
+ keyPassword spropKeyPassword
}
mapswithmeDebug {
diff --git a/android/gradle.properties b/android/gradle.properties
index 66ae0758f0..116ba9e0bc 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -7,5 +7,3 @@ propVersionCode=510
propVersionName=5.1
propDebugNdkFlags=V=1 NDK_DEBUG=1 DEBUG=1
propReleaseNdkFlags=V=1 NDK_DEBUG=0 PRODUCTION=1
-
-propStatisticsUrl="http://localhost:8080" \ No newline at end of file
diff --git a/android/jni/Android.mk b/android/jni/Android.mk
index 9ad6f806dc..84dd9addff 100644
--- a/android/jni/Android.mk
+++ b/android/jni/Android.mk
@@ -57,7 +57,8 @@ endif
TARGET_PLATFORM := android-15
LOCAL_HEADER_FILES := \
- com/mapswithme/core/jni_helper.hpp \
+ ../../private.h \
+ com/mapswithme/core/jni_helper.hpp \
com/mapswithme/core/logging.hpp \
com/mapswithme/core/render_context.hpp \
com/mapswithme/maps/Framework.hpp \
@@ -89,6 +90,7 @@ LOCAL_SRC_FILES := \
com/mapswithme/maps/LocationState.cpp \
com/mapswithme/maps/MapStorage.cpp \
com/mapswithme/maps/DownloadResourcesActivity.cpp \
+ com/mapswithme/maps/PrivateVariables.cpp \
com/mapswithme/maps/SearchFragment.cpp \
com/mapswithme/maps/settings/UnitLocale.cpp \
com/mapswithme/platform/Platform.cpp \
diff --git a/android/jni/com/mapswithme/maps/PrivateVariables.cpp b/android/jni/com/mapswithme/maps/PrivateVariables.cpp
new file mode 100644
index 0000000000..7f7bb1a8fa
--- /dev/null
+++ b/android/jni/com/mapswithme/maps/PrivateVariables.cpp
@@ -0,0 +1,36 @@
+#include "private.h"
+
+#include <jni.h>
+
+extern "C"
+{
+ JNIEXPORT jstring JNICALL
+ Java_com_mapswithme_maps_PrivateVariables_alohalyticsUrl(JNIEnv * env, jclass)
+ {
+ return env->NewStringUTF(ALOHALYTICS_URL);
+ }
+
+ JNIEXPORT jstring JNICALL
+ Java_com_mapswithme_maps_PrivateVariables_flurryKey(JNIEnv * env, jclass)
+ {
+ return env->NewStringUTF(FLURRY_KEY);
+ }
+
+ JNIEXPORT jstring JNICALL
+ Java_com_mapswithme_maps_PrivateVariables_myTrackerKey(JNIEnv * env, jclass)
+ {
+ return env->NewStringUTF(MY_TRACKER_KEY);
+ }
+
+ JNIEXPORT jstring JNICALL
+ Java_com_mapswithme_maps_PrivateVariables_parseApplicationId(JNIEnv * env, jclass)
+ {
+ return env->NewStringUTF(PARSE_APPLICATION_ID);
+ }
+
+ JNIEXPORT jstring JNICALL
+ Java_com_mapswithme_maps_PrivateVariables_parseClientKey(JNIEnv * env, jclass)
+ {
+ return env->NewStringUTF(PARSE_CLIENT_KEY);
+ }
+}
diff --git a/android/res/values/donottranslate.xml b/android/res/values/donottranslate.xml
index d81d5190e6..78b1ba0273 100644
--- a/android/res/values/donottranslate.xml
+++ b/android/res/values/donottranslate.xml
@@ -2,15 +2,9 @@
<resources>
<string name="shared_user_label" translatable="false">Maps With Me</string>
- <!-- FLURRY -->
- <string name="flurry_app_key" translatable="false">***REMOVED***</string>
-
<!-- FB -->
<string name="fb_app_id" translatable="false">185237551520383</string>
- <!-- myTracker -->
- <string name="my_tracker_app_id" translatable="false">***REMOVED***</string>
-
<!-- Font names -->
<string name="robotoLight" translatable="false">sans-serif-light</string>
<string name="robotoRegular" translatable="false">sans-serif</string>
diff --git a/android/src/com/mapswithme/maps/MwmApplication.java b/android/src/com/mapswithme/maps/MwmApplication.java
index eca6b8c5f9..dd793893e7 100644
--- a/android/src/com/mapswithme/maps/MwmApplication.java
+++ b/android/src/com/mapswithme/maps/MwmApplication.java
@@ -227,7 +227,7 @@ public class MwmApplication extends android.app.Application implements ActiveCou
*/
private void initParse()
{
- Parse.initialize(this, "***REMOVED***", "***REMOVED***");
+ Parse.initialize(this, PrivateVariables.parseApplicationId(), PrivateVariables.parseClientKey());
ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback()
{
@Override
diff --git a/android/src/com/mapswithme/maps/PrivateVariables.java b/android/src/com/mapswithme/maps/PrivateVariables.java
new file mode 100644
index 0000000000..7d95da89c9
--- /dev/null
+++ b/android/src/com/mapswithme/maps/PrivateVariables.java
@@ -0,0 +1,13 @@
+package com.mapswithme.maps;
+
+/**
+ * Interface to re-use some important variables from C++.
+ */
+public class PrivateVariables
+{
+ public static native String alohalyticsUrl();
+ public static native String flurryKey();
+ public static native String myTrackerKey();
+ public static native String parseApplicationId();
+ public static native String parseClientKey();
+}
diff --git a/android/src/com/mapswithme/util/statistics/Statistics.java b/android/src/com/mapswithme/util/statistics/Statistics.java
index ed4b97621f..ff96030734 100644
--- a/android/src/com/mapswithme/util/statistics/Statistics.java
+++ b/android/src/com/mapswithme/util/statistics/Statistics.java
@@ -9,7 +9,7 @@ import com.flurry.android.FlurryAgent;
import com.mapswithme.country.ActiveCountryTree;
import com.mapswithme.maps.BuildConfig;
import com.mapswithme.maps.MwmApplication;
-import com.mapswithme.maps.R;
+import com.mapswithme.maps.PrivateVariables;
import com.mapswithme.maps.api.ParsedMwmRequest;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.SimpleLogger;
@@ -268,17 +268,17 @@ public enum Statistics
FlurryAgent.setLogLevel(BuildConfig.DEBUG ? Log.DEBUG : Log.ERROR);
FlurryAgent.setVersionName(BuildConfig.VERSION_NAME);
FlurryAgent.setCaptureUncaughtExceptions(false);
- FlurryAgent.init(context, context.getString(R.string.flurry_app_key));
+ FlurryAgent.init(context, PrivateVariables.flurryKey());
MRMyTracker.setDebugMode(BuildConfig.DEBUG);
- MRMyTracker.createTracker(context.getString(R.string.my_tracker_app_id), context);
+ MRMyTracker.createTracker(PrivateVariables.myTrackerKey(), context);
final MRMyTrackerParams myParams = MRMyTracker.getTrackerParams();
myParams.setTrackingPreinstallsEnabled(true);
myParams.setTrackingLaunchEnabled(true);
MRMyTracker.initTracker();
org.alohalytics.Statistics.setDebugMode(BuildConfig.DEBUG);
- org.alohalytics.Statistics.setup(BuildConfig.STATISTICS_URL, context);
+ org.alohalytics.Statistics.setup(PrivateVariables.alohalyticsUrl(), context);
}
}