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

Commit e343a8dc 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: I3d6d566e151f787374661a1c826690aaebf9b194
parents 345daf83 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