Moving statsd tests to the new socket schema.
Note: When initializing LogEvents with constructor
LogEvent::LogEvent(int32_t uid, int32_t pid), make sure to use uid of 0
and pid of 0 for LogEvents that will flow from StatsLogProcessor to
MetricsManager to MetricProducer. Otherwise, these LogEvents will not
have an allowed log source.
Test: bit statsd_test:*
Bug: 149590301
Change-Id: Ic6fba5b299da1816d690079bd445df0fc1b70995
This refactoring slipped through the cracks when this function was first
written. Uploading the refactoring again now. There is no change in
functionality.
Test: atest GtsStatsdHostTestCases
Bug: 150805585
Change-Id: If6144eb5e545680f91c10674beb68d5242ee968f
Refactoring of existing pullers.
Random seed added which should be stable for single boot session
Sampling rate is approximated to adjust for number of
packages and features used on individual device over last day.
Bug: 143519689
Test: make statsd_testdrive && ./out/host/linux-x86/bin/statsd_testdrive 10075
Test: make statsd_testdrive && ./out/host/linux-x86/bin/statsd_testdrive 10060
Change-Id: I43c940636f9eeb22fa7cd74c2ec5848ed641ee0f
Instead of relying on the constants in libstatslog, hardcode them in
atoms_info to get rid of the dependency on libstatslog
New generated atoms_info.cpp:
https://paste.googleplex.com/5779947622760448
Bug: 150417465
Test: m libstatsmetadata
Change-Id: I954c963f1883f889053b63d308c648548de71e56
1. Rename registerPullAtomCallback to setPullAtomCallback
2. Rename unregisterPullAtomCallback to clearPullAtomCallback
3. Add getters to PullAtomMetadata
4. Change Ns to Millis (when I tried to make it Nanos, I received a
built time error saying to prefer millis unless we need the precision.
We do not need the precision, so I changed it).
5. Fix out of order params.
I did not change usePooledBuffer to setPooledBuffer because I think use
is more appropriate for our use case.
Test: make
Test: atest PullAtomMetadataTest
Test: atest GtsStatsdHostTestCases
Bug: 149475498
Change-Id: Ib07aa57a6e02c77917fe0e65a3d4a77c00ce8565
Statsd test links both libstatssocket and libstatssocket_private. It
shouldn't need to link both, but needs the private lib to be able to
access hidden APIs like getBuffer. So, remove it from statsd_test.
Test: atest statsd_test
Bug: 150435148
Change-Id: I46e71209489c8b1924800680f26e87ef7f4b8598
`incident` may exit too early, which leads to data lost. This commit
fixes it.
Bug: 144821874
Test: atest com.android.server.cts.IncidentdTest
Change-Id: Ib73118cb690a8247049b5685ed0b227dad63f752
These tests were broken by ag/10444161, which deleted a test-only
LogEvent constructor (the tests still built though because there was
another constructor that accepted the same parameter types but with much
different semantics).
Also fixes a bug in TestSlicedCondition that was introduced by one of
the later patchsets in ag/10444161.
Test: bit statsd_test:*
Bug: 149590301
Change-Id: If7de80922680c63505a4b30a1dcefdc47be13219
We'll use the data from the atom events to further optimize our quotas.
Bug: 135417506
Bug: 143495340
Bug: 149869487
Test: Use statsd_testdrive to test WakeupAlarmOccurred and
AppStandbyBucketChanged are both logged properly
Change-Id: Id05304175dea804d83f6056bf4da2e049496d87d
Also move NotificationChannelModified to logging hash of channel id,
to match the changes to NotificationReported.
Change-Id: Ic55f54bf59904aaa21653c8d9dc0ce9c706f9735
Bug: 146488473
Test: mp droid and check FrameworkStatsLog.java and SysUiStatsLog.java
Change-Id: If444e541ae06cdfcb9631dddcb8b923ef6ff6a4a
Also make private versions of the libraries available to link statically
for tests. We should try to figure out a better long term solution.
Test: m
Test: bit statsd_test:*
Test: atest LibStatsPullTests
Test: bit libstatssocket_test:*
Test: atest GtsStatsdHostTestCases
Bug: 149340100
Change-Id: I05b91efab2a657aec75d436575aff4373f86ed3f
This CL serves as a prototype for future efforts to move statsd tests to
the new socket schema.
We also significantly refactor the LogEvent class by introducing two new
functions:
- LogEvent::LogEvent(int32_t uid, int32_t pid)
- bool LogEvent::parseBuffer(uint8_t* buf, size_t size)
The goal is that these two functions will be the only two entry points
into the class. Separating these two is helpful because (a) it allows
test and source code to use the same codepath and (b) it allows the
calling function to see if the atom encoding was successfully parsed
(note that constructors can't return values).
P.S. This CL breaks LogEventQueueTests, but that will be resolved once
all tests are moved to the new constructors.
Test: m statsd
Test: bit statsd_test:SimpleConditionTrackerTest#TestSlicedCondition
Bug: 149590301
Change-Id: Id3c9522c4467c4869ec97226734a556dd9dfb169
Merged-In: Id3c9522c4467c4869ec97226734a556dd9dfb169
(cherry picked from commit 14f56f6bc4)
There are cases where an app can ship overlays for itself,
but the "signature" policy as described would open up
a vulnerability by allowing the system actor to create
and sign any arbitrary overlay that will apply to the target.
To prevent this, redefine "signature" as target package only,
and introduce "actor" for checking against the actor signature.
Any app that wishes to use both can include both policies.
Bug: 130563563
Test: m aapt2_tests idmapt2_tests and run from host test output
Test: atest libandroidfw_tests
Change-Id: I1c583a5b37f4abbeb18fc6a35c502377d8977a41
To make it easier to add the actor policy in a follow up CL,
move most of the policy handling to a central location.
The strings and transformation between strings and flags is
now handled in libidmap2policies, with libandroidfw
containing the single source of policy flags.
This also extracts all the test resource IDs into an R.h
so they can be swapped without having to edit a dozen files
each time.
Bug: 130563563
Test: m aapt2_tests idmapt2_tests and run from host test output
Test: atest libandroidfw_tests
Change-Id: Ie533c9cebf938215df7586f00c38763ae467e606
getLine returns -1 when it reaches EOF, and currently incident_helper
does not differentiate between EOF and an actual error when calling
getLinefrom file. So incident_helper throws an error when it reaches
EOF, and this is not good. This change separates these two cases.
Bug: 149895022
Bug: 150145113
Test: incident_helper_test
Change-Id: Ic5e67f8f9e55719c17d624718b730981c4249da1
Idmap Scan previously called Verify before calling Create. OverlayConfig
should do the same. Removing the verify call caused b/149784008.
Since sSystem is marked @UnsupportedAppUsage,
createSystemAssetsInZygoteLocked could potentially be invoked in the
system server. Rather than attempting to create the overlays a second
time, first check whether the idmap must be invalidated.
Bug: 149784008
Test: running forrest using web UI
Change-Id: I5d995a87e8552bd156fb5415b2c46a08f4c1d6c5
This atom is intended to be used to alert a Perfetto subscriber on a
subset of janky events. This is for experimenting tracing jank events
from dogfood so that we can improve issue detection.
Bug: 148543048
Test: builds
Change-Id: I368855e4045c78a0cb65041cca762f4d334de916
(cherry picked from commit d09573a110)
Merged-In: I368855e4045c78a0cb65041cca762f4d334de916
statsd logs when an sensitive appop is accessed while a foreground
service is held. These appops include
OP_FINE_LOCATION
OP_COARSE_LOCATION
OP_RECORD_AUDIO
OP_CAMERA
It logs the number of times each of these appops is requested per session
during which the uid holds any foreground service.
Appops requested while the app's process state is TOP are ignored.
Also, the pre-existing ForegroundServiceStateChanged atom has an
additional field that logs whether the fgs is considered 'in-use' in the
context of being allowed while-in-use permissions.
Bug: 149497535
Test: atest UidAtomTests#testForegroundServiceState UidAtomTests#testForegroundServiceAccessAppOp
Test: manually monitor: adb shell cmd stats print-logs && adb logcat -v uid -s statsd | grep "statsd : {" | egrep '\((60|256)\)'
Change-Id: I991a427dc2ab00399188b10b266ab2d9aa92696d
Merged-In: I991a427dc2ab00399188b10b266ab2d9aa92696d
(cherry picked from commit 0c8637c067)
Sony introduced some logic that combines devices kernel splits into one
Android device based on identical pid, vid and non-empty uniq. Therefore
populate this field with device ID.
We can change that to a separate uniq attribute in register JSON file if
necessary later.
Bug: 38511270
Test: getevent -li shows that uniq is populated.
Change-Id: Ieca0b826c86e9cad7fa3d3c8f98b9cfd54d20c73
Rename "duration" field to correspond with the
actual time unit.
Bug: 139439353
Test: Successful build
Change-Id: I3e9b3ac5778d6fa4b6de35079743bdf6e85b7560
This helps us know if jobs with a particular constraint are being
starved or otherwise dysfunctional due to a bug.
Test: make statsd_testdrive &&
./out/host/linux-x86/bin/statsd_testdrive 8
Sample output:
atom {
scheduled_job_state_changed {
attribution_node {
uid: 10224
tag: ""
}
job_name: "android.jobscheduler.cts.jobtestapp/.TestJobService"
state: SCHEDULED
stop_reason: STOP_REASON_CANCELLED
standby_bucket: RESTRICTED
job_id: 691
has_charging_constraint: true
has_battery_not_low_constraint: true
has_storage_not_low_constraint: false
has_timing_delay_constraint: false
has_deadline_constraint: true
has_idle_constraint: true
has_connectivity_constraint: true
has_content_trigger_constraint: false
}
Bug: 138239687
Change-Id: I175e5a0f5cc2cb3be447ccb58142006946092e75