当前位置: 首页>>代码示例>>Java>>正文


Java StrictMode.setVmPolicy方法代码示例

本文整理汇总了Java中android.os.StrictMode.setVmPolicy方法的典型用法代码示例。如果您正苦于以下问题:Java StrictMode.setVmPolicy方法的具体用法?Java StrictMode.setVmPolicy怎么用?Java StrictMode.setVmPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.StrictMode的用法示例。


在下文中一共展示了StrictMode.setVmPolicy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.os.StrictMode; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    DebugSettings.initialize(this);
    if (DEBUG) {
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                .detectAll()
                .penaltyLog()
                .build());
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                .detectAll()
                .penaltyLog()
                .build());
    }
}
 
开发者ID:ecaroff,项目名称:sekai,代码行数:17,代码来源:AdUnitsSampleApplication.java

示例2: init

import android.os.StrictMode; //导入方法依赖的package包/类
public static void init(Context context) {
    // check if android:debuggable is set to true
    int appFlags = context.getApplicationInfo().flags;
    if ((appFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                .detectDiskReads()
                .detectDiskWrites()
                .detectNetwork()
                .penaltyLog()
                .build());
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                .detectLeakedSqlLiteObjects()
                .penaltyLog()
                .penaltyDeath()
                .build());
    }
}
 
开发者ID:BlueYangDroid,项目名称:MvpPlus,代码行数:18,代码来源:StrictModeWrapper.java

示例3: onCreate

import android.os.StrictMode; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@SuppressWarnings("unused")
@Override
public void onCreate()
{
	if (CDKApplication.Config.DEVELOPER_MODE && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
	{
		StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyDialog().build());
		StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyDeath().build());
	}

	super.onCreate();
	mContext = getApplicationContext();

	// 保存文件目录
	mVersion = getGVerion();
	// XPreferenceManager.putGVersion(mVersion);

	// MemoryHelper.loadDefaultVmPolicy();
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:21,代码来源:GApplication.java

示例4: onCreate

import android.os.StrictMode; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    Fabric.with(this, new Crashlytics());
    Utils.configureLogger();
    instance = this;
    //registerActivityLifecycleCallbacks(this);
    if (BuildConfig.DEBUG) {
        // Detect UI-Thread blockage
        //BlockCanary.install(this, new AppBlockCanaryContext()).start();
        //// Detect memory leakage
        //if (!LeakCanary.isInAnalyzerProcess(this)) {
        //    LeakCanary.install(this);
        //}
        // Detect thread violation
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyDropBox().penaltyLog().build());
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll()
                                                                        .penaltyDropBox()
                                                                        .penaltyLog()
                                                                        .build());
    }
}
 
开发者ID:dji-sdk,项目名称:Android-Bridge-App,代码行数:23,代码来源:BridgeApplication.java

示例5: init

import android.os.StrictMode; //导入方法依赖的package包/类
private void init() {
    if (BuildConfig.DEBUG) {
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());
    }

    applicationComponent = DaggerApplicationComponent.builder()
            .applicationModule(new ApplicationModule(this))
            .build();
}
 
开发者ID:HotBitmapGG,项目名称:Acg,代码行数:11,代码来源:DebugDemoApp.java

示例6: onCreate

import android.os.StrictMode; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    // Detect all kind of problems and log it
    StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
            .detectAll()
            .penaltyLog()
            .build());

    StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
            .detectAll()
            .penaltyLog()
            .build());
}
 
开发者ID:TechIsFun,项目名称:SlidingSwitch,代码行数:16,代码来源:SlidingswitchApplication.java

示例7: initStrictMode

import android.os.StrictMode; //导入方法依赖的package包/类
private void initStrictMode() {
    StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
            .detectAll()
            .penaltyLog()
            .build());
    StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
            .detectAll()
            .penaltyLog()
            .build());
}
 
开发者ID:scana,项目名称:subscriptions-leak-example,代码行数:11,代码来源:App.java

示例8: setupViews

import android.os.StrictMode; //导入方法依赖的package包/类
@Override
protected void setupViews() {
    setSupportActionBar(toolbar);
    //noinspection ConstantConditions
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getWindow().getDecorView().requestFocus();

    mapView.getMapAsync(this);

    // https://stackoverflow.com/a/40674771/4208583
    StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
    StrictMode.setVmPolicy(builder.build());
}
 
开发者ID:GrenderG,项目名称:Protestr,代码行数:14,代码来源:CreateEventActivity.java

示例9: onCreate

import android.os.StrictMode; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@SuppressWarnings("unused")
@Override
public void onCreate() {
	if (Constants.Config.DEVELOPER_MODE && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
		StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyDialog().build());
		StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyDeath().build());
	}

	super.onCreate();

	initImageLoader(getApplicationContext());
}
 
开发者ID:siwangqishiq,项目名称:ImageLoaderSupportGif,代码行数:14,代码来源:UILApplication.java

示例10: setStrictMode

import android.os.StrictMode; //导入方法依赖的package包/类
private void setStrictMode() {
    StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
            .detectAll()
            .penaltyLog()
            .build());
    StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
            .detectLeakedSqlLiteObjects()
            .detectLeakedClosableObjects()
            .penaltyLog()
            .penaltyDeath()
            .build());

}
 
开发者ID:yangyankai,项目名称:Seconds,代码行数:14,代码来源:ActivityCommon2.java

示例11: onCreate

import android.os.StrictMode; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    /*
       解决 7.0 uri 暴露异常
     */
    StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
    StrictMode.setVmPolicy(builder.build());
    builder.detectFileUriExposure();
}
 
开发者ID:StickyTolt,项目名称:ForeverLibrary,代码行数:12,代码来源:BaseApplication.java

示例12: enableStrictMode

import android.os.StrictMode; //导入方法依赖的package包/类
private void enableStrictMode() {
	StrictMode.setThreadPolicy(
			new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites()
					.detectNetwork().penaltyLog().build());
	StrictMode.setVmPolicy(
			new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().penaltyLog()
					.penaltyDeath().build());
}
 
开发者ID:hearsilent,项目名称:AmazingAvatar,代码行数:9,代码来源:BaseApplication.java

示例13: enableVmPolicy

import android.os.StrictMode; //导入方法依赖的package包/类
private void enableVmPolicy() {
    StrictMode.setVmPolicy(
            new StrictMode.VmPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .build()
    );
}
 
开发者ID:jiangkang,项目名称:KTools,代码行数:9,代码来源:KApplication.java

示例14: onCreate

import android.os.StrictMode; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
        StrictMode.setVmPolicy(builder.build());
    }
}
 
开发者ID:lizhangqu,项目名称:CorePatch,代码行数:9,代码来源:App.java

示例15: onCreate

import android.os.StrictMode; //导入方法依赖的package包/类
@Override
public void onCreate() {
    if (AppConfig.DEVELOPER_MODE) {
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                .detectAll().penaltyLog().build());
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                .detectAll().penaltyLog().build());
    }

    super.onCreate();
    SharedPreferencesEditor.init(this);
    SSLResource sslResource = new SSLResource(this);
    SSLManager.init(sslResource);
}
 
开发者ID:CactusSoft,项目名称:zabbkit-android,代码行数:15,代码来源:ZabbkitApplication.java


注:本文中的android.os.StrictMode.setVmPolicy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。