Refactor cpu stats pullers

use same cpu stats readers with BatteryStats so that
1) both throttle to avoid too frequent pulls
2) cached value is served within throttle interval to avoid double
pulling by both statsd and BatteryStats

To run unit tests:
bit
FrameworksCoreTests:com.android.internal.os.KernelUidCpuFreqTimeReaderTest
bit
FrameworksCoreTests:com.android.internal.os.KernelUidCpuClusterTimeReaderTest
bit
FrameworksCoreTests:com.android.internal.os.KernelUidCpuActiveTimeReaderTest

make -j56 statsd_test && adb sync data && adb shell
/data/nativetest64/statsd_test/statsd_test

Test: cts test, unit test
Bug: 73745189
Bug: 73780619
Bug: 73360959

Merged-In: I10a9bc91ca67fa812f4cd71c4fbd73c1a5ba580e

Change-Id: I10a9bc91ca67fa812f4cd71c4fbd73c1a5ba580e
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index fa96e11..9bfbd38 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -1489,7 +1489,7 @@
  * Note that isolated process uid time should be attributed to host uids.
  */
 message CpuTimePerUid {
-    optional uint64 uid = 1;
+    optional int32 uid = 1;
     optional uint64 user_time_millis = 2;
     optional uint64 sys_time_millis = 3;
 }
@@ -1500,8 +1500,8 @@
  * For each uid, we order the time by descending frequencies.
  */
 message CpuTimePerUidFreq {
-    optional uint64 uid = 1;
-    optional uint64 freq_idx = 2;
+    optional int32 uid = 1;
+    optional uint32 freq_index = 2;
     optional uint64 time_millis = 3;
 }
 
@@ -1634,10 +1634,8 @@
  * The file contains a monotonically increasing count of time for a single boot.
  */
 message CpuActiveTime {
-    optional uint64 uid = 1;
-    optional uint32 cluster_number = 2;
-    optional uint64 idx = 3;
-    optional uint64 time_millis = 4;
+    optional int32 uid = 1;
+    optional uint64 time_millis = 2;
 }
 
 /**
@@ -1650,8 +1648,8 @@
  * The file contains a monotonically increasing count of time for a single boot.
  */
 message CpuClusterTime {
-    optional uint64 uid = 1;
-    optional uint64 idx = 2;
+    optional int32 uid = 1;
+    optional int32 cluster_index = 2;
     optional uint64 time_millis = 3;
 }