Commit Graph

6026 Commits

Author SHA1 Message Date
Jeff Sharkey
abe058c0f0 Add linter for strings.xml.
Strings are tedious to get right, so write a lint script that catches
common errors to warn developers before they're uploaded.

Test: builds, boots
Bug: 76097999
Change-Id: I9826ca796c17cd93a100951d56214653de63a379
2018-03-26 11:04:48 -06:00
TreeHugger Robot
aed0fed078 Merge "Add uid field annotation in atoms.proto and statd memory usage optimization." into pi-dev 2018-03-20 17:12:25 +00:00
corysmith@google.com
f7db43ee35 Writes the resource table proto out when writing a LoadedApk.
Small fixes for consistancy to use constants instead of strings.

Change-Id: I33439c376e1634b7957730ce16e241b0f5bb92f8
Fixes: 74594854
Test: Manual, tested against blaze test //javatests/com/google/devtools/build/android:UnitTests
2018-03-18 14:30:13 -04:00
Yao Chen
c40a19d2e4 Add uid field annotation in atoms.proto and statd memory usage optimization.
[memory]
  statsd binary size from 664k -> 600k
  memory usage 1978k -> 1813k (with no configs)
  + Avoid initialize any static map in statslog.h to avoid many copies of the map in each include.
    - Do it in cpp so that it is initialized only in places that use them

[Uid annotation]
+ Uid annotation is needed for extracting uid from dimension for UidCpuPuller.
+ After the change, stand-alone uids don't need to be in field 1 anymore.
+ Also added exclusive bit annotation in AppDied
+ Currently only allow one uid field in an Atom. This is to keep things simple until
  we find an exception.

Test: statsd_test
Bug: 73958484
Bug: 72129300

Change-Id: I8a916d5c00d5930e24ae7e0825a57dea19c0e744
2018-03-16 13:56:38 -07:00
Yi Jin
934cc613fd Fix bug to break switch cases.
Bug: 75001195
Test: N/A
Change-Id: I99274cbf34d191c25ad9ced08f999c59f922cb25
2018-03-15 14:23:01 -07:00
Kweku Adams
eadd123d68 Dumping stack traces to proto.
Bug: 72177715
Test: flash device and check incident.proto output
Change-Id: Id2a15e0fc62b66efe875949af97f0eb651c7e322
(cherry picked from commit 5c804e2b98)
2018-03-07 21:50:12 +00:00
Anton Hansson
d137c872cd frameworks/base: Set LOCAL_SDK_VERSION where possible.
This change sets LOCAL_SDK_VERSION for all packages where
this is possible without breaking the build, and
LOCAL_PRIVATE_PLATFORM_APIS := true otherwise.

Setting one of these two will be made required soon, and this
is a change in preparation for that. Not setting LOCAL_SDK_VERSION
makes the app implicitly depend on the bootclasspath, which is
often not required. This change effectively makes depending on
private apis opt-in rather than opt-out.

Test: make relevant packages
Bug: 73535841
Exempt-From-Owner-Approval: Global cleanup
Change-Id: I26458e41ecb84de91ac9a356a5d4bafb44f463c1
2018-03-07 11:42:04 +00:00
TreeHugger Robot
7d55509c19 Merge "Modifying proto csv output to include privacy levels." 2018-03-03 00:02:52 +00:00
Adam Lesinski
f3c951fd52 Merge "Change ownership of AAPT2 and libandroidfw" 2018-03-02 22:38:46 +00:00
TreeHugger Robot
51aed1c8b9 Merge "AAPT2: Allow to inline XML into custom attribute" 2018-03-02 22:36:22 +00:00
Adam Lesinski
a95e841846 Change ownership of AAPT2 and libandroidfw
toddke@ is now the new owner of these projects.

Test: none
Change-Id: Ie92b020e0ba063f48ce8a76ebaef768fe0d554f1
2018-03-02 12:11:03 -08:00
Adam Lesinski
c9a2926e66 AAPT2: Allow to inline XML into custom attribute
Previously, doing something like

<parent xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:aapt="http://schemas.android.com/aapt">
    <aapt:attr name="app:foo">
        <child />
    </aapt:attr>
</parent>

would result in something like:

<parent xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:aapt="http://schemas.android.com/aapt"
        foo="@generated_name" />

while it should result in:

<parent xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:aapt="http://schemas.android.com/aapt"
        app:foo="@generated_name" />

Bug: 36809755
Test: make aapt2_tests
Change-Id: I72ea4b402e196ca05b53b788e4768a265190a0dc
2018-03-01 20:04:00 -08:00
Adam Lesinski
34a1687a67 AAPT2: Remove resources that define locales but no default values.
According to our docs:
https://developer.android.com/guide/topics/resources/localization.html#defaults-r-important

Some resources *require* that there is a default definition. So far,
the pain is felt when doing translations for strings that have been
renamed, etc.

This CL strips out resources that don't have a default value and define
a resource for a locale. This is conservative, but should be expanded
to other configuration properties moving forward.

Bug: 36572857
Test: make aapt2_tests
Change-Id: Ife94a1f8a2ee221f8532ffa856541a9c8c4e7143
2018-03-01 11:18:23 -08:00
TreeHugger Robot
ec98448f15 Merge "Implement a new section to attach LAST_KMSG to incident report This section simply gzip a large file and stores result in GZippedFileProto" 2018-02-28 03:02:16 +00:00
Adam Lesinski
2eed52ecc0 AAPT2: Fix styled string whitespace processing
Change styled string whitespace processing to be like AAPT's was.

Main changes:
- whitespace around tags is preserved.
- tags start exactly where they are supposed to, not off by one.

Bug: 72406283
Test: make aapt2_tests
Change-Id: I4d12728c493efd8c978e2e3d2718b56534ff52ef
2018-02-27 11:39:10 -08:00
Yi Jin
1a11fa1097 Implement a new section to attach LAST_KMSG to incident report
This section simply gzip a large file and stores result in GZippedFileProto

This greatly improves the size, before gzip, the last kmsg size ~500KB,
after gzip the proto size is ~60KB.

Bug: 73354384
Test: atest incidentd_test and manual on device test
Change-Id: I9bfc2cf07384487671edbffb5f0bd8495608fea6
2018-02-27 11:36:29 -08:00
Adam Lesinski
e1094a2e23 AAPT2: Fix issue with String flattening in XmlFlattener
Compiled Strings (previously not encountered) in an XML resource
were using a different StringPool than the one being referred to
in the XmlFlattener, and so the indices were all wrong.

Bug: 72700446
Test: make aapt2_tests
Change-Id: I663924f8fad50fd4c69cfa196318dc63fb641a25
2018-02-23 14:59:37 -08:00
Kweku Adams
ecf4bdb447 Modifying proto csv output to include privacy levels.
Bug: 73775471
Test: use new output in go/irpf
Change-Id: Ib9e836e350f8d664ef66ecfe2539d15d164953be
2018-02-22 17:48:23 -08:00
TreeHugger Robot
868688ed16 Merge "Add annotation to atoms that represent a state change in atoms.proto" 2018-02-22 05:36:45 +00:00
Yao Chen
9c1debe330 Add annotation to atoms that represent a state change in atoms.proto
+ A state change atom can have one exclusive state field, and any
  number of primary key fields.

  When there is primary key in the atom, it means the state belongs to the primary key.
  For example,
  message UidProcessStateChanged {
    optional int32 uid = 1 [(stateFieldOption).option = PRIMARY];
    optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
  }

  When there is no primary key fields in the atom, the state is global.
  For example,
  message ScreenStateChanged {
     optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
  }

+ The annotation is consumed by stats_log_api_gen to generate a static map from the state
  atoms to its primary fields, and exclusive fields

+ stats_log.proto is splitted into 2 proto files, because statsd needs proto lite, and c++
  lite proto library cannot properly ignore the field options which requires full proto.

 This CL doesn't change any logic in the statsd yet. A separate CL will use the field option
 information to correctly track the state.

Test: added unit tests in stats_log_api_gen_test. and statsd_test pases.
Change-Id: I9e8a979fe81ba60efd4d854bb7087ce4b2b147ec
2018-02-21 16:46:56 -08:00
Yangster-mac
c4aa760428 Remove a few atoms from the timestamp truncating whitelist.
Test: statsd test
Change-Id: Ic6a152cb400bef33139357d60f6d0feca855ade2
2018-02-20 13:20:54 -08:00
TreeHugger Robot
581ff5ec0d Merge "Timestamp Truncating whitelist." 2018-02-20 20:41:29 +00:00
TreeHugger Robot
3ac786d217 Merge "AAPT2: normalize Manifest java identifiers." 2018-02-19 10:42:35 +00:00
Yangster-mac
d5c356214f Timestamp Truncating whitelist.
Test: manually tested.
Change-Id: I46da375b6c0773ffc611bc06fff12cb4f9a7fc18
2018-02-17 21:11:54 -08:00
TreeHugger Robot
983bacb959 Merge "AAPT2: Ensure output formats of files are correctly set" 2018-02-17 01:58:18 +00:00
Jeff Sharkey
ee21f695b6 Recommend ICU replacements, no clone, no Impl.
When ICU has a better replacement class, recommend that APIs use
that instead.

Yell if someone implements clone(), and point them towards a copy
constructor instead.

Yell if someone exposes "Impl" classes.

Test: manual
Bug: 73392214, 71906588, 62627348
Change-Id: I75dcba2c4ab7ca426057eefb0335c935c3ced79a
2018-02-16 13:29:32 -07:00
Adam Lesinski
a65bbdf43c AAPT2: Ensure output formats of files are correctly set
When compiling straight to proto from source, the file types
were not set correctly (binary XML or proto XML).

Bug: 73406447
Test: manual
Change-Id: I68c1881a00a2ec1ad58f7ec485af2543d262d076
2018-02-15 16:44:15 -08:00
TreeHugger Robot
f74309f5e2 Merge "AAPT2: Fix issue with deserializing binary XML" 2018-02-15 06:39:21 +00:00
TreeHugger Robot
79fe852dab Merge "Log the elapsed realtime in non-chained interface." 2018-02-15 06:11:59 +00:00
TreeHugger Robot
237b1d0cf6 Merge changes I2f594c22,I37a2b8b8
* changes:
  AAPT2: Fix compatible-screens element in AndroidManifest.xml
  AAPT2: Add order attribute to groups
2018-02-15 05:46:47 +00:00
TreeHugger Robot
f19f505772 Merge "Dump XML files in aapt2 dump" 2018-02-15 02:41:54 +00:00
Adam Lesinski
bbf429795d AAPT2: Fix issue with deserializing binary XML
We assumed that a raw text value set for an attribute meant there
were no compiled values set either.

This would only really happen for attributes that did not belong to any
namespace (no prefix:), since we always kept their raw string values
in case some code relied on it.

Bug: 72700446
Test: make aapt2_tests
Change-Id: Icba40a1d4b181bfe7cad73131c4dbe5ba7f8b085
2018-02-14 16:11:23 -08:00
Yangster-mac
31ddcde690 Log the elapsed realtime in non-chained interface.
Test: statsd test
Change-Id: I61e457bd069147fd1b1fc964b27d42d4ec19230d
2018-02-14 16:09:35 -08:00
Shane Farmer
d05b9130fd AAPT2: Fix compatible-screens element in AndroidManifest.xml
Fix an issue where the compatible-screens element was not being
populated correctly. The previous version was missing the screenSize
attribute which is mandatory. The attributes were also missing the
resource ID from the framework library as these are a part of the public
API.

Change-Id: I2f594c2259831dbbd96c58db4ba55e8288d4231e
Test: unit tests
Test: manually split an APK and dumped with aapt
2018-02-14 15:44:42 -08:00
Adam Lesinski
da9eba300b Dump XML files in aapt2 dump
Test: manual
Change-Id: Id7f656c1385f6d1fec8eaa993c8e2b36bb1ae5b0
2018-02-14 10:49:32 -08:00
Yangster-mac
330af58f2b Use elapsed realtime instead of times based on wall clock, which can jump around and go backwards.
Test: statsd unit test passed

Change-Id: Ib541df99231e171b3be2a24f75632693e36da90e
2018-02-13 23:30:39 -08:00
Izabela Orlowska
d31bc123a0 AAPT2: normalize Manifest java identifiers.
Currently AAPT2 does not allow permissions which last piece contains the
"-" symbol (since it is an illegal character for a java identifier).

AAPT1 would normalize the last piece, therefore creating a valid java
identifier.

This CL makes AAPT2 behave in a similar way to AAPT1, but instead of
modifying the original value of the permission string, modifies only the
java identifier part, leaving the permission string unchanged.

Fixes: 72980877
Test: updated
Change-Id: Ie44317e07407341ba3e91a84d9b06980547b3448
2018-02-13 14:09:00 +00:00
Colin Cross
7d07ad1ef2 Merge "Don't put android.os.Parcelable in framework.aidl" am: 0872f6d5e3 am: 6864210fe2
am: 37ba3de333

Change-Id: Ib8d8277171ede82ea4626b6d2de2fcb9c1a1d307
2018-02-13 08:41:41 +00:00
Colin Cross
37ba3de333 Merge "Don't put android.os.Parcelable in framework.aidl" am: 0872f6d5e3
am: 6864210fe2

Change-Id: I17a5277ece615569670f5f8ea9c2ed42fb473a52
2018-02-13 07:51:59 +00:00
Nick Butcher
0ac5791e9e Merge "Prevent AAPT from versioning <animated-selector> tags." into oc-mr1-dev
am: 35e1410551

Change-Id: If9f28bfe12d75fca6b8f07c15b77f78267ef6292
2018-02-09 22:42:26 +00:00
Colin Cross
fdbe7d1ca9 Don't put android.os.Parcelable in framework.aidl
Parcelable shouldn't be in the list of parcelables in framework.aidl.
Remove it to fix warning when running aidl:
framework.aidl:287 attempt to redefine built in class android.os.Parcelable

Also make the dependency on sdk_parcelables not be order-only so
framework.aidl gets rebuilt when sdk_parcelables changes.

Bug: 73135791
Test: ParcelableDetectorTest
Test: out/target/common/obj/framework.aidl does not contain android.os.Parcelable
Change-Id: If5222879be9ec1e5fa08810adc624ec526ddc0ec
2018-02-09 11:29:15 -08:00
Nick Butcher
e78a816966 Prevent AAPT from versioning <animated-selector> tags.
Bug: 69359529
Test: Manually tested with ag/3178054
Change-Id: I10ae4d96c2a31a0a7c363d7a9292ecdfd3bb526a
2018-02-09 11:36:27 +00:00
Mohamed Heikal
1084432e1e AAPT2: Fix silent failure when ContainerReader fails during Link
Currently in the link step ContainerReader is used to read files but the
reader is not checked for errors prior to the read. This can lead to
silent failure when reading invalid resource files.

Change-Id: I6420699ad30b5b84b0b2c696af8eb5a6cbd4111e
2018-02-08 14:50:14 -05:00
Colin Cross
83b3cb4830 Merge "Add missing copyright messages" am: 872f386f6b am: 32a1dc5075
am: cf4d62fdd3

Change-Id: I75f2c81a9e7c7ec0175e50b3bb58cedc8c36a2be
2018-02-07 02:13:05 +00:00
Colin Cross
cf4d62fdd3 Merge "Add missing copyright messages" am: 872f386f6b
am: 32a1dc5075

Change-Id: I9602e1c9dda5e842fd71c9f48cf354aea4650d74
2018-02-06 23:06:08 +00:00
Colin Cross
1b27440abc Add missing copyright messages
Bug: 72993971
Test: m sdkparcelables
Change-Id: I9fa422160c29ce3054748b2b8d1e26541a697a90
2018-02-06 11:10:25 -08:00
Shane Farmer
11cdc1cf7a AAPT2: Add order attribute to groups
Require explicit ordering of groups in the configuration file to ensure
that the correct version code is set. Ordering based on a single ABI is
straight forward to ensure Play Store delivers the correct APK, but when
an APK needs more than one ABI things get messy quickly. This also goes
for screen density etc. The only thing that is easily sorted without
this attribute is android-sdk since an artifact can only reference a
single SDK.

Test: unit tests
Test: manually split an APK with update config.xml
Change-Id: I37a2b8b8a8409d6d6ff27c7142d4c8c8065a7a51
2018-02-02 12:11:18 -08:00
Dave Ingram
22ed4122e7 AAPT2: Fix typo in BinaryPrimitives oneofs
Follow-up to ag/3449569

Bug: 69587794
Test: aapt2_tests
Change-Id: I95d2ba600c00bda2a8420794e43501f9bfca01df
2018-01-30 21:15:36 -08:00
Yi Jin
b8344dc72f Fix command line tool to set the right privacy enum.
Test: manual
Change-Id: I3f0845ea32b46f1a028f8b6d3d4180a90a47beb5
2018-01-24 18:25:33 -08:00
TreeHugger Robot
adb4fc73b0 Merge "Avoid processing log event when there is no uid field." 2018-01-24 18:18:24 +00:00