Forked from dmytrodanylyk/gist:94476bc3154871390d6aaf3b1a976fa6
Created
January 18, 2017 14:33
-
-
Save yakivmospan/f4a0385877242a305150275520493173 to your computer and use it in GitHub Desktop.
Strict Mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (BuildConfig.DEBUG) { | |
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() | |
.detectCustomSlowCalls() | |
.detectDiskReads() | |
.detectDiskWrites() | |
.detectNetwork() | |
.penaltyLog() | |
.build()); | |
StrictMode.VmPolicy.Builder vmPolicy = new StrictMode.VmPolicy.Builder() | |
.detectActivityLeaks() | |
.detectLeakedClosableObjects(); | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | |
vmPolicy = vmPolicy.detectCleartextNetwork(); | |
} | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { | |
vmPolicy = vmPolicy.detectFileUriExposure(); | |
} | |
StrictMode.setVmPolicy(vmPolicy.penaltyLog().build()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment