Commit Graph

5546 Commits

Author SHA1 Message Date
Maryam Karimzadehgan
4f9ab82c08 Proto changes and binary for adding more logs to the Back
Gesture. Design document:
go/logging-back-gesture.

Test: manual
Bug: 148104018
Change-Id: I63b745f30b7581306150d2d7ab1fe3cccfe5147f
2020-03-26 17:01:22 +00:00
Christine Tsai
0810d57f95 Merge "Update unit tests to use new socket schema" into rvc-dev 2020-03-26 16:42:44 +00:00
TreeHugger Robot
cfeb0d8323 Merge "Expand "extras" support in content tool." into rvc-dev 2020-03-26 06:29:59 +00:00
Jeff Sharkey
547bf5487d Expand "extras" support in content tool.
We recently added a new "Bundle extras" argument to insert(),
update(), delete(), and query(), so we should ensure that developers
working from the shell can populate these extras.

Uses binding logic that was already used for call() extras.  Fixes
parsing logic to support keys or values that have escaped colons,
and fix bug to always parse as requested data type.

Bug: 150982673
Test: adb shell content query
    --uri content://media/external/images/media/
    --extra android\\\\:query-arg-match-trashed:i:3
Change-Id: I40a9a94e85e175e298b01688d3b075a89b2e3954
2020-03-25 18:35:10 -06:00
tsaichristine
d5800b208e Update unit tests to use new socket schema
I forgot to update Gauge and EventMetricProducer unit test files to use
the new socket schema.

The EventMetric tests were also incomplete so I added test code to
output the dump report and check its contents.

Test: bit statsd_test:*
Bug: 149590301 && 110561136

Change-Id: I685688285d9890cf7c5bd3ffc43f13cbbb8f93de
2020-03-25 16:36:18 -07:00
Jeffrey Huang
1bd7fe106a Merge changes I7127dd7d,I84da0cd9 into rvc-dev
* changes:
  Add mAlertToAnomalyTrackerMap to MetricsManager
  Add StatsMetadataList proto
2020-03-25 22:31:02 +00:00
Raff Tsai
9a54e23d8e Merge "Add SettingSnapshot atom" into rvc-dev 2020-03-25 20:42:07 +00:00
Muhammad Qureshi
6fe5fd6e2e Merge changes Iad76baea,I3db5f4ff into rvc-dev
* changes:
  Run clang-format in stats_log_api_gen
  Add truncate_timestamp annotation
2020-03-25 17:38:05 +00:00
TreeHugger Robot
8910bf95c6 Merge "Fix ValueMetricProducer_test on hwasan" into rvc-dev 2020-03-25 17:32:55 +00:00
Raff Tsai
ea4db183fe Add SettingSnapshot atom
Bug: 142941011
Test: m Settings
Change-Id: I135a8ee1c0f8527d539c3613425e7e4c082ec099
2020-03-25 17:08:26 +08:00
Tej Singh
547f46331c Fix ValueMetricProducer_test on hwasan
TestUseZeroDefaultBaseWithPullFailures was failing on hwasan builds
because the test had a reference to an Interval object that was
deleted. The test tried to get another Interval object and assign it to
the reference. However, what this really did is change the Interval
object that the reference referred to. Since that Interval object had
been deleted, hwasan failed the test.

This fixes the issue. Also clean up some usages of auto to make
the test more readable.

Test: bit statsd_test:* on blueline_hwasan
Bug: 152354576
Change-Id: I392740770715391c727d190b1ed8ba22cc01210f
2020-03-25 08:10:35 +00:00
Jeffrey Huang
38d702697d Add mAlertToAnomalyTrackerMap to MetricsManager
Bug: 148280505
Test: bit statsd_test:*
Change-Id: I7127dd7dac9f6c4f3d415534c339aaba28fa41f3
2020-03-24 17:22:32 -07:00
Muhammad Qureshi
9b995809fb Add truncate_timestamp annotation
Mark privacy-sensitive atoms with truncate_timestamp annotation.

Factor out annotation collation to a helper method.

Add truncate_timestamp annotation support in stats-log-api-gen.

Add writeAnnotation* calls in Java and native generated code for
atom id annotations.

TODO: remove kTruncatingTimestampAtoms from atoms_info.
TODO: use truncate_timestamp annotation inside statsd.

Bug: 151111680
Test: stats-log-api-gen-test
Test: m statslog-framework-java-gen
Test: m libstatsmetadata

Change-Id: I3db5f4ffbf959bd36c62f890cc88606912798d40
2020-03-24 16:49:36 -07:00
tsaichristine
63143251fe Update the cc_benchmark to use the new socket schema
Also removed unused CreateEvent helper functions in metric_util.cpp

Test: bit statsd_benchmark:*
Bug: 149794614
Change-Id: I14bcc254c44773eb42f749305beadaaf23a19b2b
2020-03-24 16:03:48 -07:00
Christine Tsai
4aa7af0a8f Merge "(Part 3) Use new socket schema with statsd tests" into rvc-dev 2020-03-24 20:55:26 +00:00
Mike Ma
06b3aaee39 Merge "Optimize memory usage in incidentd" into rvc-dev 2020-03-24 20:27:41 +00:00
Jeffrey Huang
8a617e0024 Add StatsMetadataList proto
Bug: 148280505
Test: m -j
Change-Id: I84da0cd9c79dc1073c40a439fe2acff2e3fbc7ec
2020-03-24 12:46:14 -07:00
junyulai
f889330c89 [SM01] Add rat type fields in data usage atoms for mobile data
Test: build
Bug: 129082217
Change-Id: Idfc048d49f98acb805f49046a0b3dc871e001142
Merged-In: Idfc048d49f98acb805f49046a0b3dc871e001142
(cherry picked from commit 071a06635b)
2020-03-24 04:28:48 +00:00
Mike Ma
892ccd9bd5 Optimize memory usage in incidentd
EncodedBuffer is used a lot in incidentd. EncodedBuffer uses malloc
internally to acquire memory. Frequently creating and destroying
EncodedBuffer creates memory fragmentation, leading to high memory
usage after taking an incident report.
Also fixes a few other places with lots of malloc/free operations.

This change:
* Creates a pool of EncodedBuffer in incidentd. The saving is
significant. It reduces EncodedBuffer creation from 3 per section to
3 per report.
* Replaces malloc with mmap inside EncodedBuffer. mmap is guaranteed
to be mem page aligned, so there will be no mem fragmentation after
destroying EncodedBuffer.
* Replaces new with mmap inside TombstoneSection
* Forks a process to execute LogSection, because liblog malloc & free
significant amount of memory

Result:
PSS before taking a report: 1295 KB
PSS after taking a report: 1336 KB

Bug: 150311553
Test: heapprofd
Change-Id: I83bd9c969b751c80b2f42747020799bd85d8aae6
2020-03-23 18:46:58 -07:00
TreeHugger Robot
14f33ae83e Merge "Native API Council asked that we remove the C++ class from the public header." into rvc-dev 2020-03-24 01:35:40 +00:00
tsaichristine
a3d2ed8cb2 (Part 3) Use new socket schema with statsd tests
Update last set of statsd tests to use new socket schema

Test: bit statsd_test:*
Bug: 149590301
Change-Id: I0fe2c219ad75813db54ff0cfbad50f55e29cb626
2020-03-23 12:23:26 -07:00
Greg Kaiser
f0f1d83624 ShellSubscriber: Avoid rollover bug
We initialize 'mToken' instead of leaving it uninitialized, making
it much less likely to rollover.  In additional, we change our
check to inequality, to handle rollover if that were to happen.

There is the (theoretical) possibility of exactly 2^32 other
requests being claimed between our claim and our check.  It's
assumed that is essentially impossible and not a concern.

Test: TreeHugger
Bug: 150619687
Change-Id: Iee303e05082a6b3b31ed546bd62d3afe67c771d8
2020-03-23 16:09:57 +00:00
Joe Onorato
084aa3cb17 Native API Council asked that we remove the C++ class from the public header.
The API is simple enough, so just reimplement everything using the
C API directly.

Bug: 148940365
Test: treehugger
Change-Id: I0a75744e975e8d3c2a557e533eacd03200388ddc
2020-03-21 18:33:28 -07:00
TreeHugger Robot
e13e948d6d Merge "Change sint to int in atoms.proto" into rvc-dev 2020-03-21 07:56:17 +00:00
TreeHugger Robot
1e377304cb Merge "Statsd update for native puller api feedback" into rvc-dev 2020-03-21 03:15:06 +00:00
Howard Ro
8e051743c5 Change sint to int in atoms.proto
sint32 is not supported in statsd

Bug: 151110217
Test: m statsd
Change-Id: Ic711cee06a15a957fd4e25c4c01176cc44598cb2
2020-03-20 15:07:20 -07:00
Muhammad Qureshi
4d57eccd1d Merge "Remove kBytesFieldAtoms from atoms_info" into rvc-dev 2020-03-20 20:34:35 +00:00
Tej Singh
73597dcb9a Statsd update for native puller api feedback
Update statsd to take in times in milliseconds instead of nanoseconds.

Also make appropriate updates for graphics stats, odpm, subsystem sleep
state, and LibStatsPullTests

Test: atest LibStatsPullTests
Test: bit statsd_test:*
Bug: 150788562
Change-Id: I593552d6c50bb4dcb89ca9cc1c737781653e7cc5
2020-03-20 11:16:18 -07:00
Muhammad Qureshi
f77913fbc6 Remove kBytesFieldAtoms from atoms_info
Bug: 150415347
Test: m
Test: bit statsd_test:*
Change-Id: I2e55b445121a39e3bf12164cd9123561e8b5bd4c
2020-03-20 10:55:46 -07:00
TreeHugger Robot
a799cdba86 Merge "Implement new perfd<->statsd ShellSubscriber comm." into rvc-dev 2020-03-20 17:35:58 +00:00
Christine Tsai
a9c3cc288c Merge "(Part 2.6 - Final one!) Use new socket schema in ValueMetricProducer_test" into rvc-dev 2020-03-20 16:37:11 +00:00
tsaichristine
e5405ba55a (Part 2.6 - Final one!) 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 TestInvalidBucketWhenMultipleBucketsSkipped to TestSlicedStateWithPrimaryField_WithDimensions

Test: bit statsd_test:*
Bug: 149590301
Change-Id: I682a19ea6fe39dd750ca396c9de479befa658f0d
2020-03-19 20:59:32 -07:00
Mike Ma
707263d99c Merge "TextDumpsysSection memory optimization" into rvc-dev 2020-03-20 03:52:54 +00:00
TreeHugger Robot
591bb7b1fe Merge "Enforce permission on native puller API" into rvc-dev 2020-03-19 21:12:52 +00:00
Mike Ma
87003ad3f6 TextDumpsysSection memory optimization
TextDumpsysSection used to inherent WorkerThreadSection, which
allocates 2x more memory than the dumped content. This change saves
the extra allocation by writing dumpsys content directly to FdBuffer.

Bug: 150311553
Test: Manually run "incident -p EXPLICIT 4000"
Change-Id: I9c0c0db75c8595822ee0711040e8865dd69378b6
2020-03-19 12:31:29 -07: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
Ruchir Rastogi
a5e4bb5aa6 Implement new perfd<->statsd ShellSubscriber comm.
Because we no longer linkToDeath against a binder object to detect if
the cmd process has died, we detect deaths by checking if writes fail.
ag/10476582 proves that writes fail if the cmd process dies.

Test: m statsd
Test: bit statsd_test:ShellSubscriberTest.testPushedSubscription
Test: bit statsd_test:ShellSubscriberTest.testPulledSubscription
Bug: 150619687
Change-Id: I44a777ffff11e5b9298912b2906063c65e9009eb
2020-03-19 09:17:44 -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