[RK3288][Android6.0] 调试笔记 --- 电池电量一直显示100%

Platform: Rockchip
OS: Android 6.0
Kernel: 3.10.92

之前文章[RK3288][Android6.0] 调试笔记 — 伪电池驱动添加 阐述了如何添加一个假的电池驱动,
测试发现Setting里的电池电量一直是100%
[RK3288][Android6.0] 调试笔记 --- 电池电量一直显示100%_第1张图片

跟踪发现Android6.0相比之前的Android4.4会判断Charger是否存在,不存在就认为设备不具备充电能力并且设定当前电量是100%
解决方法:

kris@:~/rk3288/system/core/healthd$ g df 6446f0e6bfabeee8cbe8b233bf7bf87ad7b55665 727c2d4ab5c4b50555b8c64d1b2a61a342e4360c 
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp
index 07e7a18..396dfef 100644
--- a/healthd/BatteryMonitor.cpp
+++ b/healthd/BatteryMonitor.cpp
@@ -555,18 +555,12 @@ void BatteryMonitor::init(struct healthd_config *hc) {
     // This indicates that there is no charger driver registered.
     // Typically the case for devices which do not have a battery and
     // and are always plugged into AC mains.
-
-/*Kris, 20170728, we don't have any charger. { */
-#if 0
     if (!mChargerNames.size()) {
         KLOG_ERROR(LOG_TAG, "No charger supplies found\n");
         mBatteryFixedCapacity = ALWAYS_PLUGGED_CAPACITY;
         mBatteryFixedTemperature = FAKE_BATTERY_TEMPERATURE;
         mAlwaysPluggedDevice = true;
     }
-#endif
-/*Kris, 20170728, we don't have any charger. } */
-
     if (!mBatteryDevicePresent) {
         KLOG_WARNING(LOG_TAG, "No battery devices found\n");
         hc->periodic_chores_interval_fast = -1;

你可能感兴趣的:(子类__Display)