/*
 * Copyright (C) 2015 Square, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.example.leakcanary;

import android.app.Application;
import android.os.StrictMode;
import com.squareup.leakcanary.LeakCanary;

public class ExampleApplication extends Application {
  @Override public void onCreate() {
    super.onCreate();
    setupLeakCanary();
  }

  protected void setupLeakCanary() {
    enabledStrictMode();
    if (LeakCanary.isInAnalyzerProcess(this)) {
      // This process is dedicated to LeakCanary for heap analysis.
      // You should not init your app in this process.
      return;
    }
    LeakCanary.install(this);
  }

  private static void enabledStrictMode() {
    StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() //
        .detectAll() //
        .penaltyLog() //
        .penaltyDeath() //
        .build());
  }
}

@@ -659,16 +659,41 @@
 cation;%0A
+import android.os.Build;%0A
 import a
@@ -714,16 +714,16 @@
 ctMode;%0A
-
 import c
@@ -1246,19 +1246,16 @@
 ictMode.
-set
 ThreadPo
@@ -1258,17 +1258,35 @@
 adPolicy
-(
+.Builder builder = 
 new Stri
@@ -1318,69 +1318,476 @@
 er()
- //
+;%0A    // Disabled DiskReadViolation, see https://github.com/square/leakcanary/issues/1222
 %0A    
+//
     
-.detectAll() //%0A        .penaltyLog() //%0A        
+builder.detectDiskReads();%0A    builder.detectDiskWrites();%0A    builder.detectNetwork();%0A    builder.detectCustomSlowCalls();%0A    if (Build.VERSION.SDK_INT %3E= Build.VERSION_CODES.M) %7B%0A      builder.detectResourceMismatches();%0A    %7D%0A    if (Build.VERSION.SDK_INT %3E= Build.VERSION_CODES.O) %7B%0A      builder.detectUnbufferedIo();%0A    %7D%0A    builder.penaltyLog();%0A    builder
 .pen
@@ -1801,20 +1801,48 @@
 th()
- //
+;
 %0A    
-    
+StrictMode.setThreadPolicy(builder
 .bui

Disable StrictMode DiskReadViolation (#1223)