Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e718637f authored by Dhavalkumar Chaudhary's avatar Dhavalkumar Chaudhary Committed by Android (Google) Code Review
Browse files

Merge "Add WTF log to identify unexpacted battery consumption calculation for...

Merge "Add WTF log to identify unexpacted battery consumption calculation for specific power component" into main
parents 1997453d 0c643067
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.annotation.NonNull;
import android.database.Cursor;
import android.database.CursorWindow;
import android.util.Range;
import android.util.Slog;
import android.util.SparseArray;
import android.util.proto.ProtoOutputStream;

@@ -63,6 +64,8 @@ import java.util.Map;
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public final class BatteryUsageStats implements Parcelable, Closeable {

    private static final String TAG = "BatteryUsageStats";

    /**
     * Scope of battery stats included in a BatteryConsumer: the entire device, just
     * the apps, etc.
@@ -591,7 +594,8 @@ public final class BatteryUsageStats implements Parcelable, Closeable {
        pw.println("  Estimated power use (mAh):");
        pw.print(prefix);
        pw.print("    Capacity: ");
        pw.print(BatteryStats.formatCharge(getBatteryCapacity()));
        final double capacity = getBatteryCapacity();
        pw.print(BatteryStats.formatCharge(capacity));
        pw.print(", Computed drain: ");
        pw.print(BatteryStats.formatCharge(getConsumedPower()));
        final Range<Double> dischargedPowerRange = getDischargedPowerRange();
@@ -617,6 +621,12 @@ public final class BatteryUsageStats implements Parcelable, Closeable {
                continue;
            }

            if (devicePowerMah >= capacity || appsPowerMah >= capacity) {
                Slog.wtfStack(TAG, "[dump] Estimated battery usage for "
                        + mBatteryConsumerDataLayout.getPowerComponentName(powerComponent)
                        + " is greater than total battery size " + capacity);
            }

            printPowerComponent(pw, prefix,
                    mBatteryConsumerDataLayout.getPowerComponentName(powerComponent),
                    devicePowerMah, appsPowerMah,