Commit Graph

5511 Commits

Author SHA1 Message Date
TreeHugger Robot
591bb7b1fe Merge "Enforce permission on native puller API" into rvc-dev 2020-03-19 21:12:52 +00:00
Tej Singh
10458eca11 Enforce permission on native puller API
Test: m
Test: no security exceptions on boot
Test: atest LibStatsPullTests
Bug: 148955001
Change-Id: I4b06bfc41be2925270eaddd717f1499d98739dae
2020-03-19 11:54:11 -07:00
tsaichristine
3ca4d78d72 (Part 2.4) Use new socket schema in ValueMetricProducer_test
First CL at ag/10697747. Sending ValueMetricProducer_test as multiple CLs to retain diff and make
it easier to review.

Updates from TestUseZeroDefaultBase to TestEmptyDataResetsBase_onDataPulled

Test: bit statsd_test:*
Bug: 149590301
Change-Id: I91601123e8aaeb92aa6e6618dbd12467949a94e4
2020-03-19 10:28:20 -07:00
tsaichristine
5adb1b1461 (Part 2.3) Use new socket schema in ValueMetricProducer_test
First CL at ag/10697747. Sending ValueMetricProducer_test as multiple CLs to retain diff and make
it easier to review.

Updates from TestPushedEventsWithoutCondition to TestSkipZeroDiffOutputMultiValue

Test: bit statsd_test:*
Bug: 149590301
Change-Id: Ie429f36124d475c16652eb52fed41ab88128ffdd
2020-03-18 16:24:54 -07:00
TreeHugger Robot
0c4353a5d6 Merge "Fix incidentd stack use-after-return" into rvc-dev 2020-03-18 20:33:45 +00:00
Jeffrey Huang
4980c0a6cf Merge "Migrate statsd_test to use libstatslog_statsdtest" into rvc-dev 2020-03-18 19:47:14 +00:00
Mike Ma
b328e290f1 Fix incidentd stack use-after-return
The detached thread may live longer than the caller, and then "data"
goes out of scope. Fix it by managing data using a strong pointer.

Fixes: 151335416
Test: turn on hwasan, tweak WorkerThreadSection timeout, verify no
hwasan error

Change-Id: I179204b17c381e4e920b9aee07900150d9497639
2020-03-18 11:43:15 -07:00
Christine Tsai
300ee6ea68 Merge "(Part 2.2) Use new socket schema in ValueMetricProducer_test" into rvc-dev 2020-03-18 17:45:08 +00:00
tsaichristine
b828fe2a72 (Part 2.5) Use new socket schema in ValueMetricProducer_test
First CL at ag/10697747. Sending ValueMetricProducer_test as multiple CLs to retain diff and make
it easier to review.

Updates from TestEmptyDataResetsBase_onConditionChanged to TestInvalidBucketWhenPullFailed

Test: bit statsd_test:*
Bug: 149590301
Change-Id: I915b47e086ee5065eaa71094b83d2b271ce847b7
2020-03-17 18:25:37 -07:00
tsaichristine
f487f2a509 (Part 2.2) Use new socket schema in ValueMetricProducer_test
First CL at ag/10697747. Sending ValueMetricProducer_test as multiple CLs to retain diff and make
it easier to review.

Updates from TestPulledEventsTakeAbsoluteValueOnReset to TestPulledValueWithUpgradeWhileConditionFalse

Test: bit statsd_test:*
Bug: 149590301
Change-Id: I31b4a635262586aedeb23f84cae3d66f48593b3f
2020-03-17 18:07:23 -07:00
Susi Kharraz-Post
3b8389263e Merge "Add sharesheet + generic ranking atoms for statsd." into rvc-dev 2020-03-17 20:14:27 +00:00
Jeffrey Huang
3eb84d4da9 Migrate statsd_test to use libstatslog_statsdtest
This is part of the migration to remove libstatslog from statsd

Since we still depend on libstatsmetadata, we cannot fully mock out
all the atoms. So we will create a new libstatslog_statsdtest to house
atoms used only in the tests.

Bug: 150976524
Test: bit statsd_test:*
Change-Id: I6368305eb89b2c35e670e42907a308afd922e604
2020-03-17 11:59:01 -07:00
TreeHugger Robot
92eb1bbfd4 Merge "(Part 2.1) Use new socket schema in ValueMetricProducer_test" into rvc-dev 2020-03-17 18:21:32 +00:00
Susi Kharraz-Post
1df7b0066a Add sharesheet + generic ranking atoms for statsd.
Bug: 147508495

Change-Id: Ie02cbb84a0ddfe7ca51acf722f9a5632b846f283
Test: m out/soong/.intermediates/frameworks/base/framework-statslog-gen/gen/android/util/StatsLogInternal.java out/soong/.intermediates/frameworks/base/tools/stats_log_api_gen/statslog.cpp/gen/statslog.cpp
Android Metrics Design Review: https://eldar.corp.google.com/assessments/369729150/revisions/1?jsmode=du

Change-Id: I49391a786840febb6b7b67ac91e029d8d742e956
2020-03-17 18:10:37 +00:00
tsaichristine
bb33b803ef (Part 2.1) Use new socket schema in ValueMetricProducer_test
Sending ValueMetricProducer_test as multiple CLs to retain diff and make
it easier to review.

I added a few different CreateLogEvent functions that account for tests
that need events with 0, 2, and 3 values.

The old #createEvent function took in one value but added it twice to the
LogEvent. I replaced this with #CreateRepeatedValueLogEvent. Any events
made with #createEvent or that took the form of:
event.write(tagId)
event.write(value)

was replaced with a call to #CreateRepeatedValueLogEvent. I assumed
that the tagId was used as the first field because an arbitrary number
was needed.

Test: bit statsd_test:*
Bug: 149590301
Change-Id: I26de8074a66babcf3ab7ee395be0598d88b4ba59
2020-03-17 09:17:27 -07:00
Stanislav Zholnin
86e27477a7 Merge "Delay initialization of RarelyUsedPackages and package sampling." into rvc-dev 2020-03-16 09:23:17 +00:00
Stanislav Zholnin
48811ee600 Add logging operation ids.
Add operation ids which are used only for logging. They will
allow to reduce bandwidth required for logging. Mapping between
operation string ids (OPSTR_, public API) and Logging ids
is enforced by statsd CTS test.

Bug:143519689
Test: android.cts.statsd.atom.UidAtomTests#testAppOps
Test: android.cts.statsd.atom.UidAtomTests#testForegroundServiceAccessAppOp
Exempt-From-Owner-Approval: discussed  with moltmann@ in chat.

Change-Id: I2f85d6889e946219557d26b28334d4bacde06b12
Merged-In: I2f85d6889e946219557d26b28334d4bacde06b12
2020-03-15 14:29:32 +00:00
Stanislav Zholnin
4c32385bf6 Delay initialization of RarelyUsedPackages and package sampling.
Delay uniform sampling of packages.
Introduce boot time sampling of packages - simplified sampling designed
to save time during start up sequence.

Bug: 150239020
Test: manual verification
Change-Id: I5911b663cfefe324a443b0ba3f97c46e0984a0f3
2020-03-15 11:23:53 +00:00
TreeHugger Robot
e9133b9351 Merge "Parse annotations within LogEvent" into rvc-dev 2020-03-14 01:29:41 +00:00
Ruchir Rastogi
84eb44bb4c Parse annotations within LogEvent
This is a preliminary CL that parses annotations within LogEvent, but
does nothing with the annotations provided. Annotation information will
be exposed from LogEvent/FieldValue in a future CL. (That CL will also
contain tests for parsing annotations.)

Test: m statsd
Bug: 150414043
Change-Id: Iae79644ea8455280a654076bfd5819927d4183d3
2020-03-13 16:40:14 -07:00
Philip P. Moltmann
12ac3f406f Rename featureId -> attributionTag
In the core functionality this changes everything including aidl's and
field names:
- Context
- ContentProvider
- AppOps*
- Package parsing

For the rest, this is a shallow change to only change to the changed
APIs. This keeps the change small-ish

Exempt-From-Owner-Approval: Rename
Fixes: 148792795
Test: TH
Change-Id: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
Merged-In: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
2020-03-12 19:26:10 +00:00
Chi Zhang
91af57e5c1 Merge "Telephony statsd atoms." into rvc-dev 2020-03-12 17:53:55 +00:00
Jooyung Han
9432967df0 Merge "Use aidl::nullable for nullable type in C++" into rvc-dev 2020-03-12 11:37:07 +00:00
Jooyung Han
66c567a8c4 Use aidl::nullable for nullable type in C++
To reduce the discrepance between old code which still uses
std::unique_ptr and new code using std::optional.

This might help to avoid merge-conflicts between branches.

Bug: 144773267
Test: m
Merged-In: Ie3196ee5cce17d77950eea9479d2cc1406e9e674
Merged-In: I33822bc76ef87637d5408849f64a0607e121792e
Change-Id: I33822bc76ef87637d5408849f64a0607e121792e
(cherry picked from commit ad62e8cbf5)

Exempt-From-Owner-Approval: cherry-pick from master with owner's approval
2020-03-12 11:36:33 +00:00
TreeHugger Robot
94425b919b Merge "Update path for SnapshotMergeReported." into rvc-dev 2020-03-12 10:38:43 +00:00
Chi Zhang
bb9ed92165 Telephony statsd atoms.
Test: build
Bug: 146066107
Bug: 141631489
Bug: 122371089
Bug: 149880090
Bug: 127666858

Change-Id: I124cf2da59ed4c5e92406081aac0df0f347ace74
2020-03-11 15:10:36 -07:00
Yifan Hong
36137f09e9 Update path for SnapshotMergeReported.
Test: none
Bug: 147696014
Change-Id: I125691cfdda1e42946fd23879390fe5fafe1fbc5
2020-03-11 10:35:33 -07:00
tsaichristine
0defefc820 Fix order of arguments in statsd_test_util header file
Test: bit statsd_test:*
Bug: 149590301
Change-Id: If88293d25481c3d00edde6d6e9ecfcc8069860c5
2020-03-11 07:56:17 -07:00
TreeHugger Robot
a8c6c8b1f6 Merge "(Part 1) Use new socket schema with statsd tests" into rvc-dev 2020-03-11 07:05:51 +00:00
Jeffrey Huang
75274ad0fa Merge "Remove apex_available from libstatslog" into rvc-dev 2020-03-11 05:26:32 +00:00
tsaichristine
7747d37c34 (Part 1) Use new socket schema with statsd tests
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
2020-03-10 16:46:10 -07:00
Jeffrey Huang
74fc4354b5 Remove apex_available from libstatslog
Test: m -j
Bug: 149781190
Change-Id: I765852b1719a3056c06a0965ea6a05a8e8410693
2020-03-10 15:14:27 -07:00
Stanislav Zholnin
3eae86528a Merge "Add boot session stable sampling to AppFeaturesOps puller." into rvc-dev 2020-03-10 13:30:02 +00:00
Ruchir Rastogi
70d266df9b Merge "Fix TODOs made during migration to libbinder_ndk" into rvc-dev 2020-03-09 17:54:19 +00:00
Ruchir Rastogi
1497e8fdca Fix TODOs made during migration to libbinder_ndk
Test: atest GtsStatsdHostTestCases
Bug: 149254662
Change-Id: I50a1998e693f9a0c447cd655f8efa11afa28803b
2020-03-08 18:47:40 -07:00
Ruchir Rastogi
3db6204b99 Clean up toStatsDimensionsValueParcel
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
2020-03-08 17:39:32 -07:00
Tej Singh
8651b62518 Merge "Address Puller API Feedback" into rvc-dev 2020-03-06 18:43:31 +00:00
TreeHugger Robot
fff2d76ccb Merge "Update notification display buckets." into rvc-dev 2020-03-06 15:33:50 +00:00
Stanislav Zholnin
59199131cf Add boot session stable sampling to AppFeaturesOps puller.
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
2020-03-06 14:23:54 +00:00
Muhammad Qureshi
d7944d6573 Merge "Remove libstatslog from libstatsmetadata" into rvc-dev 2020-03-06 08:04:46 +00:00
Muhammad Qureshi
513453c253 Merge "Support multiple module annotations per atom" into rvc-dev 2020-03-06 08:04:09 +00:00
Muhammad Qureshi
9e0f728fe4 Remove libstatslog from libstatsmetadata
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
2020-03-05 17:20:58 -08:00
Tej Singh
72a70a8a3c Address Puller API Feedback
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
2020-03-05 16:43:02 -08:00
TreeHugger Robot
f8222617c7 Merge "Remove libstatssocket from statsd_test" into rvc-dev 2020-03-06 00:21:10 +00:00
TreeHugger Robot
ec6198e99d Merge "Add an option to zip incident report" into rvc-dev 2020-03-05 22:59:49 +00:00
Muhammad Qureshi
f8460f70d0 Support multiple module annotations per atom
Bug: 150864291
Test: m stats-log-api-gen-test &&
out/host/linux-x86/nativetest/stats-log-api-gen-test/stats-log-api-gen-test

Change-Id: Ibf8869078c6f1eae13e687f0196d6ed91ec35c64
2020-03-05 14:52:05 -08:00
Tej Singh
b3915ea363 Remove libstatssocket from statsd_test
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
2020-03-05 14:37:25 -08:00
Mike Ma
b6f7c47252 Add an option to zip incident report
Incident reports are getting bigger as we add more sections. Add an
option (-z, default off) to zip incident report.

Bug: 150160547
Test: atest incidentd_test
Test: adb shell incident -z -p EXPLICIT | gunzip | ./out/soong/host/linux-x86/bin/aprotoc --decode=android.os.IncidentProto --proto_path=./ --proto_path=external/protobuf/src frameworks/base/core/proto/android/os/incident.proto
Change-Id: I7c8ff1d91df842c200462ee29f15feae68e62739
2020-03-05 12:42:50 -08:00
Boleyn Su
1c8ed242b5 Fix a race conditon in incident.
`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
2020-03-04 23:03:40 -08:00
Will Brockman
e375384472 Update notification display buckets.
Staying in sync with NotificationSectionsManager.PriorityBucket.

Bug: 146488473
Test: statsd_testdrive 245
Change-Id: I161062593c75b34d7f2260fc6a7301c73b2f8a8d
2020-03-03 16:29:34 -05:00