Merge "Update the categorize rule for system and app item bucket" into tm-dev
This commit is contained in:
@@ -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>
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user