Commit Graph

6445 Commits

Author SHA1 Message Date
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
Joe Onorato
795bfbaabf Power model calculation based on batterystats data.
Similar to the ActivityReport, the PowerReport contains the power
usage for a device.  To do the calculations, each of the
ComponentActivity objects are called, giving them the whole activity
info (in case they need to apportion blame) and the PowerProfile.
From that, they compute the per-component power usage, which is
then summed up into the AppPower and PowerReport objects.

Test: atest frameworks/base/tools/powermodel --host
Change-Id: Ibc9ada6f7f4a667152fc4af388f04766125ca74c
2018-11-29 10:48:26 -08:00
Joe Onorato
6e62087699 Add the concept of apps to the battery stats parser.
AttributionKey is how we identify an app.  It contains either
a set of package names, read from the uid records from batterystats
(or later UidMap from statsd), or one of the hard coded SpecialApps.

Test: atest frameworks/base/tools/powermodel --host
Change-Id: If2dee6bffd2d3dafccfeff5c92bafc651b356b15
2018-11-29 10:48:26 -08:00
Joe Onorato
68cf7a9e19 Parse the raw batterystats into an ActivityReport object.
For each app that appears in the batterystats data, there is an AppActivity
object (which subclasses from AppInfo, because the needs of the upcoming
PowerReport object are similar).  Inside the AppActivity, there are
ComponentActivity objects.  Each power using component has a ComponentActivity
for the fields required.  The additional Report objects in RawBatteryStats are
also added here.

This change usess modem data as a proof of concept. The exact fields in it
may evolve, even though the calculation uses tx and rx packets, the final power
calculation uses time, and putting the batterystats apportioning logic in the
batterystats handling code seems better than what we're doing here.  Anyway,
that can be iterated upon.

Test: atest frameworks/base/tools/powermodel --host
Change-Id: I2c5fce16d4fef3628d64107562d6cf9ea4edbbc2
2018-11-29 10:48:26 -08:00
Robin Lee
41773b73ea Don't rely on fallthrough in incident_section_gen
Silences the following warning during build:

frameworks/base/tools/incident_section_gen/main.cpp:265:13:
    warning: unannotated fall-through between switch labels
[-Wimplicit-fallthrough]
            default:
            ^
frameworks/base/tools/incident_section_gen/main.cpp:265:13:
    note: insert 'GOOGLE_FALLTHROUGH_INTENDED;' to silence this warning
            default:
            ^
            GOOGLE_FALLTHROUGH_INTENDED;

frameworks/base/tools/incident_section_gen/main.cpp:265:13:
    note: insert 'break;' to avoid fall-through
            default:
            ^
            break;

Test: make -j50 2>&1 | grep incident_section
Change-Id: Ie59510025e59e96f0763726794ff19dae595c672
2018-11-29 19:11:41 +01:00
Paul Duffin
da1293aba9 Merge changes from topic "libcore-remaining-hiddenapi" am: 74c171b4da am: a51da7d3be
am: da53a737ca

Change-Id: I7e5ca251a6c15ea6f040897a8e5cf4c653f4ddd1
2018-11-29 08:34:17 -08:00
David Brazdil
5cd148fc7a hiddenapi: Add constants for 'greylist-max-p'
New category of hidden API has been created. Update the script
generate_hiddenapi_lists.py with the new flag name.

Test: m, phone boots
Change-Id: I79e5478678880939e20e500cb8dad9b2a56fc84f
2018-11-29 15:43:02 +00:00
David Brazdil
89bf0f28bf Turn hidden API lists into a single CSV
Maintaining multiple text files has become too cumbersome as adding
each new category of API requires changes across many projects.
This patch changes generate_hiddenapi_lists.py to produce a single
CSV file in the format:

  <api_signature>,<flag1>,...,<flagN>

It can accept legacy API list files as input (for existing
frameworks/base/config/hiddenapi-*.txt files) as well as per-package
CSVs produced by class2greylist.

Test: m, check lists have not changed
Test: phone boots
Test: tools/hiddenapi/generate_hiddenapi_lists_test.py
Change-Id: Iebcef426ec93ea1d72b662bbff91d4e068fa0a70
2018-11-29 15:43:01 +00:00
Paul Duffin
00537c15e8 Prevent hiddenapi entries being added for libcore related projects
The libcore related projects (see below) have been (mostly) switched
over to use UnsupportedAppUsage annotations, This change will prevent
entries for those projects being added to a config/hiddenapi-* file.

* libcore
* external/bouncycastle
* external/conscrypt
* external/icu
* external/okhttp
* external/libphonenumber - still has a couple of entries in
      config/hiddenapi-light-greylist.txt due to limitations in
      UnsupportedAppUsage/class2greylist.

Tested by attempting to upload the file with entries for libcore
projects and without those entries and checking that the behavior
is expected.

Test: see above
Bug: 117818301
Change-Id: I67a30b307e12e842b28cfb2160fab0029868fa06
2018-11-29 09:41:56 +00:00
Joe Onorato
a3f265fa2e Class to parse the raw batterystats csv.
This parser builds a set of objects from the csv by looking
at the annotations on the fields.  Each line in the csv
corresponds to a Record object.

Test: atest frameworks/base/tools/powermodel --host
Change-Id: Ifeae68ce3bc3a6ea9330ff924204f016bff20663
2018-11-28 13:01:47 -08:00
Joe Onorato
7d1851fe49 Add csv parser for the power profile library.
There are enough variants of csv, and it's simple enough that
it's easier to just have our own parser than to introduce a
dependency on some other library, as this library will be used
in a variety of environments.

Test: atest frameworks/base/tools/powermodel --host
Change-Id: Ib0f7aceb2a58b58f447f6bcef5c95729303dee8a
2018-11-28 12:34:31 -08:00
Joe Onorato
9112a5e07a Off-device library for the power model.
This first CL adds a class, PowerProfile that parses the power
profile xml file into a set of individual *Profile classes, one
for each of the hardware "components."

There will be more to come.  This library will be used to compute
the power model from a batterystats or statsd dump, with abstractions
so clients don't need to know all of the nuances of batterystats'
old versions, or statsd's configs.

Test: atest frameworks/base/tools/powermodel --host
Change-Id: I79802f91234b09539072d10f15534cef391fe04a
2018-11-28 12:06:31 -08:00
Jeff Sharkey
86445841ac Guide towards Context.createPackageContextAsUser().
It's a better alternative that should be used instead of adding
new "ForUser" or "AsUser" methods.

Bug: 115654727
Test: manual
Change-Id: I8742c2ef42d743ef69f8f7a91378f498fdc81e43
2018-11-27 17:36:07 -07:00
Anton Hansson
2f5dd12af0 Add linter for strings attribute names
Only one bad example for now, which is a misspelling that's not
entirely uncommon and can lead to real problems (see linked bug).

Example output:
Line 58: 'my_new': Misspelled <string> attribute.
        Actual: translateable
        Example: translatable

Bug: 119884572
Test: with a misspelled attribute
Change-Id: If61412fe318a34191920781c4834584363080e11
2018-11-23 15:25:52 +00:00
Ryan Mitchell
19954a261c Merge "Do not serialize empty text in manifest proto" 2018-11-19 22:13:35 +00:00
Mark Salyzyn
adc63f02b3 Merge changes I664fb325,I5e289469 am: 701001688f am: 833a491fab
am: beea2153ab

Change-Id: Ifd30d79d06e4e80103ff2f09b0ae960ceb8bc7f9
2018-11-19 13:46:31 -08:00
TreeHugger Robot
d1633c3bdb Merge "Incidentd: Fix switch break warnings" 2018-11-19 20:14:12 +00:00
Ryan Mitchell
467b689a4c Do not serialize empty text in manifest proto
When linking an APK in the proto format, the manifest is currently
serializes text nodes that only contain whitespace:

child: {
  text: "\n        "
  source: {
    line_number  : 0x0000000f
    column_number: 0x0000002f
  }
}

These whitespace bloat the proto size unnecessarily. Do not write these
text nodes for proto apks.

Bug: 118800653
Test: make aapt2_tests
Change-Id: Icfaaf88976f81450bbf51610a316b336deeae60c
2018-11-16 15:58:06 -08:00
Ryan Mitchell
a7d9f269d6 Merge "Fix loaded apk string pool order" 2018-11-16 17:27:23 +00:00
Ryan Mitchell
4e9a922ede Fix loaded apk string pool order
Loading in an APk changed the ordering of strings in the string pool.
When loading an apk, assign the strings to the same index as they
are in the ResStringPool.

Bug: 118831219
Test: "aapt2 dump strings left.apk" prints in the correct order,
"aapt2 convert left.apk --output-format binary -o left_binary.apk" has
entries in the correct order, and aapt2_tests

Change-Id: I00014c02195f39c1152a110e90083d9b14e9216e
2018-11-15 11:37:01 -08:00
Mark Salyzyn
d100107806 switch to using android-base/file.h instead of android-base/test_utils.h
Test: compile
Bug: 119313545
Change-Id: I664fb32522d01909c603d7b903475c4e9aea9223
2018-11-14 15:54:32 -08:00
Bookatz
da9b8d0ad1 Incidentd: Fix switch break warnings
A few switches didn't have explicit breaks in them, which was causing
warnings. They were all benign, as the logic did not necessitate a
break. But this is will stop the warnings and perhaps prevent future
bugs.

Change-Id: Idb293a4896f4df8d3f11d748e0e716efc26bbd6a
Fixes: 119047812
Test: N/A
2018-11-14 13:35:30 -08:00
TreeHugger Robot
252c7c43c9 Merge "Pass the last error code when statslog.write fails" 2018-11-12 19:27:58 +00:00
Yao Chen
39b679925a Pass the last error code when statslog.write fails
The error code will give us some clue on what caused the loss (e.g., EBUSY, or ENOENT)

Test: manual
Bug: 80538532

Change-Id: I446c6e2255bdae063dfb8803ad0b702ead87c645
2018-11-09 09:56:36 -08:00
Mårten Kongstad
4b55bd77fb AAPT2: propagate SPEC_OVERLAYABLE to splits
A resource marked SPEC_OVERLAYABLE in the base package was not marked as
such in the corresponding split packages. Add missing copy statement.

Test: manual (aapt2 dump test content in libandroidfw)
Change-Id: I800e92111a9da7c6f5e83f8a546d260c8d93b308
(cherry picked from commit ee41b3a36dcd87f79f3c2a21383a97743530099d)
2018-11-07 08:23:06 -08:00
TreeHugger Robot
e0c2f7e17d Merge "RRO: Added partition policies for overlays" 2018-11-06 16:49:55 +00:00
Ryan Mitchell
e4e989ccba RRO: Added partition policies for overlays
<overlayable> tags can now have policy elements that indicate which
partition the overlay apk must reside on in order to be allowed to
overlay a resource. This change only adds parsing of <policy> and
encoding of policy in the proto ResourceTable. A later change will add
the encoding of policy and overlayable in the binary APK.

<overlayable>
  <policy type="system|vendor|product|product_services|public" >
    <item type="string" name="oof" />
  </policy>
</overlayable>

Bug: 110869880
Test: make aapt2_tests
Change-Id: I8d4ed7b0e01f981149c6e3190af1681073b79b03
2018-11-06 00:10:26 +00:00
Chih-hung Hsieh
51025d638d Merge "Allow implicit-fallthrough warnings locally." am: 36afe11a64 am: 9c5738238d
am: 469705cca4

Change-Id: I4bc5f389495ed535762438632e65ccd6c66f3739
2018-10-25 17:58:17 -07:00
Marco Nelissen
6baf5e4e1c Merge "Don't try to compress opus resources" 2018-10-25 19:39:11 +00:00
Marco Nelissen
18f16d6241 Don't try to compress opus resources
Test: build

Change-Id: Ibf398b3afca02d4111d88b126c8d107ac44068a6
2018-10-25 08:31:19 -07:00
Yao Chen
bbdd67d19f 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
Fix: 118386797
Test: unit test & manual test
2018-10-24 13:12:13 -07:00
Chih-Hung Hsieh
e8abd06776 Allow implicit-fallthrough warnings locally.
It will be a global error by default.

Test: make checkbuild
Bug: 112564944
Change-Id: I26616fd50ccf3639fa7c01d850a14d079273ede7
Exempt-From-Owner-Approval: do not block on new warnings
2018-10-22 09:56:12 -07:00
Mathew Inwood
061b522b91 Merge "Merge hidden API metadata into a single CSV file." am: 5037a7eb93 am: 3ffa1cad11
am: 92b1736e66

Change-Id: I55b39b42411e93adf2716bf59ef15eb5981f526a
2018-10-18 08:23:01 -07:00
Ryan Mitchell
67f94b4002 Merge "Fix incorrect proto apk loading" 2018-10-17 23:53:04 +00:00
Mathew Inwood
3ffa1cad11 Merge "Merge hidden API metadata into a single CSV file."
am: 5037a7eb93

Change-Id: I0efce89576b0ca7ae90d49de3455466a866521de
2018-10-17 10:35:39 -07:00
Ryan Mitchell
ec74f2fbd5 Fix incorrect proto apk loading
If a proto apk is missing resources.pb, AAPT2 would fail to detrmine the
apk format because of an incorrect check. This fixes that check and
removes the checking fuction from the LoadedApk header.

Bug: 117820549
Test: removed resources.pb from proto apks and confirmed that loading in
apks still works

Change-Id: If3628a821e7b59c7dfcbefb502b6080be083cec1
2018-10-17 09:30:01 -07:00
Mathew Inwood
5037a7eb93 Merge "Merge hidden API metadata into a single CSV file." 2018-10-17 09:20:04 +00:00
Dan Willemsen
9ad6ab595d Merge "Stop using DIST_DIR directly, use dist-for-goals instead" am: a8f2601d28 am: 9b767e275e
am: fa5b204029

Change-Id: Ic052f5d1de317c2f271f5a2df83c733c79978679
2018-10-16 18:01:26 -07:00
Dan Willemsen
9b767e275e Merge "Stop using DIST_DIR directly, use dist-for-goals instead"
am: a8f2601d28

Change-Id: Iabb2ddb086dda71887c3d50152db50f813c9556a
2018-10-16 17:43:35 -07:00