本文整理汇总了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());
}
}
示例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());
}
}
示例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();
}
示例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());
}
}
示例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();
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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();
}
示例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());
}
示例13: enableVmPolicy
import android.os.StrictMode; //导入方法依赖的package包/类
private void enableVmPolicy() {
StrictMode.setVmPolicy(
new StrictMode.VmPolicy.Builder()
.detectAll()
.penaltyLog()
.build()
);
}
示例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());
}
}
示例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);
}