欢迎光临
我们一直在努力

RK3288 手动设置电池电量

系统版本:
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:

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。