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

Commit 37d6d083 authored by YUKAI HUNG's avatar YUKAI HUNG Committed by Android (Google) Code Review
Browse files

Merge "Rename variables and refine the format style from ag/14346184" into sc-dev

parents 7c02bd86 973212ad
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ public class BatteryDiffEntry {
            case ConvertUtils.CONSUMER_TYPE_SYSTEM_BATTERY:
                final BatteryEntry.NameAndIcon nameAndIconForSystem =
                    BatteryEntry.getNameAndIconFromPowerComponent(
                                mContext, mBatteryHistEntry.mPowerComponentId);
                        mContext, mBatteryHistEntry.mDrainType);
                if (nameAndIconForSystem != null) {
                    mAppLabel = nameAndIconForSystem.name;
                    if (nameAndIconForSystem.iconId != 0) {
+9 −5
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ package com.android.settings.fuelgauge;

import android.content.ContentValues;
import android.database.Cursor;
import android.os.BatteryConsumer;

import java.time.Duration;

@@ -59,7 +60,9 @@ public class BatteryHistEntry {
    public final double mPercentOfTotal;
    public final long mForegroundUsageTimeInMs;
    public final long mBackgroundUsageTimeInMs;
    public final int mPowerComponentId;
    @BatteryConsumer.PowerComponent
    public final int mDrainType;
    @ConvertUtils.ConsumerType
    public final int mConsumerType;
    // Records the battery intent relative information.
    public final int mBatteryLevel;
@@ -83,7 +86,7 @@ public class BatteryHistEntry {
        mPercentOfTotal = getDouble(values, KEY_PERCENT_OF_TOTAL);
        mForegroundUsageTimeInMs = getLong(values, KEY_FOREGROUND_USAGE_TIME);
        mBackgroundUsageTimeInMs = getLong(values, KEY_BACKGROUND_USAGE_TIME);
        mPowerComponentId = getInteger(values, KEY_DRAIN_TYPE);
        mDrainType = getInteger(values, KEY_DRAIN_TYPE);
        mConsumerType = getInteger(values, KEY_CONSUMER_TYPE);
        mBatteryLevel = getInteger(values, KEY_BATTERY_LEVEL);
        mBatteryStatus = getInteger(values, KEY_BATTERY_STATUS);
@@ -104,7 +107,7 @@ public class BatteryHistEntry {
        mPercentOfTotal = getDouble(cursor, KEY_PERCENT_OF_TOTAL);
        mForegroundUsageTimeInMs = getLong(cursor, KEY_FOREGROUND_USAGE_TIME);
        mBackgroundUsageTimeInMs = getLong(cursor, KEY_BACKGROUND_USAGE_TIME);
        mPowerComponentId = getInteger(cursor, KEY_DRAIN_TYPE);
        mDrainType = getInteger(cursor, KEY_DRAIN_TYPE);
        mConsumerType = getInteger(cursor, KEY_CONSUMER_TYPE);
        mBatteryLevel = getInteger(cursor, KEY_BATTERY_LEVEL);
        mBatteryStatus = getInteger(cursor, KEY_BATTERY_STATUS);
@@ -139,7 +142,7 @@ public class BatteryHistEntry {
                    mKey = Long.toString(mUid);
                    break;
                case ConvertUtils.CONSUMER_TYPE_SYSTEM_BATTERY:
                    mKey = "S|" + mPowerComponentId;
                    mKey = "S|" + mDrainType;
                    break;
                case ConvertUtils.CONSUMER_TYPE_USER_BATTERY:
                    mKey = "U|" + mUserId;
@@ -162,7 +165,8 @@ public class BatteryHistEntry {
                  mPercentOfTotal, mTotalPower, mConsumePower,
                  Duration.ofMillis(mForegroundUsageTimeInMs).getSeconds(),
                  Duration.ofMillis(mBackgroundUsageTimeInMs).getSeconds()))
            .append(String.format("\n\tdrain=%d|consumer=%d", mPowerComponentId, mConsumerType))
            .append(String.format("\n\tdrainType=%d|consumerType=%d",
                  mDrainType, mConsumerType))
            .append(String.format("\n\tbattery=%d|status=%d|health=%d\n}",
                  mBatteryLevel, mBatteryStatus, mBatteryHealth));
        return builder.toString();
+2 −2
Original line number Diff line number Diff line
@@ -102,9 +102,9 @@ public final class ConvertUtils {
            values.put(BatteryHistEntry.KEY_BACKGROUND_USAGE_TIME,
                Long.valueOf(entry.getTimeInBackgroundMs()));
            values.put(BatteryHistEntry.KEY_DRAIN_TYPE,
                entry.getPowerComponentId());
                Integer.valueOf(entry.getPowerComponentId()));
            values.put(BatteryHistEntry.KEY_CONSUMER_TYPE,
                entry.getConsumerType());
                Integer.valueOf(entry.getConsumerType()));
        } else {
            values.put(BatteryHistEntry.KEY_PACKAGE_NAME, FAKE_PACKAGE_NAME);
        }
+2 −2
Original line number Diff line number Diff line
@@ -223,7 +223,7 @@ public final class BatteryHistEntryTest {
        assertThat(entry.mPercentOfTotal).isEqualTo(percentOfTotal);
        assertThat(entry.mForegroundUsageTimeInMs).isEqualTo(1234L);
        assertThat(entry.mBackgroundUsageTimeInMs).isEqualTo(5689L);
        assertThat(entry.mPowerComponentId).isEqualTo(drainType);
        assertThat(entry.mDrainType).isEqualTo(drainType);
        assertThat(entry.mConsumerType)
            .isEqualTo(ConvertUtils.CONSUMER_TYPE_SYSTEM_BATTERY);
        assertThat(entry.mBatteryLevel).isEqualTo(12);
+1 −1

File changed.

Contains only whitespace changes.

+2 −2

File changed.

Contains only whitespace changes.

Loading