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

相关内容

热门资讯

玩家必看科普!wpk插件(辅助... 玩家必看科普!wpk插件(辅助挂)好像存在有挂(有挂方法)1、很好的工具软件,可以解锁游戏的wpk插...
让我来分享经验!wepoker... 让我来分享经验!wepoker私人局透视教程(辅助挂)果然存在有挂(有挂教程)1)wepoker私人...
专业讨论!德州局怎么透视(辅助... 专业讨论!德州局怎么透视(辅助挂)竟然有挂(确实有挂)亲,关键说明,德州局怎么透视透视脚本安卓赛季回...
专业讨论!wepoker透视方... 专业讨论!wepoker透视方法(辅助挂)竟然真的有挂(真是有挂)1、操作简单,无需wepoker透...
热点推荐!德普之星辅助器怎么用... 热点推荐!德普之星辅助器怎么用(辅助挂)原来是有挂(有挂解惑)1、许多玩家不知道德普之星辅助器怎么用...