Java 类android.os.StrictMode.VmPolicy 实例源码

项目:StudyBox_Android    文件:DebugHelper.java   
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;
        }
    }
}
项目:Nird2    文件:SplashScreenActivity.java   
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());
    }
}
项目:Nird2    文件:SplashScreenActivity.java   
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());
    }
}
项目:android-shared    文件:StrictModeHelper.java   
/**
 * @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;
}
项目:Transportr    文件:MapActivity.java   
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());
}
项目:agera    文件:NotesApplication.java   
@Override
public void onCreate() {
  super.onCreate();
  setThreadPolicy(new ThreadPolicy.Builder().detectAll().penaltyLog().build());
  setVmPolicy(new VmPolicy.Builder().detectAll().penaltyLog().build());
}