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

来源:互联网 发布:光盘数据恢复软件 编辑:程序博客网 时间:2024/06/14 00:10

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

阅读全文
1 0
原创粉丝点击