Strict Mode Enabled红框

下面的红色代码处就是关闭红框;你可以去除“&& (IS_USER_BUILD || suppress)”条件;或者你也可以在android系统中build.prop添加“persist.sys.strictmode.disable=1”的property

 

    public static final String DISABLE_PROPERTY = "persist.sys.strictmode.disable";

 

    public static final String VISUAL_PROPERTY = "persist.sys.strictmode.visual";

 

StrictMode.java (\frameworks\base\core\java\android\os)        

 

    public static boolean conditionallyEnableDebugLogging() {

        boolean doFlashes = SystemProperties.getBoolean(VISUAL_PROPERTY, false)

                && !amTheSystemServerProcess();

        final boolean suppress = SystemProperties.getBoolean(DISABLE_PROPERTY, false);

 

        // For debug builds, log event loop stalls to dropbox for analysis.

        // Similar logic also appears in ActivityThread.java for system apps.

        if (!doFlashes && (IS_USER_BUILD || suppress)) {

            setCloseGuardEnabled(false);

            return false;

        }

 

        // Eng builds have flashes on all the time.  The suppression property

        // overrides this, so we force the behavior only after the short-circuit

        // check above.

        if (IS_ENG_BUILD) {

            doFlashes = true;

        }

 

        // Thread policy controls BlockGuard.

        int threadPolicyMask = StrictMode.DETECT_DISK_WRITE |

                StrictMode.DETECT_DISK_READ |

                StrictMode.DETECT_NETWORK;

 

        if (!IS_USER_BUILD) {

            threadPolicyMask |= StrictMode.PENALTY_DROPBOX;

        }

        if (doFlashes) {

            threadPolicyMask |= StrictMode.PENALTY_FLASH;

        }

 

        StrictMode.setThreadPolicyMask(threadPolicyMask);

 

        // VM Policy controls CloseGuard, detection of Activity leaks,

        // and instance counting.

        if (IS_USER_BUILD) {

            setCloseGuardEnabled(false);

        } else {

            VmPolicy.Builder policyBuilder = new VmPolicy.Builder().detectAll().penaltyDropBox();

            if (IS_ENG_BUILD) {

                policyBuilder.penaltyLog();

            }

            setVmPolicy(policyBuilder.build());

            setCloseGuardEnabled(vmClosableObjectLeaksEnabled());

        }

        return true;

    }

前提到的“可以在android系统中build.prop添加“persist.sys.strictmode.disable=1”的property”是临时调试方法,下面的红色标注添加是固化到编译的Img中。

 

\configs\init_for_mmc.rc

 

\configs\init_for_mmc_sd2.rc

 

\configs\init_for_nand.rc

 

setprop ro.sf.lcd_density 133

setprop dalvik.vm.heapsize 48m

setprop persist.sys.usb.config adb,mass_storage

setprop persist.sys.strictmode.disable 1

setprop persist.sys.strictmode.visual 0

setprop persist.current.usb.mode device

setprop ro.atc.drm 0


转载于:https://my.oschina.net/u/169988/blog/314416

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值