android13中锁屏界面充电信息显示
创始人
2024-06-01 16:22:18

android13中锁屏界面充电信息显示

平台支持在锁屏界面针对不同充电速度显示不同的充电提示语,快充、慢充对应的充电功率在相关配置文件中配置。相关代码逻辑如下:

根据充电速度mChargingSpeed显示对应提示语
SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
811 protected String computePowerIndication() {

823 switch (mChargingSpeed) {
824 case BatteryStatus.CHARGING_FAST:
825 chargingId = hasChargingTime
826 ? R.string.keyguard_indication_charging_time_fast
827 : R.string.keyguard_plugged_in_charging_fast;
828 break;
829 case BatteryStatus.CHARGING_SLOWLY:
830 chargingId = hasChargingTime
831 ? R.string.keyguard_indication_charging_time_slowly
832 : R.string.keyguard_plugged_in_charging_slowly;
833 break;
834 default:
835 chargingId = hasChargingTime
836 ? R.string.keyguard_indication_charging_time
837 : R.string.keyguard_plugged_in;
838 break;
839 }

判断充电速度:快充、慢充、常规充电
frameworks/base/packages/SettingsLib/src/com/android/settingslib/fuelgauge/BatteryStatus.java
159 /**
160 * Return current chargin speed is fast, slow or normal.
161 *
162 * @return the charing speed
163 */
164 public final int getChargingSpeed(Context context) {
165 final int slowThreshold = context.getResources().getInteger(
166 R.integer.config_chargingSlowlyThreshold);
167 final int fastThreshold = context.getResources().getInteger(
168 R.integer.config_chargingFastThreshold);
169 return maxChargingWattage <= 0 ? CHARGING_UNKNOWN :
170 maxChargingWattage < slowThreshold ? CHARGING_SLOWLY :
171 maxChargingWattage > fastThreshold ? CHARGING_FAST :
172 CHARGING_REGULAR;
173 }

配置文件中小于5w是慢充,大于15w是快充
17
18
19
20 5000000
21
22
23
24 15000000

相关内容

热门资讯

中钨高新:7月8日获融资买入3... 7月8日,中钨高新跌3.76%,成交额46.06亿元。两融数据显示,当日中钨高新获融资买入额3.32...
山推股份:7月8日获融资买入1... 7月8日,山推股份跌2.99%,成交额2.01亿元。两融数据显示,当日山推股份获融资买入额1115....
中国船舶2025年参保人数26... 7月9日消息,据天眼查数据显示,中国船舶工业股份有限公司2025年参保人数为26人,较2024年披露...
7月8日红利低波ETF永赢(5... 数据显示,7月8日,红利低波ETF永赢(563690)遭净赎回192.59万元,位居当日股票ETF净...
7月8日华安创业板人工智能ET... 数据显示,7月8日,华安创业板人工智能ETF(159279)遭净赎回943.49万元,位居当日股票E...