Fix missing time-in-foreground and time-in-background for some apps
The gist of the issue is that many apps have two UIDs associated with them: a regular, "real" UID, e.g. 10123, and a shared group GID, e.g. 50123, which is used for multiuser support. Prior to this fix, the code in BatteryAppListPreferenceController, would go over the list of all UidBatteryConsumers and would randomly encounter either the "real" UID or the shared GID for each app first. The UidBatteryConsumer for a shared GID does not have all of the properties of the real UID, so some information, such as time-in-foreground and time-in-background would be lost with a high probability. After this fix, we process "real" UIDs before shared GIDs ensuring that time-in-* and other properties such as package names are obtained for the real UID. When we later encounter a shared GID for the same app, we just add the consumed power and time-in-* durations to the real UID's BatteryEntry. Bug: 188656360 Test: make RunSettingsRoboTests Test: make RunSettingsGoogleRoboTests Change-Id: I4bfea813ac5eb8f866804b2c4a9153eb877fb325
Loading
Please register or sign in to comment