1127 Commits

Author SHA1 Message Date
TreeHugger Robot
a034692c81 Merge "StatsService allows uids to impersonate themselves" 2018-12-19 21:20:57 +00:00
Bookatz
c71d901dde Statsd dumpsys handles multiple and saved configs
Statsd dumpsys wasn't handling multiple configs properly. Also, doing a
dump would delete the data that had been saved to disk. This cl fixes
both those issues.

Test: run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.atom.HostAtomTests#testDumpsysStats
Change-Id: I5f2f86c70fbcbc1407aae1b1ffeb7fbdb9f67d0e
2018-12-19 12:35:52 -08:00
Ben Murdoch
01720b82cf Fix some AppCompacted proto nits post google3 review.
Clarify some comments and tweak the names of some fields. Binary
structure of the proto remains intact.

Bug: 119988524
Bug: 120600464

Test: verified that statsd_testdrive still works with this atom
Change-Id: I90d8eb522fc23b2ff604bc1e69e4068dc2c4b73a
2018-12-19 18:03:44 +00:00
TreeHugger Robot
7a17e757fb Merge "Fix statsd_test TestOnDumpReportEraseData" 2018-12-18 22:59:45 +00:00
Bookatz
d238657d69 StatsService allows uids to impersonate themselves
Previously, most StatsService calls only allow the caller to specify the
uid if it is Userdebug/EngBuild. This applied even if the caller was
just specifying its own UID; this cl allows such a case. It also allows
ROOT to impersonate SHELL.

Test: Manual testing on userdebug and userbuild devices.
Test: make statsd_test && adb sync data && adb shell data/nativetest64/statsd_test/statsd_test

Change-Id: I2685d13a8dc24d40b5dab8be9842f53be6888ba3
2018-12-18 14:51:08 -08:00
Ben Murdoch
9507158846 Merge "App Compaction: Add westworld atom & statsd logging." 2018-12-18 22:34:22 +00:00
Bookatz
ea20bffedc Fix statsd_test TestOnDumpReportEraseData
After erasing the statsd data, allow statsd to have an empty report, or
even a report with a non-empty metrics wrapper, as long as it doesn't
have any of the former count metrics in it.

Bug: 77909781
Test: make -j8 statsd_test && adb sync data && adb shell data/nativetest64/statsd_test/statsd_test
Change-Id: I525c61aea97a185df8916e4c1b4c4118493ed780
2018-12-18 10:07:56 -08:00
Howard Ro
e51dab22aa Merge "Fix is_active that is logged as int64 to bool" 2018-12-18 18:01:10 +00:00
TreeHugger Robot
7e83824033 Merge "LocalDrive fails fast on P devices" 2018-12-18 17:13:34 +00:00
Ben Murdoch
bab399f657 App Compaction: Add westworld atom & statsd logging.
Keep track of app compaction meta data in statsd for
logging to westworld.

Test: Enable compaction and verified metric collection with statsd_testdrive
Bug: 119988524
Bug: 120600464

Change-Id: If8477019499cc0745b48193e781478f03b399159
2018-12-18 12:53:35 +00:00
Bookatz
8d349f6f64 LocalDrive fails fast on P devices
Makes LocalDrive quit for devices running P or earlier; the
statsd of such devices lack the --keep_data flag and therefore will
fail anyway, so we may as well the user why and fail fast.

Test: Manual testing on userdebug and userbuild, P and Q
Change-Id: Ia26528383c9d35732ffd819ed2e2ac6f3bb41b34
2018-12-17 17:31:02 -08:00
Howard Ro
07e23ffa48 Fix is_active that is logged as int64 to bool
"Field type 3 is not supported when writing bool val." is being created
as we are trying to log is_active bit as int64.

Bug: 121035918
Test: statsd_test
Change-Id: I3d6ad610411a45caa5b3b99a5b936c6769be3502
2018-12-17 17:28:07 -08:00
TreeHugger Robot
8462bc6234 Merge "Statsd atoms: Add comment about Wifi" 2018-12-17 22:51:26 +00:00
Chih-Hung Hsieh
2491af24a8 Merge "Fix performance-for-range-copy warnings" am: bc29242288 am: 7adb73f332
am: 2296036a40

Change-Id: Ia99ea6c9633986e68340bc88983d06baa7a1c597
2018-12-17 14:31:14 -08:00
Chih-Hung Hsieh
2296036a40 Merge "Fix performance-for-range-copy warnings" am: bc29242288
am: 7adb73f332

Change-Id: I0ab1a28f5490f96bc8b08f073d364a01ff2f20df
2018-12-17 14:17:57 -08:00
Bookatz
a0a1f8a861 Statsd atoms: Add comment about Wifi
Add comment explaining caveats about the Wifi atoms.

Bug: 115639456
Test: It is just a comment.
Change-Id: I0882ccbe21c59439c4a6a61fb665bc0bf4695006
2018-12-17 12:33:12 -08:00
Adam Bookatz
67fb3ca965 Merge "Statsd atom: Wifi on (enabled) and running" 2018-12-17 20:25:29 +00:00
Chih-Hung Hsieh
a1b644e88c Fix performance-for-range-copy warnings
Bug: 30413223
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,performance*
Change-Id: Ie481e88025a7a1f3abde8ff63420d5ccd8577e52
2018-12-17 20:00:55 +00:00
Rafal Slawik
a13ea6fdc2 Merge "Invoke rss_hwm_reset binary" 2018-12-17 10:10:16 +00:00
Howard Ro
4e172cc512 Merge "Fix incorrect field ID for is_active in stats_log" 2018-12-17 06:24:29 +00:00
Howard Ro
9440e09687 Fix incorrect field ID for is_active in stats_log
field number 13 in stats_log.proto conflicts with a copy in google3/

Bug: 121035918
Test: stats_test
Change-Id: Iadc3a5c227bb361553ba2bee2534cc767d34d7a3
2018-12-16 19:15:21 -08:00
Yao Chen
d090104b51 Merge changes from topic "statsd-allow-bytes-type" am: 783ec04909
am: 393e1ba2e2

Change-Id: I2840072c4986cc0fb5ed4a79b0bfa7994bcc1448
2018-12-16 19:00:11 -08:00
Rafal Slawik
44b8814df6 Invoke rss_hwm_reset binary
Flip sys.rss_hwm_reset.on property to invoke the binary to reset RSS HWM
counters for all processes.

Test: m -j
Test: ProcessMemoryHighWaterMark pull
Bug: 119598534
Change-Id: I53d8c571b27ddee611193aa36fdbd3d4c88abebd
2018-12-16 10:45:35 +00:00
Yao Chen
2822b4f42f Skip writing message field in an atom if it's empty
Test: unit test added
Bug: 120635548
Change-Id: I825b1ce526944a20fe65705508ad180ece37492c
Merged-In: I825b1ce526944a20fe65705508ad180ece37492c
(cherry picked from commit 8e6f9983009eadf32d05ad65e38906d3985bc9ba)
2018-12-15 13:52:27 -08:00
Yao Chen
046b51295e Adding tests and move launcher.proto
Test: statsd_test
Bug: 120635548
Change-Id: I0655f70098d78f8f6dc9381921c4a687d2195bd4
Merged-In: I0655f70098d78f8f6dc9381921c4a687d2195bd4
(cherry picked from commit 8c4338614513f59e53c2d7a164a05d309a470e81)
2018-12-15 13:52:06 -08:00
Hyunyoung Song
cc651c118e Add launcher.proto to atoms.proto
Test: blank
Bug: 113043444
Bug: 120635548
Change-Id: I7e0e72cdf68dcf195188dbab8fe2567fcbd5964e
Merged-In: I7e0e72cdf68dcf195188dbab8fe2567fcbd5964e
(cherry picked from commit c6d6b77ddc805d6e8f70ed16f0c73177840791e7)
2018-12-15 13:51:39 -08:00
Yao Chen
8b71c74894 Allow atoms to log fields in bytes format.
There are an increasing number of requests to log data in complex format to statsd, while the data
is not expected to be parsed or aggregated by statsd and only to be uploaded as events.

Instead of making an exception for each of these cases in a hard coded way, this CL add a feature to
annotate these field in atoms.proto and the stats-log-api-gen tool will produce byte array
interfaces for them.

Note that log_msg does not have byte array type, and only has string type, when statsd receives the
log, these fields are in string type. Only when the atom is written to proto, we will check if this
field should be bytes field and write it to protobuf in message format.

Change-Id: If53dd95c5826710c76d7fe982bf951a435dfc738
Merged-In: If53dd95c5826710c76d7fe982bf951a435dfc738
Fix: 118386797
Bug: 120635548
Test: unit test & manual test
(cherry picked from commit bbdd67d19f4912fbec00220b22e44c68eff5ab3f)
2018-12-15 13:51:08 -08:00
TreeHugger Robot
09c161fedb Merge "Fix style error" 2018-12-15 01:31:16 +00:00
Badhri Jagan Sridharan
c2c54a228f Fix style error
Bug: 118783261
Test: Manually tested by running: adb shell cmd stats print-logs,
    adb logcat | grep statsd | grep \(77\)

Change-Id: I149006f9e625e609ffe3bbd713a2d30a2c69dafe
2018-12-14 14:41:26 -08:00
Bookatz
da1798c8de Statsd atom: Wifi on (enabled) and running
BatteryStats logs when Wifi is 'running' and 'on'.
It appears that 'on' is the Wifi on/off toggle, while 'running'
is Wifi actually working. Right now, only Client Mode is considered
running, which is probably wrong - Hotspot mode should probably be
included too.

'Running' is currently used by BatteryStats in its power blaming, so
statsd needs it too. Therefore it is added here, exactly as BatteryStats
uses it. In the future, this should be upgraded to be more accurate, but
that is beyond the scope of this cl.

Test: Manual only. Toggling 'Wifi On' via app is no longer allowed in Q.
Bug: 115639456
Change-Id: Icad7d1476bb6ff0788ffc690f0a27507d32cd4b8
2018-12-13 14:27:11 -08:00
TreeHugger Robot
ca72a20238 Merge "Allow statsd_testdrive to work in root" 2018-12-13 21:15:11 +00:00
Rafal Slawik
00b10effe8 Merge "Update documentation for memory atoms." 2018-12-13 20:31:32 +00:00
Bookatz
819ea835d7 Statsd logs directly from Wifi & add Multicast tag
Track the Wifi Multicast Lock tag.
Also moves some statsd Wifi logging calls out of BatteryStats in
preparation for more detailed statsd wifi logging.

Bug: 68943452
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.atom.UidAtomTests#testWifiMulticastLock
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.atom.UidAtomTests#testWifiScan
Change-Id: I13bd5f72393f6065bc3dfa1b72a1ca48a480a682
2018-12-13 12:18:41 -08:00
Bookatz
17fe8de6b3 Allow statsd_testdrive to work in root
LocalDrive needs to handle the situation whereby the caller does 'adb
root' in between calls, and therefore runs everything as shell.

TestDrive is a single-call, so it can just run as the caller. That's
what it used to do, but a recent refactoring made some of its calls via
shell, causes an error. This fixes that.

Test: manual confirmation that it worked for both shell and root
Change-Id: I5e31cdd59d61290a480cb6fae107170616daabc0
2018-12-13 11:13:24 -08:00
Rafal Slawik
da51b93a61 Update documentation for memory atoms.
Test: m -j
Change-Id: Iec6fbaa330be3abf12f839fdfcd74da0015934bc
2018-12-13 17:29:58 +00:00
Benjamin Schwartz
0126da8af1 Merge "statsd: Migrate statsd SubsystemSleepState to use power.stats HAL" 2018-12-13 17:09:37 +00:00
TreeHugger Robot
183bdcf1d3 Merge "statsd local tool" 2018-12-13 00:44:27 +00:00
Benjamin Schwartz
51329b72e6 statsd: Migrate statsd SubsystemSleepState to use power.stats HAL
statsd pulled event SubsystemSleepState will now use power.stats HAL if it
is available and supported. Otherwise it will fall back to the original
implementation of using the Power HAL.

Bug: 120551881
Test: adb shell cmd stats pull-source 10005
Test: Removed IPowerStats from manifest and ran above command. Verified
that it fell back to using IPower HAL
Test: Killed HAL services, waited for them to start back up, and
verified that statsd was still able to pull the SubsystemSleepState.
Change-Id: I852aa3386b2f2e77865ea6b4ff4cdc6e48cee77c
2018-12-12 15:29:53 -08:00
Bookatz
3e90658294 statsd local tool
Adds a tool for local usage of statsd. The tool can:
-upload a config from a file
-get the report data from statsd
Both the config and the report can be either in binary or human-readable
format, as specified.

Usage:
make statsd_localdrive
./out/host/linux-x86/bin/statsd_localdrive

Also, adds the ability to specify whether dump-report should also erase
the data when it returns it. A test for this is added.

Test: make -j8 statsd_test && adb sync data && adb shell data/nativetest64/statsd_test/statsd_test
Test: make statsd_localdrive && ./out/host/linux-x86/bin/statsd_localdrive <commands>
Bug: 77909781
Change-Id: I9a38964988e90c4158a555f41879534267aadd32
2018-12-12 11:42:39 -08:00
TreeHugger Robot
9943de9fb9 Merge "trim ValueMetric dimension key" 2018-12-11 18:03:49 +00:00
Badhri Jagan Sridharan
06353c6eb5 Merge "Log UsbDeviceAttached events for Audio devices" 2018-12-11 16:40:37 +00:00
Badhri Jagan Sridharan
5b0bc1f7f0 Merge changes from topic "118783261"
* changes:
  Log connection duration.
  Log UsbConnectorStateChanged events
2018-12-11 16:40:01 +00:00
Chenjie Yu
dbe5c50c15 trim ValueMetric dimension key
Bug: 120129929
Test: unit test
Change-Id: I26446f8eabbfbb20e1c715058d2e6b4bd5793a43
2018-12-10 18:35:30 -08:00
Badhri Jagan Sridharan
5ec629f020 Log UsbDeviceAttached events for Audio devices
UsbDeviceAttached is logged when the device has an audio interface.
Info such as VID, PID, whether the device has hid or mass storage
interface and the duration for which the usb device was connected
would be logged as well.

Bug: 118783261
Test: Manually tested by running: adb shell cmd stats print-logs,
    adb logcat | grep statsd | grep \(77\)
Change-Id: I57bbfd22ef377553daa113968fe53c4fe0f8e4d2
2018-12-10 17:37:27 -08:00
TreeHugger Robot
eb12479a07 Merge "Always report the metric id even if the metric has no data to upload." 2018-12-10 19:04:34 +00:00
Chenjie Yu
88d90e987b Merge "optional default base for ValueMetric" 2018-12-10 18:58:24 +00:00
Shawn Lin
029e4efc6b Merge "Migrate docsui tron metrics to westworld" 2018-12-10 08:10:54 +00:00
Yang Lu
b472291224 Always report the metric id even if the metric has no data to upload.
This is to normalize the metric when applying cross-device aggregation.

Test: statsd test
BUG: b/118203108

Change-Id: I644a6a4163e2d2ad8f70e0c4e002dd4f542248af
2018-12-07 22:18:45 +00:00
Fan Zhang
ff2332bc3a Fix lint errors for SettingsUIChanged atom event.
Bug: 119780708
Test: rebuild
Change-Id: I21d22734cb037e9702cab527a8bb827cc2ee241e
2018-12-06 15:18:58 -08:00
shawnlin
ea5b66be7b Migrate docsui tron metrics to westworld
add docsui atoms

Test: manual
Bug: 111552654
Change-Id: I232be950281423a38763b6be1b70f70090d4e61b
2018-12-06 15:15:19 +08:00