Add abnormal interpolation info to log unexpected conditions
Bug: 184807417 Test: make SettingsRoboTests Change-Id: I11156c85b6b955dd505b41a9a41be0756638f1dd
This commit is contained in:
@@ -111,6 +111,10 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
|
|||||||
|
|
||||||
/** Sets all levels value to draw the trapezoid shape */
|
/** Sets all levels value to draw the trapezoid shape */
|
||||||
public void setLevels(int[] levels) {
|
public void setLevels(int[] levels) {
|
||||||
|
if (levels == null) {
|
||||||
|
mLevels = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
// We should provide trapezoid count + 1 data to draw all trapezoids.
|
// We should provide trapezoid count + 1 data to draw all trapezoids.
|
||||||
mLevels = levels.length == mTrapezoidCount + 1 ? levels : null;
|
mLevels = levels.length == mTrapezoidCount + 1 ? levels : null;
|
||||||
setClickable(false);
|
setClickable(false);
|
||||||
|
@@ -16,6 +16,7 @@ package com.android.settings.fuelgauge;
|
|||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.BatteryConsumer;
|
import android.os.BatteryConsumer;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
|
||||||
@@ -310,6 +311,14 @@ public class BatteryHistEntry {
|
|||||||
lowerHistEntry == null ? 0 : lowerHistEntry.mBackgroundUsageTimeInMs,
|
lowerHistEntry == null ? 0 : lowerHistEntry.mBackgroundUsageTimeInMs,
|
||||||
upperHistEntry.mBackgroundUsageTimeInMs,
|
upperHistEntry.mBackgroundUsageTimeInMs,
|
||||||
ratio);
|
ratio);
|
||||||
|
// Checks whether there is any abnoaml cases!
|
||||||
|
if (upperHistEntry.mConsumePower < consumePower
|
||||||
|
|| upperHistEntry.mForegroundUsageTimeInMs < foregroundUsageTimeInMs
|
||||||
|
|| upperHistEntry.mBackgroundUsageTimeInMs < backgroundUsageTimeInMs) {
|
||||||
|
Log.w(TAG, String.format(
|
||||||
|
"abnormal interpolation:\nupper:%s\nlower:%s",
|
||||||
|
upperHistEntry, lowerHistEntry));
|
||||||
|
}
|
||||||
final double batteryLevel =
|
final double batteryLevel =
|
||||||
lowerHistEntry == null
|
lowerHistEntry == null
|
||||||
? upperHistEntry.mBatteryLevel
|
? upperHistEntry.mBatteryLevel
|
||||||
|
Reference in New Issue
Block a user