Commit Graph

3126 Commits

Author SHA1 Message Date
Chenjie Yu
e0f7fc0a47 Merge "add dump report reason to reports" into pi-dev
am: a194a6bee3

Change-Id: I07a2d92ae166e86afa5bd6600d1217180818b9c3
2018-04-18 13:45:45 -07:00
TreeHugger Robot
a194a6bee3 Merge "add dump report reason to reports" into pi-dev 2018-04-18 20:35:29 +00:00
Chenjie Yu
e36018b272 add dump report reason to reports
+ also change uidmapping version numbers to int64_t

Bug: 78132855
Change-Id: Iac7ea93e4bf651bd65bd03383e7ab4971af4fc29
Fix: 78132855
Test: gts test
2018-04-18 20:19:21 +00:00
Chenjie Yu
4f01d03ed5 Merge "Fix merge isolated uid to host uid" into pi-dev
am: 2abcea2b8a

Change-Id: Ib1f2929cea7ecc1345f78c3c2c1296cecfcc814b
2018-04-18 10:20:42 -07:00
TreeHugger Robot
2abcea2b8a Merge "Fix merge isolated uid to host uid" into pi-dev 2018-04-18 17:07:13 +00:00
Chenjie Yu
728d52a6db Fix merge isolated uid to host uid
Bug: 78190783
Fix: 78190783
Test: unit test
Change-Id: I71b5c575bf3c226509ebf088cb5dd961acd93459
2018-04-17 15:24:52 -07:00
David Chen
8916753209 Merge "Adds option to drop small buckets for statsd." into pi-dev
am: bbc057444f

Change-Id: I1ab4de808eef9e7f0ef78a4ea336db9a83420c02
2018-04-17 13:35:20 -07:00
Yi Jin
c83714bf14 Merge "Free allocated varargs" into pi-dev
am: c3116634e1

Change-Id: Iaa62f67364a7f5d34b578b319cd1a06b565db5b8
2018-04-17 13:28:08 -07:00
TreeHugger Robot
a3ba94b3a4 Merge "Migrate android_uiautomator generation to Soong." into pi-dev-plus-aosp 2018-04-17 19:17:37 +00:00
TreeHugger Robot
bbc057444f Merge "Adds option to drop small buckets for statsd." into pi-dev 2018-04-17 19:12:33 +00:00
TreeHugger Robot
c3116634e1 Merge "Free allocated varargs" into pi-dev 2018-04-17 19:08:26 +00:00
Yi Jin
480de784a3 Free allocated varargs
Bug: 78173836
Test: atest incidentd_test
Change-Id: I1e1b9f63d0e863c733c51efef432235eb94cdbab
2018-04-17 10:47:31 -07:00
Yi Jin
dce1c9fa91 Merge "Fix incidentd skip collecting timedout of a section." into pi-dev
am: 0f0c9243be

Change-Id: Ib27dd0d695ecf43dfb781e0c8a3374b97b2ca15e
2018-04-17 09:39:25 -07:00
TreeHugger Robot
0f0c9243be Merge "Fix incidentd skip collecting timedout of a section." into pi-dev 2018-04-17 16:22:20 +00:00
Tej Singh
abefde6c1f Merge "Enforce dump permission in stats service" into pi-dev
am: abdf6e8039

Change-Id: I0034bd5f4452a0c8b68f9e261434897e03ab83c7
2018-04-16 18:51:54 -07:00
David Chen
81245fd53a Adds option to drop small buckets for statsd.
We notice that some of the pulled metrics have a ton of data, and
during app upgrades, we're forming partial buckets that represent
small periods of time but require many bytes of data. We now have an
option to drop these buckets that are too short. Note that we still
have to pull the data to keep the metrics for the next bucket
correct. We include a new field in the value and gauge metric outputs
so that it's easy to tell when a bucket was dropped.

We drop the partial buckets also from anomaly detection since we
should be computing anomalies from the same data that is reported.

Test: Added unit-tests for value and gauge metrics.
Bug: 77925710
Change-Id: Ic370496377c6afd380e02278a6c1ed8b521a2731
2018-04-16 18:42:14 -07:00
Tej Singh
abdf6e8039 Merge "Enforce dump permission in stats service" into pi-dev 2018-04-17 01:34:47 +00:00
Jeff Sharkey
7b913d70b9 Merge "Protect usage data with OP_GET_USAGE_STATS." into pi-dev
am: 936c0868f8

Change-Id: I3c84c646b3a79f09dc1210e18f48d1f87d38abd4
2018-04-16 17:44:58 -07:00
Jeff Sharkey
936c0868f8 Merge "Protect usage data with OP_GET_USAGE_STATS." into pi-dev 2018-04-17 00:04:53 +00:00
Nan Zhang
779b0eac36 Migrate android_uiautomator generation to Soong.
Bug: b/70351683
Test: m clean && m android_uiautomator
and compare the old and new stubs.jar using md5sum.

Change-Id: I01937352ae1a470745f2ab1a9acbb4ea9520e153
Merged-Id: I01937352ae1a470745f2ab1a9acbb4ea9520e153
(cherry-picked from commit:5b1e7c9e891359acd108f57db21640f17328a747)
2018-04-16 16:56:23 -07:00
David Chen
5cc0e05e03 Merge "Adds a code when statsd sends intent to getData." into pi-dev
am: 17d2de09cb

Change-Id: I4f429329603d7dfe512de6802d4f083d230fc4d1
2018-04-16 16:21:23 -07:00
Tej Singh
dd83d70371 Enforce dump permission in stats service
Enforces the dump permission in stats service and fixes a typo in an
enum name.

Bug: b/77723108
Test: adb shell dumpsys stats as root and not root
Test: build success on marlin (and cts build success)
Change-Id: I131f97fe4fd370d50bc4ad369377f6adcca5f6ae
2018-04-16 15:04:28 -07:00
Yi Jin
98ce81050b Fix incidentd skip collecting timedout of a section.
By moving the section stats collection before any return statements,
it won't missing stats collection.

Bug: 77962855
Test: atest incidentd_test
Change-Id: I0900556428c51636e24df48a407eb916ccff795c
2018-04-16 13:42:48 -07:00
Jeff Sharkey
6b64925737 Protect usage data with OP_GET_USAGE_STATS.
APIs that return package usage data (such as the new StatsManager)
must ensure that callers hold both the PACKAGE_USAGE_STATS permission
and the OP_GET_USAGE_STATS app-op.

Add noteOp() method that can be called from native code.

Also add missing security checks on command interface.

Bug: 77662908, 78121728
Test: builds, boots
Change-Id: Ie0d51e4baaacd9d7d36ba0c587ec91a870b9df17
2018-04-16 12:44:32 -06:00
David Chen
d37bc23f50 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
2018-04-13 17:01:13 -07:00
Yi Jin
634acf3aa0 Merge "Reduce disk space limit for incident reports." into pi-dev
am: a991071db9

Change-Id: I91a5bcc59ad1472832dfe0cf2e07216c8abf54f3
2018-04-13 14:00:16 -07:00
TreeHugger Robot
a991071db9 Merge "Reduce disk space limit for incident reports." into pi-dev 2018-04-13 20:34:31 +00:00
Yi Jin
b15d1e362f Merge "Add tests to cover handling negative varint." into pi-dev
am: 9a58caaaff

Change-Id: I0d7ee09e8d0243fa5dd82114431e8ca0135ed49a
2018-04-12 17:27:38 -07:00
TreeHugger Robot
9a58caaaff Merge "Add tests to cover handling negative varint." into pi-dev 2018-04-12 23:36:29 +00:00
Yi Jin
ba7ee6ff11 Add tests to cover handling negative varint.
The gtest will fail if the fix of b/77291057 isn't there. Should make
this change in with the fix, but later than none.

Bug: 77291057
Test: atest incidentd_test
Change-Id: I48ece311f78ee18d97486839a3b8b434c9419cf3
2018-04-12 22:59:41 +00:00
Yi Jin
91d4330202 Reduce disk space limit for incident reports.
Bug: 77963176
Test: atest incidentd_test and manual
Change-Id: I8ad1d10fcd40ff556255ac27c049265e79c7d558
2018-04-12 11:06:57 -07:00
Bookatz
b1d3483102 Merge "StatsManager throws exceptions" into pi-dev
am: 6b317915e8

Change-Id: I3de523046404285f3bcc7bfff598393d7c16820d
2018-04-11 11:19:33 -07:00
Yao Chen
808582230d Merge "Handle logd reconnect." into pi-dev
am: 2e0f45f087

Change-Id: I15cdb063331da9b1e6479d598314fb1cf05ab9f1
2018-04-11 10:10:46 -07:00
TreeHugger Robot
6b317915e8 Merge "StatsManager throws exceptions" into pi-dev 2018-04-11 17:02:06 +00:00
Yangster-mac
f0134aad37 Merge "Flush the bucket when creating the metric producer. Use int64 for value field. E2e test for gauge/value metric." into pi-dev
am: 5f91d5ee94

Change-Id: I3d3e040504ad8978f535fac2d62cfb8262c2e386
2018-04-10 22:09:18 -07:00
Yao Chen
163d2602db Handle logd reconnect.
When statsd reconnects to logd, statsd will read all logs from buffer again. To prevent us from
reprocessing old events, we do the following:

1. At any given moment, record the largest timestamp(T_max) and last timestamp (check point) that
   we've seen before.
2. When reconnection happens, we look for the check point until we see a new log with a timestamp
   larger than T_max.
   -> If we found the CP, resume after the CP. Success
   -> If we can't find CP, there is definitely log loss. We reset all configs.

Note:
1. Logd has an API to read logs after a certain timestamp. But this api is vulnerable to
time changes from Settings. So we cannot rely on it.

2. If logd inserts a new log (with older timestamp) before CP, we cannot detect it. It's not
   possible to detect it without record all timestamps we have seen.

Test: statsd_test
Bug: 77813113

Change-Id: Ic3fdb47230807606ab11dc994cb162194adb8448
2018-04-10 22:06:03 -07:00
Yangster-mac
15f6bbc24f Flush the bucket when creating the metric producer.
Use int64 for value field.
E2e test for gauge/value metric.

BUG: b/74445671

Test: statsd test.
Change-Id: I823a0bade8f89834bdfb9cf48864852a47d7b63b
2018-04-10 20:25:13 -07:00
Bookatz
4f71629002 StatsManager throws exceptions
When StatsManager fails to connect to statsd, it now throws an exception
for the caller to catch. It also throws an exception of the config being
added is of an unreadable format.

Due to backwards compatibility issues, the old APIs could not be
changed, so new ones were made to replace the old ones. The old ones are
now temporary and will be removed when the compatibility issue is
resolved.

Bug: 77648233
Test: gts-tradefed run gts-dev --module GtsStatsdHostTestCases
Change-Id: Ibea05883a29b9b3ef9927d2f8fe295eb99832ab7
2018-04-10 19:07:32 -07:00
Chenjie Yu
0e93fd3da5 Merge "Drop value if the bucket is totally tainted" into pi-dev
am: 5bc03014c0

Change-Id: I92b47ad538eeec38fbf4b4d7211dc75ebf903880
2018-04-10 18:01:53 -07:00
Chenjie Yu
ae63b0af94 Drop value if the bucket is totally tainted
Bug: 77870358
Change-Id: Ia96970a3254de08f94b91ad53be2fdb9f4db7eb4
Fix: 77870358
Test: unit test
2018-04-10 14:59:31 -07:00
Tej Singh
33efdf91a9 Merge "Add proto output of statsd stats in adb" into pi-dev
am: c63fdfe02c

Change-Id: Ic48a98b037b070799adf73a45f4dcf6959af6cb3
2018-04-06 14:06:46 -07:00
Tej Singh
c63fdfe02c Merge "Add proto output of statsd stats in adb" into pi-dev 2018-04-06 20:42:22 +00:00
Yangster-mac
585fc9d7e5 Merge "Flush the partial bucket when startd shuts down or config updated." into pi-dev
am: 9d4c397781

Change-Id: I47587b68036a563553f1de2c9f37e1255fb6d770
2018-04-05 19:59:35 -07:00
Yangster-mac
e68f3a5811 Flush the partial bucket when startd shuts down or config updated.
Test: statsd test

BUG: b/77556036
Change-Id: Ie4a04ace55e07c4529cdff5906ba874f8815f620
2018-04-05 18:05:57 -07:00
David Chen
8420ea9bcc Merge "Fix uid map to be simpler and fix partial bucket." into pi-dev
am: 203bbbf942

Change-Id: Id9073af7625257072d6383aa174e9e5f21dc6216
2018-04-05 17:00:49 -07:00
David Chen
203bbbf942 Merge "Fix uid map to be simpler and fix partial bucket." into pi-dev 2018-04-05 23:43:45 +00:00
David Chen
bd12527c90 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
2018-04-05 16:15:01 -07:00
Tej Singh
41b3f9a8cf Add proto output of statsd stats in adb
Test: statsd unit tests
Test: visually verified output of adb shell cmd stats print-stats was
sane
Test: making a CTS test that uses proto output
Bug: b/77548658

Change-Id: Ie60d66b9883f109446745dfcef97b7fb6194a1ac
2018-04-05 14:09:05 -07:00
Yi Jin
dceecbd1fa Merge "This cl tries to fix cts tests IncidentdTest" into pi-dev
am: 72a39eb3be

Change-Id: Ia9e3f94b367dffc6482f5f3ba12aeaba2eed6874
2018-04-05 12:10:55 -07:00
TreeHugger Robot
72a39eb3be Merge "This cl tries to fix cts tests IncidentdTest" into pi-dev 2018-04-05 18:48:59 +00:00