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

Commit b0151d11 authored by YK Hung's avatar YK Hung Committed by Android (Google) Code Review
Browse files

Merge "Update the categorize rule for system and app item bucket" into tm-dev

parents db201b0d 273d3445
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -618,4 +618,6 @@
    <!-- Whether the dream setup activity should be enabled as part of setupwizard -->
    <bool name="dream_setup_supported">false</bool>

    <!-- Whether to put the apps with system UID into system component bucket or not -->
    <bool name="config_battery_combine_system_components">false</bool>
</resources>
+9 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.util.Log;

import androidx.annotation.VisibleForTesting;

import com.android.settings.R;
import com.android.settingslib.utils.StringUtil;

import java.util.Comparator;
@@ -52,6 +53,7 @@ public class BatteryDiffEntry {
    public double mConsumePower;
    // A BatteryHistEntry corresponding to this diff usage data.
    public final BatteryHistEntry mBatteryHistEntry;

    private double mTotalConsumePower;
    private double mPercentOfTotal;

@@ -151,8 +153,13 @@ public class BatteryDiffEntry {
            case ConvertUtils.CONSUMER_TYPE_SYSTEM_BATTERY:
                return true;
            case ConvertUtils.CONSUMER_TYPE_UID_BATTERY:
                return isSystemUid((int) mBatteryHistEntry.mUid)
                    || mBatteryHistEntry.mIsHidden;
                if (mBatteryHistEntry.mIsHidden) {
                    return true;
                }
                final boolean combineSystemComponents =
                        mContext.getResources().getBoolean(
                                R.bool.config_battery_combine_system_components);
                return combineSystemComponents && isSystemUid((int) mBatteryHistEntry.mUid);
        }
        return false;
    }
+2 −2
Original line number Diff line number Diff line
@@ -349,12 +349,12 @@ public final class BatteryDiffEntryTest {
    }

    @Test
    public void testIsSystemEntry_uidBatteryWithSystemProcess_returnTrue() {
    public void testIsSystemEntry_uidBatteryWithSystemProcess_returnFalse() {
        final BatteryDiffEntry entry =
            createBatteryDiffEntry(
                ConvertUtils.CONSUMER_TYPE_UID_BATTERY,
                /*uid=*/ 1230, /*isHidden=*/ false);
        assertThat(entry.isSystemEntry()).isTrue();
        assertThat(entry.isSystemEntry()).isFalse();
    }

    @Test