展锐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();}}
系统重新编译,刷机后开机,系统读取数据库,自动配置为状态栏默认显示电池电量百分比