Because statsd now uses StatsDimensionsValueParcel instead of
StatsDimensionsValue.h/c, statsd no longer has to depend on libservices.
Test: m -j
Test: atest StatsdHostTestCases#testBroadcastSubscriber
Bug: 148604617
Change-Id: I6d65383ccec99f4672d6575232981c0f6cc40fcf
Since all pullers now use StatsEvent instead of StatsLogEventWrapper,
this class can be deleted.
Test: m -j
Test: m -j statsd_test
Bug: 146578681
Change-Id: I63013768ee13af0235f8cd857ca3fc16d2fd877f
As of ag/9820253, Binder communication between pull atom clients and
statsd uses the structured StatsEventParcel. The custom parcelable
StatsEvent class is not needed anymore.
Test: m
Change-Id: I33aa975a2cd1b02ba232aadc11e2ac58814de4c3
This creates a java API for registering pullers. Will implement the
statsd side in a follow up CL.
Test: builds, boots
Change-Id: Ib6735984297ce3148839a6370a3c15b2a585baf5
- Remove DropBoxManager::getNextEntry as the method was unused.
- Stop DropBoxManager::Entry inheriting from RefBase.
This was causing bugs since DropBoxManager constructs Entry
on the stack (in a non-ref counted context).
Bug: 119655216
Test: make
Change-Id: If0852ab6bcc1a92560132628897977eac16fddea
This reverts commit 9c7b1319962673658ee28a7845fc0a7cf840c61e.
Reason for revert: Fixed build failures due to merge
Change-Id: I7d7bfed3a3234b966f3fe3fd6e0cbc63d2bedf83
Test: unit test
This reverts commit ce8e4dce609541f90c444f27250a6a341b3f1d23.
Reason for revert: breaking multiple targets in master
Change-Id: I3ee74b314e06cb2c4d3d6da82ca116a91aad67d4
BatteryStats calculates power usage of the device and various components
(such as apps). This information is used, e.g., in the battery panel of
Settings. We now log it to statsd. It can be used for validating how
good the information displayed in Settings is. In the long-term, it is
likely not ideal for off-device calculations, since that can be
hopefully estimated using statsd's raw data.
Three atoms: one for the total power use, one for the power use of each
uid, and one for each non-uid component. Since they will all likely be
pulled together, StatsCompanionService will provide stale data for
BatteryStats pulls called within a second of a previous BatteryStats
pull.
Also in this cl:
Remove StatsLogEventWrapper.writeDouble. Statsd doesn't support actually
writing doubles into its proto reports, so having this function is
misleading (the data will get to statsd and then be completely ignored).
It's less confusing if we don't pretend it does something.
Change-Id: If80bab8ea938afa4632535bb88ff59879fbe8099
Fixes: 119111972
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.atom.UidAtomTests#testDeviceCalculatedPowerUse
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.atom.UidAtomTests#testDeviceCalculatedPowerBlameUid
Test: BatteryStatsHelperTest#testDrainTypesSyncedWithProto
When statsd pulls data from StatsCompanionService, the data is put into
log_msg format on java side and expanded into LogEvent on cpp side.
There is a lot of dependency on log_msg and liblog to add new types.
There is pending bug to rewrite thta part of the code in statsd to
completely rid the legacy of logd and liblog. But that may not happen
soon.
Now we can support new storage type.
Also no need to specify number of fields in StatsLogEventWrapper cstr,
which is a source of bug in P.
Bug: 115775035
Test: manual test and cts test
Change-Id: Id1f0b033885da6f3bcebe043968061821db48f35
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
Follow up to I076bfd3180fb9b4baff7e1bae2e611419061b2a7. Adds an
error message if passing -1 to addFile(int fd)
Change-Id: I73a8d88f12b14bc28ea3bc3782a9df7d96d53c92
Test: builds
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
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
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
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
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
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