Skip to content

Commit

Permalink
Fix Strict mode violations
Browse files Browse the repository at this point in the history
TMP COMMIT, DO NOT MERGE.

This enables Strict Mode in the sample app. Once #27 is merged, we can move forwards fixing all strict mode violations.
  • Loading branch information
pyricau committed May 10, 2015
1 parent 48be9a1 commit e4ddbff
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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());
}
}

0 comments on commit e4ddbff

Please sign in to comment.