android修改或添加SettingsProvider的默认值

有些系统属性定义在frameworks/base/core/java/android/provider/Settings.java文件中,其中分为System、Global、Secure。

调试时,可以通过get和put指令,临时获取和修改相应的属性:
例如:
adb shell settings get global animator_duration_scale

当调试完毕,确定需要修改的值后,可以通过如下patch进行修改,最后恢复出厂设置验证是否生效。

Index: frameworks/base/packages/SettingsProvider/res/values/defaults.xml
===================================================================
--- frameworks/base/packages/SettingsProvider/res/values/defaults.xml	(版本 680)
+++ frameworks/base/packages/SettingsProvider/res/values/defaults.xml	(工作副本)
@@ -214,5 +214,7 @@

     <!-- Default for Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED -->
     <integer name="def_captive_portal_detection_enabled">0</integer>
+    
+    <integer name="def_animator_duration_scale">0</integer>
 
 </resources>
Index: frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
===================================================================
--- frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java	(版本 680)
+++ frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java	(工作副本)
@@ -2768,6 +2768,9 @@
             loadIntegerSetting(stmt, Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED,
                     R.integer.def_captive_portal_detection_enabled);

+
+            loadIntegerSetting(stmt, Settings.Global.ANIMATOR_DURATION_SCALE,
+                    R.integer.def_animator_duration_scale);
         } finally {
             if (stmt != null) stmt.close();
         }

你可能感兴趣的:(android_system)