545 Commits

Author SHA1 Message Date
Marcin Kosiba
a0a9466476 Merge "Don't use reflection when generating the onResourcesLoaded callback." into lmp-dev 2014-09-11 18:34:33 +00:00
Marcin Kosiba
0f3a5a6559 Don't use reflection when generating the onResourcesLoaded callback.
BUG: 17466240
Change-Id: I74608f3d8b3617281639a9d387face97e15fb616
2014-09-11 16:02:13 +01:00
Adam Lesinski
3fb8c9b50e AAPT: Don't crash on illegal symbol name
We never checked the return value when adding a nested
symbol, which would be NULL if the symbol name was invalid.

External bug: https://code.google.com/p/android/issues/detail?id=75876

Change-Id: I5211f4d4b87897d52f2b6e5907113d31930bb92d
2014-09-09 16:05:10 -07:00
Adam Lesinski
5283faba4a Change platformBuildVersionCode to name in aapt dump badging
Change-Id: Ie3972105b3f6a727682f91851f7a99b05bb28e1a
2014-08-29 11:27:00 -07:00
Adam Lesinski
ad2d07d2d9 Stamp platform version code into app Apks
The versionCode of theframework resources that an app is built against
gets stamped inside an app's AndroidManifest.xml in the <manifest>
tag as "platformBuildVersionCode" and "platformBuildVersionName"
attributes.

Bug:17207635
Change-Id: Id573c3dffcbca38eec9c0eb3e89f4a547e3361d3
2014-08-27 18:28:49 -07:00
Adam Lesinski
3aa6076083 Merge "Have R classes generate their own reference rewrite logic" into lmp-dev 2014-08-26 18:23:57 +00:00
Adam Lesinski
1e466385d4 Have R classes generate their own reference rewrite logic
Change-Id: I0e5b8311fc3479d966a49f9acf0d4c32a6a024d3
2014-08-25 20:04:07 -07:00
Adam Lesinski
31245b4f06 Introduce anydpi density resource qualifier
This is meant to be used with scaleable vector
drawables, and are chosen as the best match unless
there is a configuration that matches the density
requested exactly.

Bug:17007265
Change-Id: Ic3288d0236fe0bff20bb1599aba2582c25b0db32
2014-08-25 17:47:30 -07:00
Adam Lesinski
a5cc002bfe AAPT: Filtering resource fix
Previously, when filtering resources from an APK using
-c option, if one qualifier matched, we would keep the resource.
However, in the case of something like

-c fr-FR,sw360dp

and with a resource in the APK like so

drawable-fr-FR-sw600dp-v13

we would want this resource to be excluded, as it does not
match the sw360dp qualifier (must be less than or equal to it).

This CL fixed the behavior of the filter to require that all
defined qualifier axis be matched.

Bug:17142358
Change-Id: Ie48f3d516a0e610abc7ba8a7ced4eb3ab52534d4
2014-08-22 16:09:54 -07:00
Adam Lesinski
caf797c84a AAPT: Dump installLocation in badging
Bug:17033144
Change-Id: I87dea9af47eef8bcba1465df9b49e355ac6346ec
2014-08-22 13:01:11 -07:00
Adam Lesinski
d255aba093 Merge "Add better error message for AAPT file conflicts" into lmp-dev 2014-08-21 22:00:25 +00:00
Adam Lesinski
27f69f4e06 AAPT: mipmaps should not end up in Splits
Mipmaps are never filtered, and so they will always
end up in the base APK. Make sure they get omitted from
any split.

Change-Id: Id24b082bc9bd2d3f031a58bd0de4d30b4f0de7e0
2014-08-21 13:59:46 -07:00
Adam Lesinski
48f05d29f3 Add better error message for AAPT file conflicts
Some resource directories may be the same even though
their names are different. For instance, the
"smallest width" qualifier was added in API 13,
so the resource directory "values-sw600dp" and
"values-sw600dp-v13" are the same and cause
a conflict. The error reports that this might be the
case.

Change-Id: Ia35f1d670edd48265b3a7fe3d55656128421f612
2014-08-21 20:54:01 +00:00
Adam Lesinski
6a7d2757a9 Use the correct versionCode for Split APKs
Insert the correct versionCode into the generated
Split AndroidManifest.xml.

Change-Id: I0aec797b5a4ff8bd70f9394b18aee5ad292b37c8
2014-08-21 11:00:09 -07:00
Adam Lesinski
6022debdbc AAPT: Fix regression generating dynamic ref table for shared libraries
AAPT stopped generating dynamic reference tables for shared libraries.

Change-Id: Ib0025811bdca1a4756eb21080dd6b6bb3fc1ca3d
2014-08-20 17:55:33 -07:00
Adam Lesinski
43a0df04b0 Allow enum generated IDs to reuse existing IDs
Change-Id: Ida5dbbce1c4ecb0a4e57511555cec6448737be25
2014-08-19 03:46:00 +00:00
Adam Lesinski
ad75122440 Include build number in aapt version
Teams are constantly confused over which version of aapt
they are running. Include the build number from the
Android build system in the binary. Can be retrieved by executing
'aapt version'.

Change-Id: I9165c7d01f977344e143c2cb4dd963310ab28b72
2014-08-18 23:42:21 +00:00
Adam Lesinski
9a9a17eb07 Revert "Include build number in aapt version"
This reverts commit a7ce555ee82ed91345a54ee171dc9a415b65e134.

Change-Id: I1018747766963e75bec11ddb01ba6d138f133959
2014-08-18 22:39:38 +00:00
Adam Lesinski
71809ee7f6 Include build number in aapt version
Teams are constantly confused over which version of aapt
they are running. Include the build number from the
Android build system in the binary. Can be retrieved by executing
'aapt version'.

Change-Id: Ie4692fb160c7cbe720a8e76b73e435170214fe0e
2014-08-18 21:08:15 +00:00
Adam Lesinski
e47fd12905 AAPT: Output only 64-bit arch when multiArch is true
When android:multiArch="true" in the <application> tag,
aapt dump badging should only output the 64-bit architecture
under the 'native-code' entry.

Other architectures will be emitted under the 'alt-native-code'
entry.

Bug:17061929
Change-Id: I8310b2388b06a2ed571e5e121e4989403082ba68
2014-08-15 22:25:36 -07:00
Adam Lesinski
91306bccf1 Merge "Add FeatureGroup to PackageInfo" into lmp-dev 2014-08-15 18:56:10 +00:00
Adam Lesinski
d3edfde51b Add FeatureGroup to PackageInfo
FeatureGroups replace top-level FeatureInfo objects.
FeatureGroups inherit top-level FeatureInfos but override
them if the feature names are the same.

Bug:16822121

Change-Id: I80b2cb778a0fbcb4521efce986fba641e0914290
2014-08-15 15:53:35 -07:00
Adam Lesinski
2cb761e3dd Fix assumption about DynamicRefTable in aapt
Packages without any resources should not expect to have
a DynamicRefTable.

Bug:16895517
Bug:17056720
Change-Id: Id006f6bdbf08f30505f6ba5982bc9d1b09db0f0a
2014-08-15 14:01:43 -07:00
Chris Craik
47d8623082 Fix nine patch outline radius computation
bug:16852714
Change-Id: I475154c0f324fd2e2c8991415e0d8240c75663d8
2014-08-15 00:41:09 +00:00
Adam Lesinski
6240840387 Ensure that split names are valid
Generate valid split names for resource splits.
Validate split names for features.

Change-Id: I3040438af0156778c2bd66ddeffdf62fe9dcc9fc
2014-08-14 19:29:47 +00:00
Adam Lesinski
25d35a9d68 AAPT: Dump an APK's split name attribute
Bug:16919497

Change-Id: I109e21bff9e4a64a10f48dce7f2d41102b32ee1d
2014-08-12 22:17:25 +00:00
Adam Lesinski
ec64709ce0 Merge "AAPT support for feature splits" into lmp-dev 2014-08-09 00:40:15 +00:00
Adam Lesinski
e8e9192507 Have styleable indices be non-final for library projects
Invoking aapt after merging resources from a library project
may yield a different ordering to styleable arrays, so have
the indices be non-final too.

Bug:16842410

Change-Id: I0432bea03dc4312d5908a770fc70a11f0a1596ae
2014-08-07 22:37:12 +00:00
Adam Lesinski
833f3ccbc8 AAPT support for feature splits
This change allows the developer to add a base package for
which to build a feature split. The generated resource types
will begin after the base APK's defined types so as not
to collide or override resources.

Multiple features can be generated by first choosing an
arbitrary order for the features. Then for each feature,
the base APK and any preceding features are specified
with the --feature-of flags.

So with a base APK 'A' and features, 'B', and 'C',
'B' would be built with

aapt package [...] --feature-of A [...]

and 'C' would be built with

aapt package [...] --feature-of A --feature-of B [...]

Change-Id: I1be66e3f8df9a737b21c71f8a93685376c7e6780
2014-08-04 18:48:14 -07:00
Adam Lesinski
c2dea8daea Modify base Configuration used for aapt dump badging
Some apps don't provide defaults when providing icons
for different screen sizes, so use a configuration
that has a screen size set to NORMAL.

Change-Id: If4b9eebd37e5d2e2991301d09ff5c39dd41c1565
2014-08-04 16:40:41 -07:00
Chris Craik
8e554924c5 Merge "Add outline alpha" into lmp-dev 2014-07-31 21:44:36 +00:00
Chris Craik
77b5cad3ef Add outline alpha
bug:16140822
bug:16566746

This allows background drawables to alter the opacity of a shadow
being cast with their own alpha values.

Change-Id: I49698cc7c1bf4b2b55ffe2f82899543ca62bc61c
2014-07-31 12:29:57 -07:00
Adam Lesinski
63e646eed5 Add shared library support to aapt dump
AAPT dump should be able to handle dynamic references
that often come with shared library resources.

Bug:16678251
Change-Id: I6c8cd943145aab20ca9db9694c8c433b3c64279b
2014-07-30 21:53:48 +00:00
Adam Lesinski
57079519f4 Fix large memory corruption in AAPT
When assigning a new string pool to a package, don't release the
reference to the old memory immediately, as the cleanup code that
is called after references the old memory.

Bug: 16155257
Change-Id: I3eaeb81191b71a282a0ef82856023f09707f1b17
2014-07-30 18:46:51 +00:00
Adam Lesinski
d7a94da476 Have AEP GL feature depend on GLES 3.1 in badging
AAPT dump badging should output the uses-gl-es tag with
a version of 3.1 when android.hardware.opengles.aep is
declared as a feature.

Change-Id: I8affc6dad574c8303c6ba9810ad8e6e205ea9506
2014-07-25 22:45:33 +00:00
Adam Lesinski
2c72b6822d Add <feature-group> tag and change aapt badging
A <feature-group> represents a set of features required
for an app to be compatible with a device. Multiple
<feature-group> elements represent a logical 'or'
of required features.

Features defined in the old way with <uses-feature> tags
under the <manifest> tag are automatically added to each
feature-group defined.

Defining a <feature-group> means that any default
features are not included (such as android.hardware.touchscreen)
and declared permissions do not imply any features.

Change-Id: I45626f0fdc546e47bcf2aead7ef05ebcca12b023
2014-07-23 14:11:46 -07:00
Jeff Sharkey
78a130144b Mark resource-only splits as hasCode=false.
PackageManagerService now skips dexopt for split APKs that don't
declare they have code.  Also surface more detailed error messages
in logs.

Bug: 14975160
Change-Id: Ie6078dba724815020cee59b7fc52317e88ca097a
2014-07-15 20:18:39 -07:00
Chris Craik
47cd8e921d Implement outline support for nine patches
b/15856895

Nine patches now have outline round rect metadata stored as optional
png tags. aapt generates these automatically by inspecting the bitmap
pixels to estimate outline bounds and round rect radius, based on
opacity.

Change-Id: I226e328a97873010d9e1adb797ac48f93a31183c
2014-07-14 15:01:27 -07:00
Jeff Sharkey
2cfc848226 Add versionCode to split manifest; compile.
To verify consistency at install time, all APK manifests must declare
the same package name and version code.  Also start compiling the
manifest, since versionCode is an attribute.

Bug: 14975160
Change-Id: I2a1a769bd3dfde05b19563af5ca9b6c15a9c95ff
2014-07-09 16:12:49 -07:00
John Spurlock
eb8d1be6ac Add a BIND_DREAM_SERVICE signature-level permission.
Starting in api 21, will be required to bind to a
declared dream or doze service.

Also added to aapt dump badging output.

Bug:15862654
Change-Id: Ifa0a594eeecf21e6146176c7810a847e1d08fe3b
2014-06-27 18:33:42 -04:00
Adam Lesinski
9d5b08ea8c Dump more info about behaviors an APK offers
Behaviors include things like print services,
custom launchers, camera apps, etc.

Bug:13748429

Change-Id: I9fb83bac95b1be61fc630c1e74daf0f4a8b9b27f
2014-06-24 22:07:47 +00:00
Adam Lesinski
f90f2f8dc3 Support multiple resource tables with same package
In order to support APK split features, the resource
table needs to support loading multiple resource
tables with the same package but potentially new set
of type IDs.

This adds some complexity as the type ID space changes
from dense and ordered to potentially sparse.

A ByteBucketArray is used to store the type IDs in
a memory efficient way that allows for fast retrieval.

In addition, the IDMAP format has changed. We no longer
need random access to the type data, since we store the
types differently. However, random access to entries of
a given type is still required.

Change-Id: If6f5be680b405b368941d9c1f2b5d2ddca964160
2014-06-18 19:20:08 +00:00
Jeff Brown
96c2e9f1cb Merge "Add support for @SystemApi annotation to aapt." 2014-06-09 21:05:17 +00:00
Bryan Mawhinney
aa00ae0a67 am 99017c01: Merge "Fix issue preventing aapt from stripping all unwanted densities" into lmp-preview-dev
* commit '99017c01bac525ca4b5b10768052ced398b4a493':
  Fix issue preventing aapt from stripping all unwanted densities
2014-06-09 15:55:43 +00:00
Jeff Brown
eb490d6194 Add support for @SystemApi annotation to aapt.
When aapt sees @SystemApi in the XML comment associated with a resource,
it will now remove this tag from the comment (since is it not meaningful as
a Javadoc tag) and instead add an @android.annotation.SystemApi annotation
to the declared type or member.  This enables easy downstream processing of
this annotation from generated code.

Change-Id: If984908477648c0c90be52fdc955fbb891d99b28
2014-06-06 19:43:42 -07:00
Bryan Mawhinney
b0db8de73e Fix issue preventing aapt from stripping all unwanted densities
Bug: 15463874
Change-Id: I9d1e289f1db2ed3c9a41d91caea6d07b69fcb84f
2014-06-06 13:27:11 +01:00
Adam Lesinski
8ee244355b resolved conflicts for merge of 522c5ce2 to master
Change-Id: I15c7f78e9c81947e33270251d7b50e592fb61583
2014-06-03 13:47:54 -07:00
Adam Lesinski
522c5ce280 am 7e547e0d: Merge "Add --pseudo-localize option to generate resources for pseudolocales."
* commit '7e547e0d72817032737909952f00acc2e777a35a':
  Add --pseudo-localize option to generate resources for pseudolocales.
2014-06-03 20:35:11 +00:00
Igor Viarheichyk
a191d0464f Add --pseudo-localize option to generate resources for pseudolocales.
Update help output with new option, remove mention of obsolete zz_ZZ
pseudolocale.

Change-Id: Ie2cfc8d11ef6a57e2b9a2333514a7340a3a8c075
2014-06-03 12:07:50 -07:00
Adam Lesinski
25e9d55e96 Don't dump data from a bad ResTable
AAPT dumps data from a bad ResTable, which
causes crashes. Prevent this by checking if
there were errors when creating the ResTable.

Bug:14902008
Change-Id: I5e04ebf967c60b78c511dd175785a13bca52f09a
2014-05-19 15:01:43 -07:00