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

Commit 973212ad authored by ykhung's avatar ykhung
Browse files

Rename variables and refine the format style from ag/14346184

Bug: 14346184
Test: make SettingsRoboTests
Test: make SettingsGoogleRoboTests
Change-Id: Ie87f2dba2b87781ed5071adbc6f8a2aa45d1fd53
parent d7caf655
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);
+2 −2

File changed.

Contains only whitespace changes.

+1 −1

File changed.

Contains only whitespace changes.

Loading