Add a method to Process to get uid for a pid.
Use the uids to track native processes. Cache the uids to avoid
checking /proc every time.
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 0d9d2b0..fd1dfc8 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -1518,8 +1518,7 @@
}
}
- final BatteryStatsImpl bstats =
- (BatteryStatsImpl) mBatteryStatsService.getActiveStatistics();
+ final BatteryStatsImpl bstats = mBatteryStatsService.getActiveStatistics();
synchronized(bstats) {
synchronized(mPidsSelfLocked) {
if (haveNewCpuStats) {
@@ -1534,7 +1533,7 @@
ps.addCpuTimeLocked(st.rel_utime, st.rel_stime);
} else {
BatteryStatsImpl.Uid.Proc ps =
- bstats.getProcessStatsLocked(st.name);
+ bstats.getProcessStatsLocked(st.name, st.pid);
if (ps != null) {
ps.addCpuTimeLocked(st.rel_utime, st.rel_stime);
}