Add userId to key when type is USER

Before this cl, the app list couldn't distinguish different users
because all of them have the same key: USER.

This cl adds userId into key, to make sure the preference key
is unique.

Bug: 64605854
Test: RunSettingsRoboTests
Change-Id: Ia4de2ff85b214465a35f1983ca69a9280d053154
This commit is contained in:
jackqdyulei
2017-08-11 13:00:04 -07:00
committed by Lei Yu
parent 073c5cbe30
commit 44dc63ec7b
2 changed files with 12 additions and 0 deletions

View File

@@ -724,6 +724,8 @@ public class PowerUsageSummary extends PowerUsageBase implements
String extractKeyFromSipper(BatterySipper sipper) {
if (sipper.uidObj != null) {
return extractKeyFromUid(sipper.getUid());
} else if (sipper.drainType == DrainType.USER) {
return sipper.drainType.toString() + sipper.userId;
} else if (sipper.drainType != DrainType.APP) {
return sipper.drainType.toString();
} else if (sipper.getPackages() != null) {