private static void initializeStrictMode() { if (!strictModeInitialized) { if (SDK_INT >= GINGERBREAD) { ThreadPolicy.Builder threadPolicy = new ThreadPolicy.Builder(); VmPolicy.Builder vmPolicy = new VmPolicy.Builder(); threadPolicy.detectAll() .penaltyLog(); vmPolicy.detectAll() .penaltyLog(); if (STRICT_MODE_KILL_ON_ERROR) { threadPolicy.penaltyDeath(); vmPolicy.penaltyDeath(); } StrictMode.setThreadPolicy(threadPolicy.build()); StrictMode.setVmPolicy(vmPolicy.build()); strictModeInitialized = true; } } }
private void enableStrictMode() { if (TESTING) { ThreadPolicy.Builder threadPolicy = new ThreadPolicy.Builder(); threadPolicy.detectAll(); threadPolicy.penaltyLog(); StrictMode.setThreadPolicy(threadPolicy.build()); VmPolicy.Builder vmPolicy = new VmPolicy.Builder(); vmPolicy.detectAll(); vmPolicy.penaltyLog(); StrictMode.setVmPolicy(vmPolicy.build()); } }
/** * @return The current instance of {@link StrictModeHelper}. */ public StrictModeHelper reset() { if (!AppHelper.with(context).isDebuggable()) { return this; } threadBuilder = new ThreadPolicy.Builder(); vmBuilder = new VmPolicy.Builder(); return this; }
private void enableStrictMode() { ThreadPolicy.Builder threadPolicy = new ThreadPolicy.Builder(); threadPolicy.detectAll(); threadPolicy.penaltyLog(); StrictMode.setThreadPolicy(threadPolicy.build()); VmPolicy.Builder vmPolicy = new VmPolicy.Builder(); vmPolicy.detectAll(); vmPolicy.penaltyLog(); StrictMode.setVmPolicy(vmPolicy.build()); }
@Override public void onCreate() { super.onCreate(); setThreadPolicy(new ThreadPolicy.Builder().detectAll().penaltyLog().build()); setVmPolicy(new VmPolicy.Builder().detectAll().penaltyLog().build()); }