展銳Android13電池狀態默認不顯示電池電量百分比,打開
/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
在xml的文件最后,增加一項配置def_show_battery_percent:
<?xml version="1.0" encoding="utf-8"?>
<!--
/*** Copyright (c) 2009, The Android Open Source Project** Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/
-->
<resources> ..............................<!--add default show battery percent--><integer name="def_show_battery_percent">1</integer>
</resources>
打開
/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
在loadSystemSettings(SQLiteDatabase db)的最后增加一行代碼,將配置寫到系統表:
private void loadSystemSettings(SQLiteDatabase db) {SQLiteStatement stmt = null;try {stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)"+ " VALUES(?,?);");.......................................//add cde default show battery percentloadIntegerSetting(stmt, Settings.System.SHOW_BATTERY_PERCENT, R.integer.def_show_battery_percent);//add end} finally {if (stmt != null) stmt.close();}}
?系統重新編譯,刷機后開機,系統讀取數據庫,自動配置為狀態欄默認顯示電池電量百分比