Commit Graph

5458 Commits

Author SHA1 Message Date
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
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
Mike Ma
5510f7c8cd Add text dumpsys section to incidentd
Enable Incidentd to dump any existing dumpsys section in plain text
(as dumpsys.proto), only in eng or userdebug build. This is for a
few dumpsys services that are prohibitively expensive to migrate to
protobuf dumpsys or will undergo a major rewrite (thus render the
previously defined proto completely useless).

Bug: 149816498
Bug: 146085372
Bug: 146086519
Test: $ incident -p EXPLICIT 4000 4001
Change-Id: I0693d9bace0055cfeb63d7c8d48995d57dc0b733
(cherry picked from commit 95ba73f9c9)
2020-02-23 08:05:42 +00:00
Blake Kragten
e4383d8999 Merge "GnssMetrics" 2020-02-21 22:15:29 +00:00
TreeHugger Robot
d1890075d1 Merge "Make findTrainInfoFileNameLocked return a string instead of a char*." 2020-02-21 00:13:57 +00:00
Makoto Onuki
92cef6c8e7 Merge "Temporarily fix for the "telecom" command" 2020-02-20 23:24:39 +00:00
Jonathan Nguyen
d8c00da9d9 Make findTrainInfoFileNameLocked return a string instead of a char*.
Test: atest GtsStatsdHostTestCases on hwasan
Change-Id: I51a3a7101588001ccb5479ae599a6b52d3a56566
2020-02-20 14:30:33 -08:00
Makoto Onuki
5577300386 Temporarily fix for the "telecom" command
Bug: 148897549
Test: m telecom && adb sync && adb shell telecom set-sim-count 0
Change-Id: I0951aa78dd3a4cc45d0a849baf9bcac1b31ef339
2020-02-20 10:12:50 -08:00
Howard Ro
7008dbe5e4 Merge "Revert^2 "Migrate Statsd to the apex"" 2020-02-20 08:00:53 +00:00
Howard Ro
adc510fd78 Revert^2 "Migrate Statsd to the apex"
24bfb40916

Change-Id: I4bda9b6eb759c32b9167ad9d58bdd3d10ff29411
2020-02-20 04:57:00 +00:00
Howard Ro
00306fce6a Merge "Revert "Migrate Statsd to the apex"" 2020-02-20 04:22:02 +00:00
Howard Ro
24bfb40916 Revert "Migrate Statsd to the apex"
Revert "Update statsd binary path for apex"

Revert submission 10356003-statsd_apex

Reason for revert: https://android-build.googleplex.com/builds/quarterdeck?branch=git_master&target=build_test&lkgb=6221366&fkbb=6221428
Reverted Changes:
Ic84e77269:Update init.rc for statsd setup
I6f3fab4b4:Update statsd binary path for apex
Ib4ea98aed:Migrate Statsd to the apex

Change-Id: I089d5b9bbbdc363e27e79e4addd4eec1e4339c48
2020-02-20 04:19:41 +00:00
TreeHugger Robot
5a9b426ef3 Merge "Added ability to set bus used for hid device tests" 2020-02-20 03:11:47 +00:00
TreeHugger Robot
d71f157eb6 Merge "Add libstatspull and libstatssocket to the apex" 2020-02-20 02:35:47 +00:00
Howard Ro
ff5581d498 Merge "Migrate Statsd to the apex" 2020-02-20 01:53:20 +00:00
Alessio Balsini
80c3c1579a Merge "Extend atoms with Virtual A/B merge metrics" 2020-02-20 01:12:04 +00:00
Blake Kragten
6ce382a372 GnssMetrics
These metrics will pull different metrics that tell the performance of the gnss subsystem.

Metrics include:
Location reports
% of location failure
Num times GPS had to first fix
Mean time to first fix on signal
Num position accuracy logs
Mean position accuracy in meters
Num top 4 Cn0 messages
Mean top 4 average Cn0 (signal quality)
Num L5 top 4 Cn0 messages
Mean L5 top 4 average Cn0 (signal quality)
Num Satellite status messages received
Num of Satellites used in fix
L5 Satellite status messages received
L5 of Satellites used in fix

metric_id: 1111
gauge_metrics {
  data {
    bucket_info {
      atom {
        gnss_stats {
          location_reports: 12
          location_failure_reports: 3
          time_to_first_fix_reports: 2
          time_to_first_fix_milli_s: 43588
          position_accuracy_reports: 9
          position_accuracy_meters: 112
          top_four_average_cn0_reports: 31
          top_four_average_cn0_db_mhz: 734711
          l5_top_four_average_cn0_reports: 1
          l5_top_four_average_cn0_db_mhz: 21500
          sv_status_reports: 1015
          sv_status_reports_used_in_fix: 100
          l5_sv_status_reports: 7
          l5_sv_status_reports_used_in_fix: 0
        }
      }
      elapsed_timestamp_nanos: 537249375445
      start_bucket_elapsed_millis: 522186
      end_bucket_elapsed_millis: 549283
    }
  }
}
time_base_elapsed_nano_seconds: 9283624934
bucket_size_nano_seconds: 60000000000
is_active: true

Bug: 147910698
Test: On Device using test script and gnsslogger.apk
>  make statsd_testdrive
>  ./out/host/linux-x86/bin/statsd_testdrive <ATOM_ID>

Change-Id: I92461eb8533ec810bb67d76a25931295cfa1efbd
2020-02-19 17:07:11 -08:00
Farid Chahla
bf881360f0 Added ability to set bus used for hid device tests
When testing HID devices, it was assumed that the bus used would always
be bluetooth. This caused USB hid tests to fail. This patch fixes this
issue by adding a "busType" parameter to the test register file. This
can be either "bluetooth" or "usb" at this time. This will break any
hid test that does not specify a busType.

Cherry picked from pa/1549664.

Bug: 136263708
Test: atest CtsHarwareTestCases

Change-Id: I44cda52505110227fa5262994d0cfe59ecb8763d
2020-02-19 17:00:05 -08:00
Muhammad Qureshi
7b31ff81c5 Add libstatspull and libstatssocket to the apex
Also make libstatssocket dependency static in statsd_test temporarily to use
AStatsEvent_getBuffer in tests.

Bug: 145922701
Bug: 145923416
Test: m

Change-Id: Idb8107cfe4f7d08d08c7a242c037fcc63912bb5f
2020-02-19 14:49:43 -08:00
Jeffrey Huang
89e09b58d6 Migrate Statsd to the apex
Bug: 145923087
Test: m -j
Change-Id: Ib4ea98aedef629dd9a2a8764cfd91284a38ba596
2020-02-19 14:13:13 -08:00
TreeHugger Robot
2ae81c3c0f Merge "Update GraphicsStats proto definition" 2020-02-19 14:23:20 +00:00
TreeHugger Robot
a73ae8bbc4 Merge "Comment out Statsd tests" 2020-02-19 04:57:51 +00:00
Ryan Mitchell
f2392c6f56 Merge changes from topic "rro_config"
* changes:
  Make overlay config work with immutable non-android overlays
  Add xml configuration of RROs
  Extract system partitions into standalone class
2020-02-19 04:37:26 +00:00
Jeffrey Huang
1e4368aa43 Comment out Statsd tests
Added todos to make them ues the new schema.

Bug: 145923087
Test: m -j && bit statsd_test:*
Change-Id: I0749760eb3123407b78b9ace9a93967bac727bf5
2020-02-18 18:36:02 -08:00
Ryan Mitchell
9b93942a80 Add xml configuration of RROs
This change adds the ability to configure the priority, default enable
state, and mutability (previously know as staticness) of an overlay.
Rather than overlays configuring themselves, the system can configure
overlays relative to each other.

An example configuration file looks like:
<config>
    <merge path="auto-generated.xml" />
    <overlay package="com.example.one" mutable="false"
             enabled="true"/>
    <overlay package="com.example.two" mutable="false"
             enabled="true"/>
    <overlay package="com.example.three" enabled="true"/>
</config>

The <overlay> tag configures the overlay while the <merge> tag allows
additional configuration files to be included at a position within
the configuration file.

If the configuration file is not present for a partition, the legacy
android:isStatic and android:priority will continue to configure the
overlays in the partition. Once at least one configuration file has
been defined in any partition, strict partition precedence will be
enforced and overlays on separate partitions will no longer be able
to use android:priority to reorder themselves conversely from the
overlay partition precedence.

The order of the system partitions from least to greatest precedence
is system, vendor, odm, oem, product, system_ext.

Bug: 135048762
Test: atest OverlayConfigTest
Change-Id: If57e8caa9b881f9d424ef48bba80b18cc8b7b943
2020-02-18 16:13:22 -08:00
Jeffrey Huang
52e90024d3 Allow libstatsmetadata to be linked by statsd
Bug: 145923087
Test: m -j
Change-Id: I8ad5453be7aaefd8be9a20539f35de06209060e3
2020-02-18 14:57:20 -08:00
Oscar Shu
2f156b0da2 Merge "Bucket channel frequency on device" 2020-02-18 18:08:17 +00:00
Alessio Balsini
628fb8d900 Extend atoms with Virtual A/B merge metrics
With the Virtual A/B feature, when the device successfully boots after
an OTA update, a dm-snapshot merge operation is performed, which
consolidates the updated images to the base devices.
This merge operation depends on the OTA size and may affect the device
performance until completed.
The new virtual_ab_update_reported push metric tracks the merge
operation duration (if not interrupted), the final merge status and
possible number of reboots that occurred during the merge.

Bug: 138817833
Bug: 148138124
Test: build + OTA application + local metric test with statsd_testdrive
Change-Id: Iabd1dc48ad0d737f6ed14caa247fd4952c65a258
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-18 15:19:43 +00:00