Merge "Add abnormal interpolation info to log unexpected conditions" into sc-dev am: b3267fb2ea

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/14439969

Change-Id: I1cdb913df2372715a35845efef5b8112886a1e5e
This commit is contained in:
YUKAI HUNG
2021-05-06 06:12:58 +00:00
committed by Automerger Merge Worker
2 changed files with 13 additions and 0 deletions

View File

@@ -111,6 +111,10 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
/** Sets all levels value to draw the trapezoid shape */
public void setLevels(int[] levels) {
if (levels == null) {
mLevels = null;
return;
}
// We should provide trapezoid count + 1 data to draw all trapezoids.
mLevels = levels.length == mTrapezoidCount + 1 ? levels : null;
setClickable(false);

View File

@@ -16,6 +16,7 @@ package com.android.settings.fuelgauge;
import android.content.ContentValues;
import android.database.Cursor;
import android.os.BatteryConsumer;
import android.util.Log;
import java.time.Duration;
@@ -310,6 +311,14 @@ public class BatteryHistEntry {
lowerHistEntry == null ? 0 : lowerHistEntry.mBackgroundUsageTimeInMs,
upperHistEntry.mBackgroundUsageTimeInMs,
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 =
lowerHistEntry == null
? upperHistEntry.mBatteryLevel