系统版本: RK3288 android 5.1 (与参考的变量和宏有点区别)
设备没有电池,在进行 Fota 升级时,提示电量不能低于 30% ,外接电源,可是读出来的电量是 0% ,无法进行升级,只能手动设置电池电量。
$ adb shell dumpsys battery
//
通过
adb
查询电池信息
Current Battery Service state:
AC powered: false
USB powered: false
Wireless powered: false
status: 1
health: 1
present: true
level: 0
//
电池电量
scale: 100
voltage: 0
temperature: 0
technology:
diff --git a/system/core/healthd/BatteryMonitor.cpp b/system/core/healthd/BatteryMonitor.cpp
old mode 100644
new mode 100755
index d317b28..6b37dee
--- a/system/core/healthd/BatteryMonitor.cpp
+++ b/system/core/healthd/BatteryMonitor.cpp
@@ - 35 , 7 + 35 , 7 @@
#define POWER_SUPPLY_SUBSYSTEM "power_supply"
#define POWER_SUPPLY_SYSFS_PATH "/sys/class/" POWER_SUPPLY_SUBSYSTEM
- #define FAKE_BATTERY_CAPACITY 42
+ #define FAKE_BATTERY_CAPACITY 100
#define FAKE_BATTERY_TEMPERATURE 424
namespace android {
@@ - 513 , 8 + 513 , 14 @@ void BatteryMonitor::init( struct healthd_config *hc) {
closedir(dir);
}
- if (!mChargerNames.size())
+ if (!mChargerNames.size()) {
KLOG_ERROR(LOG_TAG, "No charger supplies found\n" );
+ /*------------ 电池电量一直显示 100%------------*/
+ mBatteryFixedCapacity = FAKE_BATTERY_CAPACITY; // 电量 level
+ mBatteryFixedTemperature = FAKE_BATTERY_TEMPERATURE; // 温度 temperature
+ mBatteryDevicePresent = true ;
+ /*------------------------------------------------*/
+ }
if (!mBatteryDevicePresent) {
KLOG_WARNING(LOG_TAG, "No battery devices found\n" );
hc->periodic_chores_interval_fast = - 1 ;
$ adb shell dumpsys battery
Current Battery Service state:
AC powered: false
USB powered: false
Wireless powered: false
status: 1
health: 1
present: true
level: 100
//
电池电量
scale: 100
voltage: 0
temperature: 424
technology:
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。