系统默认值的设定

2024-01-08 08:32:55

Screen saver option should be off by default on MC94.

Actual Results:?Settings-display has a option: screen saver

Expected Results:?Screen saver should be removed

Reproduction Steps:

  1. Launch settings-Display, check the screen saver option

Comparative Data:? MC93/Jaws also have screen saver

设定系统属性的默认值的位置:
frameworks/base/+/440853/4/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
frameworks/base/core/res/res/values/config.xml
frameworks/base/core/res/res/values/symbols.xml
?

这边的例子就是新增一个字段去设定默认值
sysmbols.xml config.xml里 定义新的字段:

DatabaseHelper.java:

 private void loadSecureSettings(SQLiteDatabase db) {
        SQLiteStatement stmt = null;
        try {
            stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)"
                    + " VALUES(?,?);");

            // Don't do this.  The SystemServer will initialize ADB_ENABLED from a
            // persistent system property instead.
            //loadSetting(stmt, Settings.Secure.ADB_ENABLED, 0);

            // Allow mock locations default, based on build
            loadSetting(stmt, Settings.Secure.ALLOW_MOCK_LOCATION,
                    "1".equals(SystemProperties.get("ro.allow.mock.location")) ? 1 : 0);

            loadSecure35Settings(stmt);

            ...

            loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD,
                    R.bool.def_accessibility_speak_password);

            if (SystemProperties.getBoolean("ro.lockscreen.disable.default", false) == true) {
                loadSetting(stmt, Settings.System.LOCKSCREEN_DISABLED, "1");
            } else {
                loadBooleanSetting(stmt, Settings.System.LOCKSCREEN_DISABLED,
                        R.bool.def_lockscreen_disabled);
            }

            if (ZebraUtils.isZebra().orElse(false) && ZebraUtils.getDefScreenSaverStart().orElse(-1) == 0){
                loadBooleanSetting(stmt, Settings.Secure.SCREENSAVER_ENABLED,
                        com.android.internal.R.bool.config_dreamsEnabledByDefault_never);
            } else {
                loadBooleanSetting(stmt, Settings.Secure.SCREENSAVER_ENABLED,
                        com.android.internal.R.bool.config_dreamsEnabledByDefault);
            }
            loadBooleanSetting(stmt, Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK,
                    com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault);
            loadBooleanSetting(stmt, Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP,
                    com.android.internal.R.bool.config_dreamsActivatedOnSleepByDefault);
            loadStringSetting(stmt, Settings.Secure.SCREENSAVER_DEFAULT_COMPONENT,
                    com.android.internal.R.string.config_dreamsDefaultComponent);
            if (ZebraUtils.isDeviceMoneypenny().orElse(false)) {
            loadStringSetting(stmt, Settings.Secure.SCREENSAVER_COMPONENTS,
                    com.android.internal.R.string.config_dreamsDefaultComponentPS30);
            }
}

文章来源:https://blog.csdn.net/Leif_dong/article/details/135409448
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。