12 Commits

Author SHA1 Message Date
Jeff Sharkey
c36c3b9469 Protect usage data with OP_GET_USAGE_STATS.
APIs that return package usage data (such as DropBoxManager) must
ensure that callers hold both the PACKAGE_USAGE_STATS permission
and the OP_GET_USAGE_STATS app-op.

Bug: 78355661
Test: Search output directory for binaries that have READ_LOGS but not
USAGE_STATS and find none.

Change-Id: I85e3bad680bb510439d73c7db5cc50cdcb7bbb42
2018-05-23 14:17:32 -07:00
Primiano Tucci
4307efc89e Merge "DropboxManager: Add err message if passing an invalid fd to addFile()" am: 90529d212a am: 13d6ac4a35
am: 72b12e4222

Change-Id: Icfe984f46cb6e6cdc216d7182285c7e55abe93ab
2018-01-30 18:55:57 +00:00
Primiano Tucci
372938942f DropboxManager: Add err message if passing an invalid fd to addFile()
Follow up to I076bfd3180fb9b4baff7e1bae2e611419061b2a7. Adds an
error message if passing -1 to addFile(int fd)

Change-Id: I73a8d88f12b14bc28ea3bc3782a9df7d96d53c92
Test: builds
2018-01-26 17:30:45 +00:00
Primiano Tucci
5490b610b3 DropBoxManager: Allow adding a file using an fd
This patch adds an overload to DropBoxManager::addFile() which accepts
an already-opened file as a file descriptor. This avoids the need for
clients to create a filesystem-visible file when uploading data to
DropBox.

Test: Tested with perfetto using https://android-review.googlesource.com/c/platform/external/perfetto/+/587674
Change-Id: I076bfd3180fb9b4baff7e1bae2e611419061b2a7
Merged-In: I076bfd3180fb9b4baff7e1bae2e611419061b2a7
2018-01-26 14:25:18 +00:00
TreeHugger Robot
0cccde6b1a Merge "DropBoxManager: Allow adding a file using an fd" 2018-01-25 14:14:23 +00:00
Bookatz
c697797d43 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
2018-01-24 13:08:19 -08:00
Sami Kyostila
52c866eea4 DropBoxManager: Allow adding a file using an fd
This patch adds an overload to DropBoxManager::addFile() which accepts
an already-opened file as a file descriptor. This avoids the need for
clients to create a filesystem-visible file when uploading data to
DropBox.

Test: Tested with perfetto using https://android-review.googlesource.com/c/platform/external/perfetto/+/587674
Change-Id: I076bfd3180fb9b4baff7e1bae2e611419061b2a7
2018-01-12 19:04:02 +00:00
Sami Kyostila
2bfba3afbf base: Convert libs/services/Android.mk into a blueprint
Convert libs/services/Android.mk into a blueprint module so it can be
linked by other blueprint modules.

Test: mmm frameworks/base
Change-Id: I7acf9aa084d262a5aba5a58e45d9647e15c6dffb
Merged-In: I7acf9aa084d262a5aba5a58e45d9647e15c6dffb
2018-01-12 11:13:22 +00:00
Sami Kyostila
4389e6bc2d base: Convert libs/services/Android.mk into a blueprint
Convert libs/services/Android.mk into a blueprint module so it can be
linked by other blueprint modules.

Test: mmm frameworks/base
Change-Id: I7acf9aa084d262a5aba5a58e45d9647e15c6dffb
2018-01-11 11:53:15 +00:00
David Chen
1481fe142d 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
2017-10-20 16:29:59 -07:00
Yao Chen
482d272d7c Add a cmd line tool to StatsService to parse log files from Dropbox
Test: adb shell cmd stats all-logs
Change-Id: I7803c9c021a971619f60fbf6bdfabd33d2f476ef
2017-09-13 16:58:41 -07:00
Joe Onorato
de5b027d2c Add a native class to interact with DropBoxManager.
Test: Not written yet
Change-Id: I63ed888bd76f75c78a244a1bffae2d26f3b5f055
2016-12-15 11:23:05 -08:00