Fix power usage detail page is launched in wrong user
Two issues:
1. UID of settings app == system UID. But isSystemUid failed to recognize
Settings in secondary user is also a system uid.
2. For USER drain type, we should launch the detail page in current
user.
Fix: 64506728
Test: make ROBOTEST_FILTER=AdvancedPowerUsageDetailTest -j40 RunSettingsRoboTests
Test: Switch to seconday user. Go to Settings->Battery, tap owner user
battery entry, observe that detail page is shown.
Test: Stay long enough in Settings app, make sure no
either Settings nor Android Framework battery entry.
Change-Id: I8d66ad55f18fcb3d9567b3bf753f737f5b98c609
This commit is contained in:
@@ -428,7 +428,8 @@ public class PowerUsageSummary extends PowerUsageBase implements
|
||||
}
|
||||
|
||||
private static boolean isSystemUid(int uid) {
|
||||
return uid >= Process.SYSTEM_UID && uid < Process.FIRST_APPLICATION_UID;
|
||||
final int appUid = UserHandle.getAppId(uid);
|
||||
return appUid >= Process.SYSTEM_UID && appUid < Process.FIRST_APPLICATION_UID;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user