From e7aa298b9f8ee65ee32a2a57bc2e878cc3ee9b76 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Ricau Date: Sun, 10 May 2015 09:10:14 -0700 Subject: [PATCH] Fix Strict mode violations TMP COMMIT, DO NOT MERGE. This enables Strict Mode. Once #27 is merged, we can move forwards fixing all strict mode violations. --- .../example/leakcanary/ExampleApplication.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/library/leakcanary-sample/src/main/java/com/example/leakcanary/ExampleApplication.java b/library/leakcanary-sample/src/main/java/com/example/leakcanary/ExampleApplication.java index 220e05ec06..419b3e2f9f 100644 --- a/library/leakcanary-sample/src/main/java/com/example/leakcanary/ExampleApplication.java +++ b/library/leakcanary-sample/src/main/java/com/example/leakcanary/ExampleApplication.java @@ -17,6 +17,7 @@ import android.app.Application; import android.content.Context; +import android.os.StrictMode; import com.squareup.leakcanary.LeakCanary; import com.squareup.leakcanary.RefWatcher; @@ -32,5 +33,19 @@ public static RefWatcher getRefWatcher(Context context) { @Override public void onCreate() { super.onCreate(); refWatcher = LeakCanary.install(this); + enabledStrictMode(); + } + + private void enabledStrictMode() { + StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() // + .detectAll() // + .penaltyLog() // + .penaltyDeath() // + .build()); + StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() // + .detectAll() // + .penaltyLog() // + .penaltyDeath() // + .build()); } }