Commit Graph

6483 Commits

Author SHA1 Message Date
Chih-hung Hsieh
b708a7953d Merge "Fix/suppress incident* google-explicit-constructor warnings" am: 6af0e228f3 am: 78085ba0a3
am: ee844ad9a2

Change-Id: I53c2fd3886e565d824e2765671fb7965f07bd08d
2018-12-21 09:24:28 -08:00
Chih-hung Hsieh
6af0e228f3 Merge "Fix/suppress incident* google-explicit-constructor warnings" 2018-12-21 16:30:12 +00:00
Jack He
fe88a7d7f2 Merge "Statsd: Enable host_supported for libstatslog" am: 0d7970f4e9 am: 46efaea281
am: b60a7cdc07

Change-Id: I59c5e4c8e27d31ba38af827162e0adb50fc183b1
2018-12-20 15:04:34 -08:00
Treehugger Robot
0d7970f4e9 Merge "Statsd: Enable host_supported for libstatslog" 2018-12-20 22:05:58 +00:00
Chih-Hung Hsieh
7a88a938d2 Fix/suppress incident* google-explicit-constructor warnings
* Add explicit to conversion constructors/operators
* Remove redundant explicit of copy constructors

Bug: 28341362
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor
Change-Id: I26a11bb798d25605577269ed340e97afc8566960
2018-12-20 13:45:04 -08:00
TreeHugger Robot
b34e8528ca Merge "Use vector instead of VLA to avoid uninitialized values" 2018-12-20 14:39:20 +00:00
Adrian Roos
bdadd6cc4c Merge changes Ibe09f115,Ib015669e
* changes:
  apilint: Fix API lint issues 2/2
  apilint: Fix API lint issues
2018-12-20 14:31:47 +00:00
Jack He
34a892d2f5 Statsd: Enable host_supported for libstatslog
* libutils must be used as a static library when compiled on host
* Host does not have Android system properties and hence we cannot
  use <cutils/properties.h>. In fact, properties.cpp is not even
  compiled on host for libcutils. Therefore, this CL adds a check
  for __ANDROID__ macro before including <sys/propoerties.h> and
  before calling properties_get_bool()
* On host, statsd logging will be disabled since host does not
  use statsd for anything

Fixes: 121294178
Test: test drive statsd
Change-Id: I838ff02468c650c5f7d85e68fa5008b98f08ce8c
2018-12-20 00:56:15 -08:00
Mathew Inwood
cfc7952cc8 Include annotation property values in output.
When editing annotations, we want the ability *not* to overwrite any
existing annotation properties already in place. Include any properties
set on the annotation in the output, so that the edit_annotations script
can know that they're there.

The annotation properties are encoded like URL query parameters for
convenience; it makes them easy to encode here & subsequently decode on
the other side (in Python).

Test: m framework-annotation-proc & inspect output.

(cherry picked from commit bd7077065c)

Merged-In: I71fb1215ad2790751be336b4955c163bb323a4a6
Change-Id: I0b33e2b379076346ce258d93a9225a9143b7d91a
2018-12-20 07:47:29 +00:00
Colin Cross
b9e195546e Use vector instead of VLA to avoid uninitialized values
I502b34f23d61a7346d79ff0dc378add8461d2d27 added a continue before
skip[i] was set, which left it uninitialized and caused
non-deterministic output of incident-section-gen incidentd and a
non-deterministic incidentd binary.  Use a vector instead of a
variable length array for skip so that it is always initialized.

Test: valgrind incident-section-gen incidentd
Change-Id: Iac9778dc8bbf4ec5540e5e2ffdaa8e2dd852d6cc
2018-12-19 23:04:42 -08:00
Ryan Mitchell
ed2af4df00 Merge "Add actor and name parsing for overlayable" 2018-12-19 17:31:50 +00:00
Adrian Roos
61e3730bc0 apilint: Fix API lint issues 2/2
Fixes false positives that occur when a class in current.txt is faulty, and an
entry for that class is then added to system-current.txt.

This was so because when parsing the previous revison's system-current.txt, we
did not know about the class and thus didn't look for it in current.txt, and
thus never recorded that the error is preexisting.

To avoid that, we track all classes in system-current.txt with a matching entry
in current.txt in the current revision, and later use that to look up all classes we
may have missed when examining the previous revision.

Test: python tools/apilint/apilint_test.py
Change-Id: Ibe09f1159e351e56b35b8816ce0db760de4ef791
2018-12-19 17:27:12 +01:00
Adrian Roos
2c5cacfd36 apilint: Fix API lint issues
Fixes a bug where only the name instead of the fully qualified name was
considered when looking for a class, which lead to faulty results for inner
classes.

Test: python tools/apilint/apilint_test.py
Change-Id: Ib015669ed3faef21d2bdd16f1e27bc55c8669d70
2018-12-19 17:27:12 +01:00
Anton Hansson
d4dcb41863 Merge "Make aapt2 dump badging print overlay info" 2018-12-19 10:36:08 +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
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
Yao Chen
d66ecfccf6 Add byte size of the bytes fields to statslog c++ APIs.
The proto binary data can contain '\0's and in the native layer,
the current liblog api would convert that into string and thus
the data is truncated.

This CL adds a "size_t bytes_field_len" after the bytes fields so that
we can correctly pass the data from JAVA to native.

Java StatsLog.write() APIs remain the same

Bug: 120635548
Test: test_drive with atom 103
Change-Id: I34f1c4ddd6a4ec5f3604b0c67a47a5399e3c6ddd
Merged-In: I34f1c4ddd6a4ec5f3604b0c67a47a5399e3c6ddd
(cherry picked from commit 1fe9f59498)
2018-12-15 13:52:47 -08: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 8e6f998300)
2018-12-15 13:52:27 -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 bbdd67d19f)
2018-12-15 13:51:08 -08:00
Ryan Mitchell
54237ffed4 Add actor and name parsing for overlayable
Add parsing of two overlayable attributes:
 name : The unnique identifying name of the overlayable set of resources
 actor: The component responsible for enabling and disabling overlays
        targeting the specified set of resources

Bug: 110869880
Bug: 119390855
Test: m -j aapt2_tests
Change-Id: Id42463e2b92b69034fb39cd29bc8606affb61ba7
2018-12-13 16:05:10 -08:00
Adrian Roos
7690d0d4ee API Lint: Add support for base current.txt
Allows specifying a base current.txt and previous.txt file when linting
system-current.txt and test-current.txt to avoid false positive error
messages due to public API members not being duplicated in the respective
non-public APIs

Test: python tools/apilint/apilint.py --base-current=api/current.txt api/system-current.txt
Change-Id: I306a99b1423584ef3fcdc9272a83cb5eacc37227
2018-12-13 22:35:00 +01:00
Ryan Mitchell
267d6ac11e Merge "Refactor policy parsing" 2018-12-13 00:07:32 +00:00
Anton Hansson
cd2d8e2021 Make aapt2 dump badging print overlay info
This adds the contents of the manifest <overlay> tag to the
output of aapt2 dump badging.

Sample output:
  overlay: targetPackage='android' priority='1' isStatic='false'

Bug: 119938467
Test: aapt2 dump badging \
  $ANDROID_PRODUCT_OUT/vendor/overlay/framework-res__auto_generated_rro.apk
Change-Id: Ie9d904e6206ff8cf092744e630ee6f496672673c
2018-12-12 13:17:26 +00:00
Mathew Inwood
745bdd02cd Merge "Implement signature check." 2018-12-12 11:05:53 +00:00
TreeHugger Robot
cc50ce302f Merge "Code generation for @InspectableProperty" 2018-12-12 10:31:21 +00:00
Chih-hung Hsieh
5374655451 Merge "Fix cert-dcl16-c clang-tidy warnings." am: 20b64c4bc7 am: 3038f743bf
am: 82b999a59c

Change-Id: Ie4bb31fc7366d65e92209c31f6721e20c8538e9a
2018-12-11 19:34:07 -08:00
Chih-hung Hsieh
20b64c4bc7 Merge "Fix cert-dcl16-c clang-tidy warnings." 2018-12-12 02:58:22 +00:00
Ashley Rose
171a723c10 Code generation for @InspectableProperty
This does not include the annotation processing needed to build the
property model the generator consumes or support for IntEnumMapping or
IntFlagMapping. Support will be added in subsequent CLs.

Bug: 117616612
Test: atest --host view-inspector-annotation-processor-test
Change-Id: I1d7829a12c7243645a96a32c8fc22b13c70c64e1
2018-12-11 23:57:10 +00:00
Ryan Mitchell
1bb1fe068a Refactor policy parsing
This change removes the ability for an overlayable resource to be
defined in multiple policy blocks within the same overlayable. This
change also changes aapt2 to use a bit mask to keep track of the parsed
policies.

Bug: 110869880
Bug: 120298168
Test: aapt2_tests
Change-Id: Ie26cd913f94a16c0b312f222bccfa48f62feceaa
2018-12-11 13:48:45 -08:00
Chih-Hung Hsieh
054dab1d47 Fix cert-dcl16-c clang-tidy warnings.
Bug: 120614316
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,cert-dcl16-c
Change-Id: I2dc262d3407aafa969e921236dc3fc3ae60eb9d4
2018-12-11 11:27:17 -08:00
Mathew Inwood
96c419f906 Implement signature check.
Currently, we just have debug keys, and always fail verification on
user builds. Production keys will be added later.

This CL also includes some helper scripts:
- Used to generate debug keys, for the record
- To sign data using the debug keys
- To verify base64 encoded data, used for debugging

Test: atest CtsSignedConfigHostTestCases
Note: The test also relies on some other changes going in too; it has
been verified with all relevant change in place, but will not pass at
HEAD quite yet.

Bug: 110509075
Change-Id: I8bd420c44a0a523cbefb21f90c49550c25beb0a6
2018-12-11 17:06:27 +00:00
Paul Duffin
7a7a823422 Merge "Switch last c.a.i18n.phonenumbers hiddenapi entries to annotations" am: 15152e7d95 am: f0e9bc79dd
am: 37d00de390

Change-Id: If39b82b838f2a71a69f32eba98320726758642fe
2018-12-11 06:08:23 -08:00
Ashley Rose
de080eb7b0 Annotation processor for @InspectableNodeName
Bug: 117616612
Test: atest --host view-inspector-annotation-processor-test
Change-Id: I48f62544655adbc33e3ccdd3301d6dc471fe4163
2018-12-10 23:30:43 +00:00
TreeHugger Robot
a96d8d0b78 Merge "Add byte size of the bytes fields to statslog c++ APIs." 2018-12-10 19:46:10 +00:00
Paul Duffin
352956b07e Switch last c.a.i18n.phonenumbers hiddenapi entries to annotations
Previous changes could not remove these entries as they are implicit
methods, i.e. are not present in the source, and so could not be
annotated. That is no longer true and so these entries can now be
removed.

This was tested by making and then manually checking that the generated
out/target/common/obj/PACKAGING/hiddenapi-light-greylist.txt was the
same (after sorting) before and after this change.

Bug: 117818301
Bug: 119861512
Test: as above
Change-Id: Ic33c693f50cac011332c5ba5a5c0e2b6562e6ef8
2018-12-10 16:05:54 +00:00
Yao Chen
1fe9f59498 Add byte size of the bytes fields to statslog c++ APIs.
The proto binary data can contain '\0's and in the native layer,
the current liblog api would convert that into string and thus
the data is truncated.

This CL adds a "size_t bytes_field_len" after the bytes fields so that
we can correctly pass the data from JAVA to native.

Java StatsLog.write() APIs remain the same

Test: test_drive with atom 103
Change-Id: I34f1c4ddd6a4ec5f3604b0c67a47a5399e3c6ddd
2018-12-06 13:06:04 -08:00
TreeHugger Robot
764acc461c Merge "Encoding of <overlayable> and <policy>" 2018-12-05 07:06:21 +00:00
Ryan Mitchell
75e20dda2b Encoding of <overlayable> and <policy>
This change defines two new chunks for encoding overlayable information.
RES_TABLE_OVERLAYABLE_POLICY_TYPE contains flags that represent
restrictions enforced on overlays that try to overlay a specific set of
resource ids. The chunk header is followed by ResTable_ref for each id
that belongs to the policy type. A policy chunk will be created for
every unique combination of policies that are defined in overlayable
declarations.

RES_TABLE_OVERLAYABLE_TYPE holds policy blocks. Since <overlayable>
does not currently have any attributes, only one overlayable block is
encoded in an APK.

This change also removes the SPEC_OVERLAYABLE flag because the runtime
does not use the flag, and the overlayable chunk encoding renders it
obsolete.

Bug: 110869880
Bug: 117545186
Test: libandroidfw_tests and aapt2_tests
Change-Id: I45ae9bf4176699f14c85e2b7a2e8560185d8a0b8
2018-12-04 16:45:26 -08:00
David Brazdil
0bf7ab1631 Merge "hiddenapi: Add constants for 'greylist-max-p'" am: ec62f08f8c am: 8a822605d2
am: f29f0de34c

Change-Id: I31647f9e58e86d1bb18891534fcf1e3d4226298e
2018-12-04 03:07:34 -08:00
David Brazdil
ec62f08f8c Merge "hiddenapi: Add constants for 'greylist-max-p'" 2018-12-04 10:07:59 +00:00
Jeff Sharkey
719883458c Merge "People don't read warnings." am: ea41708f12 am: 602393351b
am: 91d3383b45

Change-Id: I5d4770a434cff9e0b10c9a0f36128d285b0f67c3
2018-12-03 15:15:24 -08:00
Ryan Mitchell
be8607dcd5 Add @hide support for styleable attributes
AAPT2 generates documentation for styleables. The documentation contains
references to the attributes of the styleable. If the attributes are
marked @hide, remove the references to the attributes in the generated
coments.

Bug: 120262117
Test: m -j offline-sdk-docs
Change-Id: I541002077b17771d89caead04df2f4ae66c623f0
2018-12-03 12:01:24 -08:00
Jeff Sharkey
aaaf1b7a88 People don't read warnings.
Bug: 113136846
Test: manual
Change-Id: If7e313b4f0fa90875795b24817553bbd9a8c60ff
2018-12-03 10:58:42 -07:00
David Brazdil
96116e6fd7 Merge "Turn hidden API lists into a single CSV" am: 0edec143d9 am: 7423a90d8c
am: ab0802a50a

Change-Id: Id5540ddacf047de8dd106bdd22c708b2a00b96eb
2018-12-03 07:14:34 -08:00
TreeHugger Robot
3d31b4e018 Merge "Don't rely on fallthrough in incident_section_gen" 2018-11-30 20:18:25 +00:00
Mathew Inwood
bd7077065c Include annotation property values in output.
When editing annotations, we want the ability *not* to overwrite any
existing annotation properties already in place. Include any properties
set on the annotation in the output, so that the edit_annotations script
can know that they're there.

The annotation properties are encoded like URL query parameters for
convenience; it makes them easy to encode here & subsequently decode on
the other side (in Python).

Test: m framework-annotation-proc & inpsect output.
Change-Id: I71fb1215ad2790751be336b4955c163bb323a4a6
2018-11-30 09:00:43 +00:00
Joe Onorato
2a0e196a54 Merge changes Ibc9ada6f,I2c5fce16
* changes:
  Power model calculation based on batterystats data.
  Parse the raw batterystats into an ActivityReport object.
2018-11-30 01:25:54 +00:00
TreeHugger Robot
f69ca4e970 Merge "Skip writing message field in an atom if it's empty" 2018-11-29 22:52:57 +00:00
TreeHugger Robot
626a973099 Merge changes If2dee6bf,Ifeae68ce,Ib0f7aceb,I79802f91
* changes:
  Add the concept of apps to the battery stats parser.
  Class to parse the raw batterystats csv.
  Add csv parser for the power profile library.
  Off-device library for the power model.
2018-11-29 21:02:10 +00:00
Yao Chen
8e6f998300 Skip writing message field in an atom if it's empty
Test: unit test added
Change-Id: I825b1ce526944a20fe65705508ad180ece37492c
2018-11-29 10:59:57 -08:00