Commit Graph

5710 Commits

Author SHA1 Message Date
Muhammad Qureshi
a3461a2d4a Merge "Use ASSERT_EQ for size assertions." into rvc-dev 2020-05-13 02:08:11 +00:00
Muhammad Qureshi
dff78d6240 Use ASSERT_EQ for size assertions.
This fixes tests halting when accessing invalid indices.

Fixes: 156373877
Test: statsd_test
Change-Id: Ia2a9d7c71228e84467607e1485dbec33e8e6a094
2020-05-12 09:56:37 -07:00
Ruchir Rastogi
18fb866de9 Merge "Use default LogEvent copy constructor" into rvc-dev 2020-05-12 16:42:28 +00:00
Robert Lee
80dcec801d Merge "Add new atom for AudioPowerUsage" into rvc-dev 2020-05-12 08:09:37 +00:00
TreeHugger Robot
8683e2eeba Merge "Log inotify errors." into rvc-dev 2020-05-12 04:44:43 +00:00
Ruchir Rastogi
31739e5f71 Use default LogEvent copy constructor
This prevents subtle bugs from being introduced when more member
variables, such as annotations, are added to LogEvent.

Test: m statsd
Test: atest statsd_test
Test: atest GtsStatsdHostTestCases
Bug: 156312371
Change-Id: Ibb5366e8658d6c99e5730b4bc301190655bbd245
2020-05-11 19:46:58 -07:00
Robert Lee
cccdc155f5 Add new atom for AudioPowerUsage
Test: builds
Bug: 121318157
Bug: 152714440

Change-Id: Ic35db236a0d5c39e62f1a4d750c8d3fd683c3906
2020-05-12 09:30:09 +08:00
Dan Sandler
562d46d592 Log inotify errors.
Bug: 155954661
Test: boot
Change-Id: Ic054ecf6acebba12485926b66d4fb96fa7712547
2020-05-11 17:09:22 -04:00
Changyeon Jo
51ae358b87 Add new atom for EVS usage statistics
This change adds EvsUsageStatsReported that contains various usage
statistics collected by EVS service.

Bug: 153236752
Test: $ANDROID_HOST_OUT/bin/statsd_testdrive 274 after allowing
      AID_AUTOMOTIVE_EVS to log
Change-Id: I99fe24d7679678e8bb3fa779f299f253a9e703f0
2020-05-11 09:03:36 -07:00
Nate Myren
e8f912bbb5 Add new atoms for auto revoke
Added new atoms for auto revoke logging

Test: manual
Bug: 154650244
Change-Id: Ifdc291c24f249b275b435495fcd3c73db089adbc
2020-05-11 09:47:28 +08:00
Jonathan Nguyen
8d8ff53c41 Add App Usage atom to atoms.proto
Test: m -j
Bug: 156041159
Change-Id: Ie0fd99df5b1d8776b6e3c29f7fb2da4759bb465d
Merged-In: Ie0fd99df5b1d8776b6e3c29f7fb2da4759bb465d
(cherry picked from commit ee7dd8f2b2)
2020-05-08 10:44:20 -07:00
Ruchir Rastogi
ca7fc3be0f Merge "Fix ShellSubscriber concurrency issues" into rvc-dev 2020-05-07 23:22:56 +00:00
Hyunyoung Song
a07377d529 Merge "Setup default annotation to reduce byte size for launcher related atoms" into rvc-dev 2020-05-07 09:02:43 +00:00
Ruchir Rastogi
1e24051604 Fix ShellSubscriber concurrency issues
This CL creates a sendHeartbeat thread that ocassionally sends
heartbeats, consisting of a dataSize of 0, to perfd. perfd will discard
those heartbeats, recheck if the user has canceled the subscription, and
if not, wait for more data from statsd. Sending heartbeats solves two
big problems:

(1) Allows statsd to robustly check if writes to the socket fail because
the read end of the pipe has closed. Previously, if no atoms were pushed
or pulled, statsd never attempted to write to perfd, so statsd could
never detect the end of the subscription. However, now, writes are
regularly made regardless of if statsd receives data. Note that even if
atoms were pushed or pulled, there is no guarantee that they would have
matched the atom matchers sent in perfd's config.

(2) Allows perfd to escape a blocking read call and recheck whether the
user has canceled the subscription. If no data is sent to perfd, perfd
will block in this read call and the AndroidStudio UI will freeze up.

Heartbeats are only sent if statsd has not sent any data to perfd within
the last second, so we do not spam perfd with writes.

+ decomposes the startNewSubscription function
+ prevents startPull from holding the lock while sleeping

Test: atest stastd_test
Test: atest CtsStatsdHostTestCases
Test: manually confirm that AndroidStudio is not freezing
Bug: 153595161

Change-Id: I78f0818e8ed29bdadd02c151444ee7c9555623a4
2020-05-06 19:52:16 -07:00
Tej Singh
6dfbdb3e2f Merge "Fix statsd NPE on setPullAtomCallback" into rvc-dev 2020-05-06 22:11:02 +00:00
Ruchir Rastogi
76994e73a7 Merge "Handle race conditions in SCS when statsd dies" into rvc-dev 2020-05-06 22:10:42 +00:00
Tej Singh
c9dad09ad3 Merge "Improve statsdstats logging for pulled atoms" into rvc-dev 2020-05-06 22:09:26 +00:00
Ruchir Rastogi
e92edbaffc Handle race conditions in SCS when statsd dies
This CL aims to fix two race conditions:

1. When statsd restarts after a crash, the ordering of sayHiToStatsd and
binderDied is not guaranteed. However, previously, we assumed that
binderDied would get called first and reset sStatsd to null. To solve,
we don't assume a function ordering and don't throw an error message in
sayHiToStatsd if sStatsd is not null.

2. When statsd was linked to death, the death recipient was not informed
about all broadcast receivers. Thus, the death recipient might have
known only a partial list of receivers when #binderDied was triggered. To
solve, we make sure that the death recipient knows about all receivers
before we link to death.

Test: atest statsd_test
Test: atest CtsStatsdHostTestCases
Bug: 154275510

Change-Id: I11be65ca2135cde200ab8ecb611a363d8f7c2eb6
2020-05-06 11:06:55 -07:00
Hyunyoung Song
e742ae7f37 Setup default annotation to reduce byte size for launcher related atoms
Bug: 137777105
Bug: 144953948

- Add one more field (cardinality) to Launcher related atoms
- Change the name of two existing fields (span_x, span_y)

Test: builds, locally tested against launcher logging

Change-Id: I243711023c1ed981126b50575cdfbf51490a2c57
Signed-off-by: Hyunyoung Song <hyunyoungs@google.com>
2020-05-06 00:04:37 -07:00
Tej Singh
873e91a117 Improve statsdstats logging for pulled atoms
1. remove old statscompanion counters
2. add outgoing binder call fail counts
3. Add additional pull failure cases
 a. No pull uid provider (If a config doesn't register properly)
 b. Puller not found - either because it was not registered or because
the client did not specify the correct uids
4. Make metrics own logging pull delays - these were getting overcounted
since both the PullerManager and ValueMetricProducer were logging pull
delays.
5. Move noteEmptyPull to StatsPuller for more uniform logging, instead
of it just being logged in value metric producer.

Test: m statsd
Bug: 154056912
Change-Id: Ia373003905ee44d3b7b37b2bfa1e1d6268250070
2020-05-05 19:03:52 -07:00
Tej Singh
baed5257ad Fix statsd NPE on setPullAtomCallback
Suspected root cause: if a process crashes right after calling
setPullAtomCallback, it's possible that oneway binder calls can queue
but do not execute before the process crashes. Then, when the process
crashes, nothing has a strong reference to the IPullAtomCallback, so
it gets deallocated. Then, when the oneway call actually executes, the
callback is null. This is being followed up in b/155793159

Regardless, statsd should handle null input properly.

Test: GTS test in ag/11348719 now passes
Test: atest GtsStatsdHostTestCases
Bug: 153822941
Change-Id: Ic6d415e10eca8d133290de80cb61e1634590ca6a
2020-05-05 14:51:57 -07:00
Chi Zhang
a8added053 Merge "Add dimension to VOICE_CALL_SESSION atom." into rvc-dev 2020-05-05 18:56:57 +00:00
Will Brockman
4a0fe52131 Merge "Statsd testdrive: remove debug line." into rvc-dev 2020-05-05 15:28:25 +00:00
Junyu Lai
73d7775f76 Merge "[SM17] Remove ratType field in MobileBytesTransfer(ByFgBg)" into rvc-dev 2020-05-05 03:06:49 +00:00
Jing Ji
060d68630d Support to pull aggregated procstats associations
Bug: 145203981
Test: b/152397079#comment12
Test: atest CtsStatsdHostTestCases
Change-Id: If5b9723a41a9d2eefc2cb132b3a3bf16f57872e9
2020-05-04 14:33:06 -07:00
Chi Zhang
8bf81dffa9 Add dimension to VOICE_CALL_SESSION atom.
Bug: 142026991
Bug: 141631489

Test: build
Change-Id: I320611ee871c7feae53e3e67fcdf8cbab0be241b
2020-05-03 20:17:34 -07:00
Suren Baghdasaryan
aeae048088 Replace direct pid writes with setting task profiles
For easy transition from SchedTune to UtilClamp, direct access to these
cgroups should be abstracted by using task profiles. Replace writepid
commands with new task_profiles command.

Bug: 155419956
Test: change .rc file and confirm task profile is applied
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I05f5a082c7e6f43ab94330aede29967e91d1aef9
Merged-In: I05f5a082c7e6f43ab94330aede29967e91d1aef9
2020-05-03 08:12:10 +00:00
Songchun Fan
ec60726cb4 Merge changes from topics "v2_metrics_add_size", "v2_metrics_optional_package_name" into rvc-dev
* changes:
  [pm/metrics] add apk size in the log
  [pm/metrics] do not log package name for adb installations
2020-05-01 22:27:59 +00:00
Will Brockman
7fb4030829 Statsd testdrive: remove debug line.
Oops, left the old output in the submitted CL that changed to a new
output approach.

Bug: 149914234
Test: atest --host frameworks/base/cmds/statsd/tools/localtools/test/com/android/statsd/shelltools/testdrive/*.java
Test: statsd_testdrive 90 > /tmp/testdrive
Change-Id: Ib9542e478a57ad56d9fe2a0e97cb18a05d5d2535
2020-05-01 16:37:36 -04:00
Songchun Fan
aff0dce172 [pm/metrics] add apk size in the log
Sum up all apk sizes in the code path and record in the log.

Test: atest android.content.pm.cts.PackageManagerShellCommandTest#testSplitsInstallStdIn
Test: out/host/linux-x86/bin/statsd_testdrive 263
event_metrics {
  data {
    elapsed_timestamp_nanos: 1543983836620
    atom {
      package_installer_v2_reported {
        is_incremental: true
        package_name: ""
        duration_millis: 327
        return_code: 1
        size: 2512345
      }
    }
  }
}
BUG: 152913040
Change-Id: Idde0adb6b639163627c092ed248631edfba2e952

Change-Id: I0eaf226513ee5a1b5f73726f4480c6ee73210b0d
2020-04-30 09:57:36 -07:00
Diksha Gohlyan
b96b2f486a Add logs for drag and drop in documentsui
Test: not tested
Bug: 155134389

Change-Id: Iab4dc6973284de5bbad4c79e0641d7316f74e6ec
2020-04-30 09:20:48 -07:00
Jason Hsu
04ffadbc86 Merge "Change AccessibilityServiceReported atoms to log from settings module." into rvc-dev 2020-04-30 12:21:16 +00:00
junyulai
592c605596 [SM17] Remove ratType field in MobileBytesTransfer(ByFgBg)
Currently, ratType field has been added into
MobileBytesTransfer(ByFgBg) atoms. However, add such dimension
is not backward compatible since callers might expect a complete
NetworkStats for specific uid in the metrics, but actually
the NetworkStats were distributed into metrics with
different ratType.

This change provide minimum modification that reverts the
behavior of MobileBytesTransfer, but related APIs will be needed
in subsequent changes.

Test: adb shell cmd stats pull-source 10000~10003
Test: atest android.cts.statsd.atom.UidAtomTests#testMobileBytesTransfer
Test: atest android.cts.statsd.atom.UidAtomTests#testMobileBytesTransferByFgBg
Bug: 129082217
Change-Id: I591f9fff2322c343479eb8587f14e48f878080b4
2020-04-30 12:17:24 +08:00
TreeHugger Robot
a8ba45dd80 Merge "Add tests for mapIsolatedUidToHostUid methods" into rvc-dev 2020-04-29 19:14:26 +00:00
Muhammad Qureshi
b635b3a2eb Add tests for mapIsolatedUidToHostUid methods
- Remove unneeded dependency on atoms.proto
- Remove extractIntoVector function. Assert on actual output directly.
- Use a helper method for creating UidMap mock for all tests.
- Add AttributionChain variants of existing tests in puller_util_tests.
- Add tests in StatsLogProcessor_test to test mapIsolatedUidToHostUid()
    in StatsLogProcessor.

Bug: 154285085
Test: bit statsd_test:*

Change-Id: I6d0822be9f0fbca23bd2f441dc63b97110567307
2020-04-29 09:58:03 -07:00
Ruchir Rastogi
272cae6e10 Merge "Reduce memory footprint of LogEvent" into rvc-dev 2020-04-29 16:21:46 +00:00
Will Brockman
0f309dc04a Merge "Statsd TestDrive tool: Write output to stdout. Also: Option for less verbose output." into rvc-dev 2020-04-29 14:49:49 +00:00
jasonwshsu
7b1be3e68d Change AccessibilityServiceReported atoms to log from settings module.
* Lower cost to log from accessibility settings

Metrics council review bug: 153342192
Bug: 151285965
Test: build pass

Change-Id: Ia1b479ff5e7ece46da734212a747739b9de3ba90
2020-04-29 19:24:03 +08:00
Ryan Mitchell
84a84ac62a Merge "Reduce OMS start time" into rvc-dev 2020-04-28 23:44:03 +00:00
TreeHugger Robot
34b9c0614b Merge "Update NotificationSection enum." into rvc-dev 2020-04-28 20:22:52 +00:00
Ryan Mitchell
7d53f19089 Reduce OMS start time
This change attempts to reduce the amount of time initializing the
OMS. The change:
1) Reduces the amount of time between subsequent attempts to connect
   to the idmap2d service when it is not alive.
2) Caches package infos retrieved from getOverlayPackages
3) Caches the crc of the android package to preventing having to
   retrieve it for every overlay package targeting the framework

This chance reduced OMS start up time from ~500ms to ~100ms on a
Pixel 3. If the idmap2d service is running when system sever starts
then start up time will be around ~70ms.

Bug: 151481016
Test: adb shell stop && adb shell start && [capture trace]

Change-Id: I6137c385baf099413b62e98557419fffb9fd2d93
2020-04-28 18:07:00 +00:00
Will Brockman
35895da39b Statsd TestDrive tool: Write output to stdout.
Also: Option for less verbose output.

Bug: 149914234
Test: atest --host test/com/android/statsd/shelltools/testdrive/TestDriveTest.java
Test: out/host/linux-x86/bin/statsd_testdrive -terse -one 29 33 48 62 63 64 90 149 244 245 246 259 260
Change-Id: I4ed4cfdd85eb5382ce28846ed6ed81b4dd3f5334
2020-04-28 11:19:16 -04:00
TreeHugger Robot
4502a6b12b Merge "Extend & refactor Statsd TestDrive tool." into rvc-dev 2020-04-28 06:45:05 +00:00
Ruchir Rastogi
1e8c57f3c9 Reduce memory footprint of LogEvent
This reduces the memory footprint by 16 bytes per LogEvent.

Test: atest statsd_test
Test: atest CtsStatsdHostTestCases
Bug: 154857643
Change-Id: I1e541816377ae8b14d789dc4d1f0a4ec91eef998
2020-04-27 17:45:44 -07:00
Will Brockman
cec88edd03 Update NotificationSection enum.
The enum NotificationSection, used in the NotificationPanelReported atom
(245), needs to be updated to reflect the current
NotificationsSectionManager.PriorityBucket possibilities.

Bug: 155004478
Test: make statsd_testdrive && $ANDROID_HOST_OUT/bin/statsd_testdrive 245
Change-Id: I4194a1e304f4498fa0ddbb2c385296864eb19cfc
2020-04-27 13:19:08 -04:00
Christine Tsai
eea03ac1be Merge "Annotate state atoms" into rvc-dev 2020-04-24 20:43:27 +00:00
tsaichristine
961d2fd258 Annotate state atoms
Finish annotating state atoms with exclusive state, primary fields, and
default/trigger reset states. These annotations are based off of
ag/4639668.

Some "StateChanged" atoms require more research before annotating them
as state atoms. This includes new atoms that have been added after
ag/4639668 and are potential state atoms.

Test: bit statsd_test:*
Bug: 145838040
Change-Id: I7b43c50d61d93c96b16d69e2fdc3683031f2e22c
2020-04-23 17:34:11 -07:00
Muhammad Qureshi
59602e5342 Merge "Add LogEvent::hasAttributionChain()" into rvc-dev 2020-04-23 21:12:56 +00:00
Will Brockman
b071228808 Extend & refactor Statsd TestDrive tool.
Now allows capturing multiple events under the same event metric.
Added unit tests for configuration generation and command-line
interpretation.  Refactored configuration into an inner class and
added functionality using TDD.

Also updated TestDrive & LocalDrive tools to check ANDROID_SERIAL as well as
the -s parameter when multiple devices are connected, and improved error messages.

Bug: 149914234
Test: atest --host test/com/android/statsd/shelltools/testdrive/*.java
Test: out/host/linux-x86/bin/statsd_testdrive -s <SERIAL> 90
Test: out/host/linux-x86/bin/statsd_localdrive -s <SERIAL> get-data 90
Change-Id: I4e756c2b132a22d66ccaf7b3346fe4fbf1f6f1fb
2020-04-23 13:49:04 -04:00
Chi Zhang
ac3231c45d Merge "Update comments for telephony atoms." into rvc-dev 2020-04-23 16:54:58 +00:00