[FAQ20177] Change the date and time, the battery life is negative

[DESCRIPTION]

 When the user changes the date to the time before the current date, the setting-the time statistics in the battery is abnormal

 

 

[SOLUTION]

 

 The battery power consumption itself is recorded based on time, which is strongly related to time, so arbitrary modification of the time will definitely affect the display of this value.

Provide a workaround method, that is, when this value is negative, it is displayed as 0.
Make the following changes in BatteryInfo.java:
54 public void onParsingStarted (long startTime, long endTime) {
55 timePeriod = endTime-startTime-remainingTimeUs / 1000;
// mtk add
if (timePeriod <0) timePeriod = 0;
// mtk add
56 view.clearPaths ();

 

Published 31 original articles · Likes6 · Visitors 10,000+

Guess you like

Origin blog.csdn.net/u012824529/article/details/103765892