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

Commit e0ef4223 authored by YK Hung's avatar YK Hung Committed by Automerger Merge Worker
Browse files

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

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/17184511

Change-Id: Ib15dfa31b9ac3e80f80b446c0358a724cbc26889
parents 8481b252 b0151d11
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