您的位置:首页 > 移动开发 > Android开发

[RK3288][Android6.0] 开发者选项中的Strict mode功能

2017-07-17 14:59 639 查看
Platform: Rockchip

OS: Android 6.0

Kernel: 3.10.92

有些页面显示的时候比如预览画面,浏览器四周会出现一圈红框,如下:



这是Google用于开发调试性能的一个功能,解释如下:



在开发者选项中可以设置开关:



当切换时,调用流程如下:

onPreferenceTreeClick -> writeStrictModeVisualOptions -> mWindowManager.setStrictModeVisualIndicatorPreference

public void setStrictModeVisualIndicatorPreference(String value) {
SystemProperties.set(StrictMode.VISUAL_PROPERTY, value);
}


本质上是设置property:

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


使用property的地方:

public static boolean conditionallyEnableDebugLogging() {
boolean doFlashes = SystemProperties.getBoolean(VISUAL_PROPERTY, false)
&& !amTheSystemServerProcess();
}


// Returns the current state of the system property that controls
// strictmode flashes.  One of:
//    0: not explicitly set one way or another
//    1: on
//    2: off
private static int currentStrictModeActiveIndex() {
if (TextUtils.isEmpty(SystemProperties.get(StrictMode.VISUAL_PROPERTY))) {
return 0;
}
boolean enabled = SystemProperties.getBoolean(StrictMode.VISUAL_PROPERTY, false);
return enabled ? 1 : 2;
}


所有去掉红框,只要设置property就可以了。

经网友“绯雨CHRIS丶L”验证去显示红框的时候并没有读取property,可以修改如下:



参考:

StrictMode
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: