Commit Graph

5484 Commits

Author SHA1 Message Date
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
Greg Kaiser
642a7d1746 incident_helper: Fix incorrect deletion
We match our deletion of memory with how it was allocated.

Test: TreeHugger
Bug: 150145113
Change-Id: I765e726cd6dbde550fb22f643140f1faba217dfb
2020-03-02 20:49:08 +00:00
Ruchir Rastogi
06d2fe8d83 Merge "Fix LogEventQueue_tests" into rvc-dev 2020-02-28 18:20:07 +00:00
Will Brockman
8e41d8ce3c Merge "Statsd: modules for notifications atoms." into rvc-dev 2020-02-28 14:26:59 +00:00
TreeHugger Robot
36a845dee4 Merge "Make libstatssocket shared" into rvc-dev 2020-02-28 08:56:00 +00:00
TreeHugger Robot
169a29772c Merge "Create standby bucket changed atom." into rvc-dev 2020-02-28 02:40:46 +00:00
Ruchir Rastogi
2250fa1593 Fix LogEventQueue_tests
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
2020-02-27 17:00:52 -08:00
TreeHugger Robot
9f9ca14bb5 Merge "Use new socket schema within TestSlicedCondition" into rvc-dev 2020-02-27 22:55:25 +00:00
Kweku Adams
1275213242 Create standby bucket changed atom.
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
2020-02-27 13:33:56 -08:00
Will Brockman
7fb7944c4d Statsd: modules for notifications atoms.
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
2020-02-27 16:26:37 -05:00
Alec Mouri
28a0b857f4 Merge "Add atom for a janky event reported by SurfaceFlinger." into rvc-dev 2020-02-27 19:47:44 +00:00
Tej Singh
eb7d8f4675 Make libstatssocket shared
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
2020-02-27 11:38:41 -08:00
Winson Chiu
b0c5105b2d Merge changes from topic "actor-signature-policy-rvc-dev" into rvc-dev
* changes:
  Actor signature overlayable policy
  Refactor overlayable policy
2020-02-27 18:27:53 +00:00
Mike Ma
755ce9edf9 Merge "Handle EOF explicitly in incident_helper" into rvc-dev 2020-02-27 17:33:54 +00:00
Ruchir Rastogi
dfd63d4522 Use new socket schema within TestSlicedCondition
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)
2020-02-27 17:33:53 +00:00
TreeHugger Robot
13ecf63ba4 Merge "Add API constraints to ScheduledJobStateChanged atom" into rvc-dev 2020-02-27 02:57:01 +00:00
Winson
f56ade365a Actor signature overlayable policy
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
2020-02-26 15:59:44 -08:00
Winson
62ac8b56a9 Refactor overlayable policy
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
2020-02-26 15:59:43 -08:00
Mike Ma
266bec303c Handle EOF explicitly in incident_helper
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
2020-02-26 12:39:57 -08:00
Ryan Mitchell
625ebd3911 Call verify in create-multiple
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
2020-02-26 00:53:13 +00:00
Alec Mouri
5ac32622bb Add atom for a janky event reported by SurfaceFlinger.
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
2020-02-25 12:55:20 -08:00
TreeHugger Robot
5a098f7775 Merge "Camera: Rename CameraActionEvent duration" into rvc-dev 2020-02-25 20:47:47 +00:00
TreeHugger Robot
10398d29f3 Merge "Atom for when fgs accesses appop" into rvc-dev 2020-02-25 19:59:16 +00:00
Adam Bookatz
38767932a2 Atom for when fgs accesses appop
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)
2020-02-25 17:09:48 +00:00
Garfield Tan
cf11791876 Populate uniq field in uhid.
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
2020-02-25 01:40:06 +00:00
Emilian Peev
6ea6fe99ba Camera: Rename CameraActionEvent duration
Rename "duration" field to correspond with the
actual time unit.

Bug: 139439353
Test: Successful build
Change-Id: I3e9b3ac5778d6fa4b6de35079743bdf6e85b7560
2020-02-24 15:31:34 -08:00
Suprabh Shukla
1b5778d119 Add API constraints to ScheduledJobStateChanged atom
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
2020-02-24 19:09:46 +00:00
Stanislav Zholnin
7dcc51dc79 Add atom and puller for AppOps with FeatureIds
Bug: 136134050
Test: make statsd_testdrive && ./out/host/linux-x86/bin/statsd_testdrive 10074

Change-Id: Ic1d84b2f91e9b6857dda717ab21208d9f331be2f
2020-02-24 15:30:00 +00:00