History log of /frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
56ae0d9a48212c6e886e5887a6f9191f3020af40 12-May-2018 David Chen <dwchen@google.com> Fixes statsd reports missing strings and SCS.

Reports written to disk don't contain the strings used, which will
make this report unusable if there are strings that don't show up
again. We should always include the strings, so this option is
removed entirely.

Also, we hard-coded the wrong number of fields when pulling
ModemActivityInfo. There are actually 10 fields, not 6.

Bug: 79601503
Test: Tested unit-tests pass on marlin-eng.
Change-Id: I6834b096ced77418a9cc2ddd79b08d1c9c447fae
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
892f3d32293b8358c72da4a94633827abbda640b 02-May-2018 Yangster-mac <yanglu@google.com> Reset statsd and correctly record the dump reason when system
server restarts/crashes.

Test: statsd test
BUG: b/79161505
Change-Id: I0646c764964f6eafde91f9ae0179a1c837af320d
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
e36018b2724b5ae40180f956b16c3e276855b99b 17-Apr-2018 Chenjie Yu <cjyu@google.com> add dump report reason to reports

+ also change uidmapping version numbers to int64_t

Bug: 78132855
Change-Id: Iac7ea93e4bf651bd65bd03383e7ab4971af4fc29
Fix: 78132855
Test: gts test
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
d37bc23f5094ebb803abe93c9e3ca27698da35a9 13-Apr-2018 David Chen <dwchen@google.com> Adds a code when statsd sends intent to getData.

If the data receiver is experiencing delays, there may be a queue of
multiple intents to collect the same data. This timestamp makes it
easy in the receiver to de-dupe these requests to call getData.

Also, we update how StatsCompanionService gets the snapshot by
requesting data for all known apps. I notice that Keep seems to have
a uid active even when it appears uninstalled.

Bug: 77981668
Test: Flashed marlin-eng and manually verified.
Change-Id: I509e19383ec4a5da8746dd0c76ac71a948c6877d
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
bd12527c90d55eefa657e6a71cfdd287ecdb4ab3 05-Apr-2018 David Chen <dwchen@google.com> Fix uid map to be simpler and fix partial bucket.

The previous scheme captured periodic snapshots for each config with
complex logic that's unnecessary and wasted memory. We actually don't
need to store any snapshots since we just convert the current state
into a snapshot and also include the deltas (change events) since the
previous report until now.

To make the system more robust, we also include up to 100 of the
deleted apps in the uid map.

Also, fix the wiring of the partial buckets so the metric producers
form partial buckets on both app upgrade and removal, but not on
installation of a new app.

Also, we update StatsCompanionService to also include disabled apps.

Bug: 77607583
Test: Verified unit-tests pass and added new e2e tests.
Change-Id: I98e1f544d6e6571545ae1581c4cebab807596f51
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
c04feba805c5acde92638a062cc13030fc4d3308 02-Apr-2018 Yangster-mac <yanglu@google.com> Move forward the alarm timestamp when config is added to statsd.

Test: statsd test
BUG: b/77344187

Change-Id: Ieacffaa29422829b8956f2b3fcb2c647c8c3eed9
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
2f6f33fa792057b47c0e29ef0b01c091ce2b1068 31-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Null pointer check for Bluetooth traffic" into pi-dev
9e59f93a216791b01bce369cb7825399d5109571 31-Mar-2018 Chenjie Yu <cjyu@google.com> Null pointer check for Bluetooth traffic

Bug: 77340376
Change-Id: I558c020636564437e040097a2d0f86519c343c4a
Fix: 77340376
Test: manual test
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
ea16812ad230d52e81198bc4e278b8fce6561eb4 30-Mar-2018 Howard Ro <yro@google.com> Merge "Remove bad configs by counting the number of statsd deaths" into pi-dev
5caaa9d8542585e537ac762c35879eb42dd6bbb4 07-Mar-2018 Chenjie Yu <cjyu@google.com> Clean up atoms.proto

changes are:
1) for pushed atoms, use attribution node in place of uid when
appropriate
2) name changes to be more consistent

Bug: 73823969
Test: manual test
Change-Id: Iacf7186dbd7a2282f7fe481f43dbbf92e1165b47
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
e26c97b565624b3b5c80e299d7604afa7aa59a83 27-Mar-2018 yro <yro@google.com> Remove bad configs by counting the number of statsd deaths

Bug: 75968642
Test: manual testing, statsd_test, cts test
Change-Id: Ie23e9003163b8dc554bcdc9811850091cd894000
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
1a0a941c20eb746868d0de52e3806f69c74d335f 28-Mar-2018 Chenjie Yu <cjyu@google.com> Fix StatsCompanionService pull on bucket ends

+ change StatsPullerManager internal time units to be consistent
+ use series of alarms for pullers, instead of use setRepeating

Bug: 76223345
Bug: 75970648
Test: cts test
Change-Id: I9e6ac0ce06541f5ceabd2a8fa444e13d40e36983
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
35045cbc3422224a49881baa4d96755d8f75c5d0 24-Mar-2018 David Chen <dwchen@google.com> Fix uidmap in statsd.

Previously tried an optimization that results in corrupted proto
output. This changes to a safer approach of storing the snapshot data
in memory and only converting to proto output when the
ProtoOutputStream is provided.

Also fixes a security issue when trying to invoke triggerUidSnapshot
since we forgot to use SCS' permissions.

Test: Added a unit-test to verify output of StatsLogProcessor.
Bug: 76231867
Change-Id: Id410ce3505fda9d71caa71942ef3068b55872c66
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
234d1828ca4a706676ad6f3fa0629959c74297c7 14-Mar-2018 Mike Ma <yanmin@google.com> Resolve STATSD and batterystats race condition

Both STATSD and batterystats need to read uid cpu info. However, uid cpu
stats needs to be cleared from time to time to conserve memory. To
resolve this race condition, only batterystats will remove uid stats,
both from readers and from the kernel, also with a delay, so that STATSD
can access such info before it is removed.

Refactored readers to reuse some common code. Also removed string reader
from KernelUidCpuFreqTimeReader completely since binary reader has been
working fine for a while.

Change-Id: I209bdcec642e1a29a44b566ce98ebbfaaacb4e6a
Fixes: 72172569
Test: BatteryStatsCpuTimesTest
Test: KernelUidCpuActiveTimeReaderTest
Test: KernelUidCpuClusterTimeReaderTest
Test: KernelUidCpuFreqTimeReaderTest
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
4460e3c22b07ccbf4506553819633dccc95145da 15-Mar-2018 Chenjie Yu <cjyu@google.com> Improve efficiency for CpuTimePerUidFreq

Tested on marlin. Shortly after boot, the total is 468 fileds with non
zero time spent at frequency.
It quickly swell to 1600+ though.
It is some improvement compared to 2700+, but still an extremely large
pulled atom.

Bug: 74965273
Test: manual test
Change-Id: Ibbeaa02f54d91c4958d75dd3aaafbb306d61f8d8
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
81cacb274c0ee2ecf1c2f8a5c9bfc6c0582e0d6c 12-Mar-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Statsd BroadcastSubscribers can receive 'cookies'" into pi-dev
90d3aa099560b48a64c490b6db5ea5f03d068f15 09-Mar-2018 Tej Singh <singhtejinder@google.com> Logging in StatsCompanionService

Converted a lot of log lines to debug and turned them off by default.

Bug: 72567474
Test: none
Change-Id: I46ca0609648e64b862a56e5f5d445c91a3e889da
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
058d86982689071f3d26514f0a3c74d9feddf1d0 06-Mar-2018 Bookatz <bookatz@google.com> Statsd BroadcastSubscribers can receive 'cookies'

Subscribers can now provide additional Strings that will be passed back to
it when an anomaly is detected. This way, the Subscriber can be informed
about anomaly-specific information has meaning to it.
Statsd itself does not use these strings and doesn't care what they are
- it simply passes them back to the subscriber.

Change-Id: If269872397c4ed2c67e41d54d850cdc664d4f73e
Fixes: 74012329
Test: run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.alert.BroadcastSubscriberTests
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
ec67661bdfe1814039f625575176678219acc7b1 07-Mar-2018 Chenjie Yu <cjyu@google.com> 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
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
932ececa1674c59a8da9f3e32d2651e781b86fc4 01-Feb-2018 Yangster-mac <yanglu@google.com> Alarm: wakes up statsd and notifies the subscribers.

Test: manually tested it.
Change-Id: Id796a68976aeb1611183023ba4e9c6a8b8c44bb8
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
c552b35316937827531a2b7efdfb8f4fc8dba3b0 22-Feb-2018 Yangster-mac <yanglu@google.com> Add timestamp for events pulled by companision service.

Test: statsd cts test
Change-Id: I2658dba747ff93a120c50b5294f696918588e9fe
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
394989a34a80851845d8c9e9368c0850b49efbfb 17-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "StatsCompanionService logcat message updates"
111ed73a9c9971ac20e8fd8eaebb56a38f341664 17-Feb-2018 Bookatz <bookatz@google.com> StatsCompanionService logcat message updates

StatsCompanionService logs that it cannot find statsd, but
since it never says when it succeeds, it looks worrisome.
It's useful to know, so both outcomes are now logged.
Other minor logging changes are done too.

Bug: 73495509
Test: none
Change-Id: I67236b8d323751d0c5e3fa2454eccceb8c4250a0
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
22d92b76bccd6666ea34009310dced62ba79165b 08-Feb-2018 Rajeev Kumar <rajekumar@google.com> Implement atom puller for ProcessMemoryState.

We would like to gather memory metrics of the processes when LMKD kills
a process. By gathering this info we would be able to analyze and improve
system health by potentially reducing memory footprint of the processes
contributing to the memory pressure on the device.

This feature would be available on production builds.

Perf analysis:
On an average getMemoryStateForProcesses method call takes
0.59 milli seconds per process.

To know more about this see: http://go/android-p-memory-metrics

Bug: 72177881
Test: Tested manually
Change-Id: Ice94c2d937a5c84bc205981d99588a30f686ff9b
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
1476ef24f33fd9ff7d0e748f61cc964723e6bb1c 13-Feb-2018 Bookatz <bookatz@google.com> Statsd guardrail for Alerts

Now, each config is allowed at most 100 Alerts in it.
That is, for each uid, for each config id, the config's alert section
can have at most 100 items in it.

Bug: 73287046
Test: none yet
Change-Id: I2c81bc647627e432337c359c0a76aa3fc08bdd23
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
330af58f2b8582b855085655fae553cdfaf44e6c 09-Feb-2018 Yangster-mac <yanglu@google.com> Use elapsed realtime instead of times based on wall clock, which can jump around and go backwards.

Test: statsd unit test passed

Change-Id: Ib541df99231e171b3be2a24f75632693e36da90e
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
af55ba8ca626eb5d2b5af1145eef03ca3d97e798 13-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Statsd Anomaly Detection fixes"
66fe06183f3074554c524f6e2ee47ce6fd727941 08-Feb-2018 Bookatz <bookatz@google.com> Statsd Anomaly Detection fixes

Minor fixes and notes regarding the setting of refractory periods and
anomaly alarms.
Also changes the anomaly alarms from inexact to exact.

Test: run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.alert.AnomalyDetectionTests
Change-Id: Ia4f4c84dd647ebbbad4bab66164cd7709f8628e8
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
8178408358fe1ef433e6993e0f526ab1fe6a38ba 09-Feb-2018 Bookatz <bookatz@google.com> STATSD_STARTED broadcast include background

Allow statsd to tell even receivers in the background
that it is running.

Test: manual
Change-Id: I4fe9620eaf846275ee995b90849bf789e78130fd
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
bde353c36f908c71842683f2c9e7d0565beb4be9 09-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Turn off debug logging in statsd"
40279e54075e0f104ff484d094148f63b59e19cd 09-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes I6993325b,Icb5114fe

* changes:
Frameworks: Annotate trivial @GuardedBy in services/core
Frameworks: Annotate trivial @GuardedBy in core/java
484524a246ffe453f8cd89b698a279c23b0bde1f 02-Feb-2018 Tej Singh <singhtejinder@google.com> Turn off debug logging in statsd

Sets DEBUG to false everywhere and replaces all ALOGD with VLOG so they
do not print with DEBUG false. Leaves all ALOGI, ALOGW and ALOGE as is.

Test: ran all CTS tests and checked "adb logcat -s statsd" to make sure
it wasn't spammy

Change-Id: Iaa8eb3a0a63723ffe40f94f2815f94df877fd432
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
a36dc621ef0b86a0bd46f1d4f5a719a466ba1800 06-Feb-2018 Andreas Gampe <agampe@google.com> Frameworks: Annotate trivial @GuardedBy in services/core

Add @GuardedBy for simple functions that require a single lock
and are named XYZLocked.

Derived by errorprone.

Bug: 73000847
Test: m
Test: m javac-check-framework RUN_ERROR_PRONE=true
Change-Id: I6993325b11c71a4ec27c21935fb54a954d95455f
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
661f791a2580515eee5882ab9498aef94a0d33a5 23-Jan-2018 David Chen <dwchen@google.com> Statsd notifies listener with pendingintent.

Previously, statsd would inform interested listeners that it's time
to collect data via a protected broadcast. However, the preferred
solution is to pass a PendingIntent via a separate setter. Whenever
statsd wants the listener to call getData, StatsCompanionService
will trigger the pending intent.

Test: Tested in marlin-eng that functionality works as expected with
dogfood app.
Bug: 72562867
Change-Id: Ibcfcd5072a1a78947f8a7cbcd0bc429b54351da3
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
9d7f2f40110d82f5499b173b555d418b88f6dcf1 07-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Stop statsd Anomaly Detection crash"
582870ef9150e11fe3815e3a0bf138975d00b5f5 06-Feb-2018 Bookatz <bookatz@google.com> Stop statsd Anomaly Detection crash

AnomalyAlarmReceiver needs to be public or it crashes the system when
AppComponentFactory tries to access it when an alarm fires.

Change-Id: I79d1d73e9b98d3da74e3cb34fbafc8da8c5e2e8f
Fixes: 73004903
Test: manual
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
c2d6544e049cf11f4a0923558fb7c71f2b90219c 02-Feb-2018 Chenjie Yu <cjyu@google.com> fix bluetooth puller
+ bluetooth adapter may be lost, in which case we should try to get it
again

Test: cts test
Change-Id: I331ab45cea930cb5b8b95885442214d4a410b13b

Fix: 72949299
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
158c1d1778eb3c4650b24cfdb4aa0e9d30ae7db2 01-Feb-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "StatsCompanionService permissions"
18ffea713046bef8938ad741666d9f5a6d165cc6 27-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add Bluetooth atoms"
369208256755a5ded185112dd2ceecadb5986fa5 26-Jan-2018 Bookatz <bookatz@google.com> StatsCompanionService permissions

Makes several public things private, since they aren't used elsewhere.
Adds enforcing permission for a binder call (albeit, for a function
that is going to be removed soon anyway.)

Bug: 71768461
Test: Still compiles
Change-Id: I844cfa2375c8ca98fe265b05084e8a4b0b240e80
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
5ce13c1b25ccb518c88373ff46b38b1e9e4b822a 27-Jan-2018 Howard Ro <yro@google.com> Merge "Prevent writeDataToDisk calls when switching from guest user to primary user"
9d7720b5b49e9649541e56f792f5f658a4e5ae2e 24-Jan-2018 Chenjie Yu <cjyu@google.com> Add Bluetooth atoms

+ refactor pullers in StatsCompanionService to be more modular
+ rename CpuSuspendTime and CpuIdleTime to SystemElapsedRealtime
and SystemUptime

Test: will add cts test
Change-Id: I463103fb271511cef4e0f877c20fd167fe8b173b
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
f7a3bcbeb7b89d35a916ded587bee6012061c1ff 25-Jan-2018 yro <yro@google.com> Prevent writeDataToDisk calls when switching from guest user to primary
user

Previsouly, we were only listening to ACTION_SHUTDOWN event, which is
triggered whenever 'user' on Android is changed. This will fire an
intent to write a file to disk and it is not intended. So we add
an additional check to see if the ACTION_SHUTDOWN is on foreground as
user switch fires ACTION_SHUTDOWN is NOT on foreground.

Bug: 72461610
Bug: 72441801
Test: manual testing
Change-Id: I05ea8f1b60b6644d1e6ccf232d6dcde39538666d
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
8ce077a43752b3ccea5995cb5e8a44bdfbe6ee5a 26-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Statsd broadcasts when it is alive 2"
0e816ba9303d9e1c86c77f0c0ae280f5c2a3482a 26-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix ModemActivityInfo should have more fields"
0eb58ae39d88a2fbfecabae8b10a4be5e4ebcc8c 26-Jan-2018 Bookatz <bookatz@google.com> Statsd broadcasts when it is alive 2

Continuation of ag/3508513.

Test: manually made sure the broadcast was sent
Bug: 70389379
Bug: 72450885

Change-Id: Ib49c5e967d3c8e31ef127347afa450ce8c5e170b
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
9dccec133efa573ffa165105f000d340d8ddf2c4 26-Jan-2018 Chenjie Yu <cjyu@google.com> Fix ModemActivityInfo should have more fields

Test: cts test
Change-Id: I6f03eae0f87265fe6c958575de1b1cebbc873373
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
5c800e3f0b9662e8616a045b0fadf93f4eb15875 24-Jan-2018 Bookatz <bookatz@google.com> Statsd broadcasts when it is alive

To send configurations and PendingIntents to statsd, statsd must first
be alive. In particular, a PendingIntent must be resent to statsd each
time it starts (they are not stored, since reboots make them expire
anyway). Therefore, statsd needs to send a broadcast to inform them of
its starting.

The broadcast receiver will require DUMP permission.

Bug: 72450885
Bug: 70389379
Test: manually confirmed broadcast is sent
Change-Id: I47c130130342465a50cd625bdb135855d5d04f6e
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
c697797d43b6932fc7cca1c8d7d850c3fb4d1452 17-Jan-2018 Bookatz <bookatz@google.com> Statsd broadcast subscriber

Allows a uid that uploads a statsd config to additionally
register a BroadcastSubscriber with statsd. If statsd
detects an anomaly (according to the config's Alert),
statsd can inform a BroadcastSubscriber provided in the config.
The config uses a subscriberId (just an int) to identify the
BroadcastSubscriber. It then uses StatsManager.setBroadcastSubscriber
to associate that subscriberId with a given PendingIntent.
Then, when the anomaly is detected, statsd sends a broadcast
using that PendingIntent, alerting whoever was specified by
the config/setBroadcastSubscriber.

Bug: 70356901
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.alert.BroadcastSubscriberTests
Change-Id: I4d9ea9a6c8a85e61fadfd99c1513c55abbadd5e9
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
937d74294e0da3c656305ba0f9e56b2c01aebf0e 11-Jan-2018 Chenjie Yu <cjyu@google.com> add system uptime and free disk space atoms and pullers

Test: will add cts later
Change-Id: I0b906fab82fca89b85bc0c7fbe06078115d43eec
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
9da105bb321e4c28db6fd88a2d6cb01852ffefe2 13-Jan-2018 Chenjie Yu <cjyu@google.com> add atoms for cpu power calculation

Test: will add cts tests for them
Change-Id: Ifefa3697ff64e8c484f79d08caf053bfc712b794
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
964be9ab42083f38c7cad8d1f5f6e6ef816f53a6 12-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "pull absolute value for cpu time per frequency."
0f2171041ef0615fcf10fdf95b8e096fef99d955 09-Jan-2018 Yao Chen <yaochen@google.com> make statsd run in its own uid

+ Assign permission android.permission.STATSCOMPANION to statsd
+ Fixes in StatsCompanionService to allow statsd to get uid mapping

Test: manual
Change-Id: I3e6ca79eefed7f93a4588578c156321c4c278fd3
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
1ee9b7413c526b8e5fd3b5f11bfd6674693c0892 11-Jan-2018 Chenjie Yu <cjyu@google.com> pull absolute value for cpu time per frequency.

Test: cts test
Change-Id: I519616905ed8ec6afdaa7e1a0743e279009aa0e5
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
31d14d72dc4f66b96fc486fef81b9df3c5ef3194 13-Dec-2017 Chenjie Yu <cjyu@google.com> rename pulled atoms to shorter names

Test: unit test
Change-Id: I337341dc69ea658f5972cd9962c536a1f11d77f9
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
3accca05ddcad9d0b1b313eae49f273e39121d3c 20-Sep-2013 Dianne Hackborn <hackbod@google.com> Add major version code to platform.

It turns the version code into almost a 64-bit integer, with the
new major part being the upper 32 bits.

The only tricky part about this is the backup manager, since it
stored 32-bit version codes in its backup data sets. This is dealt
with by, when the major version code is not 0, writing MIN_INT as
the version code and following that by the full long version code,
which we can detect when reading. Note that this makes backup sets
containing apps with major version codes incompatible with older
versions of the platform.

Bug: 64459786
Test: Added in Change-Id: Iab8a682b62103babd6c16a56b8dc1e97d7078658
Change-Id: Ibfffe235bbfcf358b3741abd3f7197fdb063d3f3
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
05013b377266f9e4e2651c6aa819960479dc3676 21-Nov-2017 Chenjie Yu <cjyu@google.com> add atoms and pulling methods for wifi controller activity and modem
controller activity

Test: manual test on device
Change-Id: Ib4213b4bf8badaf22b5f655e0261f45a55ab6bb7
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
c136f45aee2c193e954c107f35109ccc8b1146b3 27-Nov-2017 David Chen <dwchen@google.com> Adds guardrail for memory usage for statsd uid map.

Checks if current memory usage of uid map is above a configured limit
and if so, we start deleting snapshots. If there are no more
snapshots, we begin deleting two of the deltas. Also records stats
in the guardrail StatsdStats. Also fixes an edge case where a config
is added after the snapshots are added. We request a snapshot of all
installed uid's at that moment. Finally, adds the uid map memory size
when determining if we should send a broadcast to trigger collection.

Test: Added unit-tests and check they pass on marlin.
Change-Id: Id5d86378bd1efe12a06b409164c777c0c6f4e3ab
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
947fbce521d9e8377df03e3c1c31884ed5577f32 16-Nov-2017 yro <yro@google.com> Captures metrics on disk when devices reboot and shutdown. Specifically,

1. Create intent receiver in StatsCompanionService to listen to shutdown
events.
2. Create StatsWriter class to handle disk writes and deleting files.
3. Update StatsLogProcessor, ConfigManager, and StatsService to handle
files on disk using StatsWriter.
4. Add a wrapper for ConfigMetricsReport.

Still TODO is to be able to add a guardrail to prevent accumulating
excessive amount files on disk, which will be followed up by another
change.

Test: statsd, statsd_test
Change-Id: Ia0b3af315af545daa8b0078b3700c600aa7c285f
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
f6d1ca5f9ddcd979ccdfada018d8d61a5ca5ce1c 16-Nov-2017 yro <yro@google.com> Fix Slog message of AppUdateReceiver in StatsCompanionService

Test: statsd, statsd_test

Change-Id: I840b12e51c9f60a35b2c20afce1d278dbc69dfde
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
adaf8b344e312853530e276ceff05783133ecf17 03-Nov-2017 David Chen <dwchen@google.com> Adds client API for interacting with statsd.

This API will primarily be used by GmsCore to send updated configs.
Also, sending a config will implicitly notify the StatsD that this
client wants to know when it should request data for this config.

We send a broadcast so that all interested subscribers can know if
data needs to be pulled.

Test: Manually tested that sending broadcast works via new adb
command added in StatsService.

Change-Id: I23cdd1df706036e14b32c3d01af30c3d4af819fa
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
7f8def9d5a71f4ccb1ecdd90637f7b3c162dcab8 03-Nov-2017 Chenjie Yu <cjyu@google.com> pull cpu time per freq
also adjust lock for ValueMetricProducer.cpp

Test: manual test
Change-Id: Ib96e3011d7bcf44ac92346d880196c425623a86f
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
5305e1ddc22bfe9ad941cb2550987aaba8de234c 31-Oct-2017 Chenjie Yu <cjyu@google.com> pull resource power manager stats into statsd

Test: tested on device and check output
Change-Id: I65932a5527d6099e12546b6928a24f3616e54e16
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
c8a4324855ff31f605fe28342673945dbf413e8d 18-Oct-2017 David Chen <dwchen@google.com> Adds pulling for network bytes for statsd.

Adds atoms to collect network bytes transmitted and received via wifi
and mobile data. We need to get the list of correct ifaces from
BatteryStats since NetworkStatsService only tracks the mobile ifaces.
We split the atoms so that we can also capture metrics sliced on
foreground and background since they are available from the kernel.
Also adds an atom for the Kernel Wakelocks.

Test: Manually tested with adb shell cmd stats pull-source after
modifying the StatsPullerManager.cpp

Change-Id: I9467afad799c6d97560e868f8625fefae5c2b5e1
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
b3dda41a5a48ddfa44dc8fa939ab495926a0195d 24-Oct-2017 Chenjie Yu <cjyu@google.com> reretry ValueMetric implementation and pulling mechanism

Note:
This is for value metric. The default operations is sum the diffs.
The test uses kernel wake lock, which also needs dimension by kernel
wake lock name.

The test is a bit cumbersome as it needs StatsCompanionService to do
the alarm, which is not exact alarm.

The internal state of a slice of bucket would look something like this:

4:ipc0000005e_727_android.hardwar
0 0
4:SensorService_wakelock
40 64
4:ipc0000005c_727_android.hardwar
...

Test: manual test on device.
Change-Id: I2ed0ac7d3c5fcba8b7611d46f38a38ffd8bdc92a
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
d6896898912eb1fc2c8976dce4340ab8d4e8d22f 25-Oct-2017 David Chen <dwchen@google.com> Updates uidmap to update snapshots and upload.

We send a snapshot of all installed apps with their uids every time
a user is added or removed and when statsd is started.
We keep track of the latest timestamp when a config key has retrieved
the UID map data. This allows us to remove older data when we're
guaranteed that all config sources have retrieved the old data.

Test: Added more unit tests to UidMap_test and passed on marlin-eng.
Change-Id: I34a3d61e75eedec44b98d896d7f6db0bc383f46a
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
1481fe142d36d5f0b36eeebc358d5a8aef7bf28a 16-Oct-2017 David Chen <dwchen@google.com> Changes pulled data to use Parcel objects.

Previously, pulled data was returned as a string. We instead
return the data as an array of StatsLogEventWrapper, which encodes
using the binary-encoded format liblog uses. StatsD uses the same
parsing as for pushed events to convert these. This CL also fixes
the parsing of log_msg since the strings were previously emptied
before we had a chance to read the values.

Note that the cpp-aidl can't support List of Parcelable, so we
have to return the results as an array.

Test: Manual using the new command in StatsService to print results.
Also created a new unit-test by creating a dummy pull code of -1,
but this test is deleted since it required creating a fake output in
StatsCompanionService.

Change-Id: I1cfb9ea081a59292a60e934e8527adc40982ed80
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
47e8f4d8fff5616f354c0b324d6fcdddddeb5b18 12-Oct-2017 David Chen <dwchen@google.com> Fixes the broadcast receiver for app updates.

Skips the redundant broadcasts that are also sent with an update.
Also adds a new receiver for user additions and removes so that
we update the UID map when a user is added/removed.

Test: Manually on Marlin.
Change-Id: Ia61529f3733bc1af08b2cdef69cb1d9de47ed63f
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
de70169109c57787a23c732ec4b361ade2e9850e 05-Oct-2017 David Chen <dwchen@google.com> UID mapping to provide app name and version.

The UID map is updated by StatsCompanionService, which listens to broadcast
updates indicating that an app was updated/installed or removed. Also,
the entire map is updated when statsd first connects to the companion
service. Also, there is a way for metrics producers to subscribe to
updates, so that they can know when an app was upgraded.

Test: Created new unit-test for mapping and manually tested for install
and remove. Did not manually test the app upgrade.

Change-Id: I6676ae5c93b75c72d9badabb36aa9c40006db07d
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
1a317baedaa79f015ad637353c81abb337890733 06-Oct-2017 Chenjie Yu <cjyu@google.com> refactor statspuller

Test: manual test on device
Change-Id: Ibdec6a821e47cd2b2e7435002219c0b2e3f4c5d2
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
6214ad9f5f02d21026a1c9e132f9e95a825359fc 02-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Statsd can pull kernel wakelock data"
c68a9d21b47f4c2fb65139c10d646145a9ab9a73 27-Sep-2017 Bookatz <bookatz@google.com> Statsd can pull kernel wakelock data

When statsd is told that it is time to poll data, it asks
StatsCompanionService to pull kernel wakelock data, receives the result
(as a string), and outputs it to screen.

Still to do:
1. don't use a string; use a parcel instead
2. don't output it to screen; do something useful instead
3. do more than just kernel wakelocks
4. pull data on demand, in addition to just on periodic pulling

Test: added setPollingAlarms to statsd.main and confirmed that kernel
wakelock information was written to screen
Change-Id: I35f5164420699dea1a00c9e530b938904f1d3055
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
6bc51d737b81689567162f3c49226ca234cb7e91 29-Sep-2017 Bookatz <bookatz@google.com> Hiding StatsCompanionService with @hide

Add the @hide tag to the StatsCompanionService class.

Test: compiled
Change-Id: I19356cd8a53757981e5c35d3cba76e560b405483
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
b487b5533eba8635232009c7f32a54a0380a532d 18-Sep-2017 Bookatz <bookatz@google.com> statsd & statscompanion communication more robust

If statsd or statsdcompanion crashes, or if one loads
before the other, the other will be able to accomodate.

When statsd loads, it will attempt to tell statscompanion that it's
alive, and then get on to its business, while assuming that
statscompanion is not alive. Only when statscompanion tells statsd
that it is alive, statsd will then start to use it.

When statscompanion loads, it will attempt to tell statsd that it's
alive and then do nothing (since it has nothing to do). When statsd
tells statscompanion that statsd is alive, statscompanion will respond,
telling statsd that it is alive and, if that binder call returns, will
get to work.

This way, if statsd loads first, it can work unobstructed until
statscompanion informs statsd that it is alive, at which point they
shake hands and work. Conversely, if statscompanion loads first, it will
do nothing until statsd contacts it, at which point they will shake
hands and work.

Test: manual
Change-Id: I969ad47fb8060e27814d05ad37433a02711cfa6a
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
1b0b114abca0a7c7642b0b7de343e1e2f982ebf0 08-Sep-2017 Bookatz <bookatz@google.com> StatsCompanionService sends messages to statsd

StatsCompanionService can now inform statsd that an alarm (for anomaly
alerting and for polling) has fired, so that statsd can act accordingly.

Test: manual created an alarm from statsd.main and checked logcat that
statsd received the broadcast that it fired
Change-Id: I1d33dfbee0d3e213c91dd6973d2622ecacc890c8
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
947264128775be7f47d3e170a0fbeb6a14a5241e 31-Aug-2017 Bookatz <bookatz@google.com> Set up StatsCompanionService.java

Introduces StatsCompanionService.java and sets it up as a system service.

This service is a helper for statsd. It will be responsible for setting
and cancelling alarms related to polling stats and anomaly detection.

It currently does not have selinux permission, so must be started
manually (or with selinux temporarily disabled).

Test: disable enforcing selinux, then set and cancel alarms and make
sure they work.

Change-Id: I3bd73acdd998ee424696cce40965134c14220d8f
/frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java