summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorfupduck <fupduck@riseup.net>2018-01-19 08:44:27 -0800
committerfupduck <fupduck@riseup.net>2018-01-19 08:44:27 -0800
commit1393b75a17d1c7a60b9ca72a874535824d63db2d (patch)
tree1b7279bd85200b04478f9bfe2933f9075385b703 /app
parent276453c90042eae745681275da25c6894fb6554c (diff)
parentdbda5fbf23ccad615e932be6b8869fe34a6b440d (diff)
Merge branch '0.9.8' into '8811_rename_vpn_to_provider_name'
# Conflicts: # app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java
Diffstat (limited to 'app')
-rw-r--r--app/build.gradle14
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java26
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java7
-rw-r--r--app/src/main/res/values/strings.xml2
4 files changed, 47 insertions, 2 deletions
diff --git a/app/build.gradle b/app/build.gradle
index cb865ecd..b28d9f35 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -77,6 +77,9 @@ dependencies {
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.6.3'
testCompile 'junit:junit:4.12'
testCompile 'org.json:json:20170516'
+ debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
+ releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
+ betaCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
compile 'com.jakewharton:butterknife:6.1.0'
provided 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'com.github.pedrovgs:renderers:1.5'
@@ -92,6 +95,17 @@ dependencies {
compile 'com.android.support:support-fragment:26.1.0'
}
+// Ensure the no-op dependency is always used in JVM tests.
+configurations.all { config ->
+ if (config.name.contains('UnitTest')) {
+ config.resolutionStrategy.eachDependency { details ->
+ if (details.requested.group == 'com.squareup.leakcanary' && details.requested.name == 'leakcanary-android') {
+ details.useTarget(group: details.requested.group, name: 'leakcanary-android-no-op', version: details.requested.version)
+ }
+ }
+ }
+}
+
def processFileInplace(file, Closure processText) {
def text = file.text
file.write(processText(text))
diff --git a/app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java b/app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java
index 88a01b62..f9e45b79 100644
--- a/app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java
+++ b/app/src/main/java/se/leap/bitmaskclient/BitmaskApp.java
@@ -1,6 +1,10 @@
package se.leap.bitmaskclient;
import android.app.Application;
+import android.content.Context;
+
+import com.squareup.leakcanary.LeakCanary;
+import com.squareup.leakcanary.RefWatcher;
/**
* Created by cyberta on 24.10.17.
@@ -8,11 +12,31 @@ import android.app.Application;
public class BitmaskApp extends Application {
+ private RefWatcher refWatcher;
+
@Override
public void onCreate() {
super.onCreate();
+ if (LeakCanary.isInAnalyzerProcess(this)) {
+ // This process is dedicated to LeakCanary for heap analysis.
+ // You should not init your app in this process.
+ return;
+ }
+ refWatcher = LeakCanary.install(this);
+ // Normal app init code...*/
PRNGFixes.apply();
- //TODO: add LeakCanary!
}
+ /**
+ * Use this method to get a RefWatcher object that checks for memory leaks in the given context.
+ * Call refWatcher.watch(this) to check if all references get garbage collected.
+ * @param context
+ * @return the RefWatcher object
+ */
+ public static RefWatcher getRefWatcher(Context context) {
+ BitmaskApp application = (BitmaskApp) context.getApplicationContext();
+ return application.refWatcher;
+ }
+
+
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java
index ef59185a..dbe99dce 100644
--- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java
@@ -34,6 +34,7 @@ import se.leap.bitmaskclient.fragments.AboutFragment;
import se.leap.bitmaskclient.fragments.LogFragment;
import static android.content.Context.MODE_PRIVATE;
+import static se.leap.bitmaskclient.BitmaskApp.getRefWatcher;
import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER;
import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
@@ -268,6 +269,12 @@ public class NavigationDrawerFragment extends Fragment {
return super.onOptionsItemSelected(item);
}
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ getRefWatcher(getActivity()).watch(this);
+ }
+
/**
* Per the navigation drawer design guidelines, updates the action bar to show the global app
* 'context', rather than just what's in the current screen.
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 9536d96e..96b79222 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -64,7 +64,7 @@
<string name="eip_status_start_pending">Initiating connection</string>
<string name="eip_cancel_connect_title">Cancel connection?</string>
<string name="eip_cancel_connect_text">There is a connection attempt in progress. Do you wish to cancel it?</string>
- <string name="eip.warning.browser_inconsistency">In order to avoid leaking your personal information, please close your browser and start a private window after disconnecting the Encrypted VPN Internet Access. Thanks.</string>
+ <string name="eip.warning.browser_inconsistency">Turn off VPN connection? When the VPN is off, you may leak personal information to your Internet provider or local network.</string>
<string name="eip_state_not_connected">"Not running! Insecure connection!"</string>
<string name="eip_state_connected">Connection Secure.</string>
<string name="provider_problem">It seems there is a problem with the provider.</string>