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

Commit 8017f4ed authored by Dmitri Plotnikov's avatar Dmitri Plotnikov Committed by Android (Google) Code Review
Browse files

Merge "Fix NullPointerException in BatteryUsageStats" into sc-dev

parents 706bd974 153f2acf
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import com.android.internal.os.BatteryStatsHistory;
import com.android.internal.os.BatteryStatsHistoryIterator;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
@@ -233,8 +232,6 @@ public final class BatteryUsageStats implements Parcelable {
            mHistoryBuffer = null;
            mHistoryTagPool = null;
        }
        System.out.println("From Parcel = " + Arrays.toString(
                mCustomPowerComponentNames));
    }

    @Override
@@ -293,6 +290,7 @@ public final class BatteryUsageStats implements Parcelable {
     * Builder for BatteryUsageStats.
     */
    public static final class Builder {
        @NonNull
        private final String[] mCustomPowerComponentNames;
        private final int mCustomTimeComponentCount;
        private final boolean mIncludePowerModels;
@@ -311,11 +309,11 @@ public final class BatteryUsageStats implements Parcelable {
        private Parcel mHistoryBuffer;
        private List<BatteryStats.HistoryTag> mHistoryTagPool;

        public Builder(String[] customPowerComponentNames, int customTimeComponentCount) {
        public Builder(@NonNull String[] customPowerComponentNames, int customTimeComponentCount) {
            this(customPowerComponentNames, customTimeComponentCount, false);
        }

        public Builder(String[] customPowerComponentNames, int customTimeComponentCount,
        public Builder(@NonNull String[] customPowerComponentNames, int customTimeComponentCount,
                boolean includePowerModels) {
            mCustomPowerComponentNames = customPowerComponentNames;
            mCustomTimeComponentCount = customTimeComponentCount;
+2 −2
Original line number Diff line number Diff line
@@ -6951,9 +6951,9 @@ public class BatteryStatsImpl extends BatteryStats {
    /**
     * Returns the names of custom power components.
     */
    public @Nullable String[] getCustomPowerComponentNames() {
    public @NonNull String[] getCustomPowerComponentNames() {
        if (mGlobalMeasuredEnergyStats == null) {
            return null;
            return new String[0];
        }
        final String[] names = mGlobalMeasuredEnergyStats.getCustomBucketNames();
        for (int i = 0; i < names.length; i++) {