Forked from dmytrodanylyk/gist:94476bc3154871390d6aaf3b1a976fa6
Created
January 19, 2017 09:26
-
-
Save FAQEnD/1af9a251f157811b2b9900e4969f9040 to your computer and use it in GitHub Desktop.
Strict Mode
This file contains hidden or 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