574 Commits

Author SHA1 Message Date
Adam Lesinski
f1f179a765 Merge "AAPT: Copy android:revisionCode to Splits" into lmp-mr1-dev 2014-12-16 17:50:04 +00:00
Adam Lesinski
54de298c01 AAPT: Copy android:revisionCode to Splits
Bug:18706179
Change-Id: I669b56e0b67dd1bfda7749ef433b55af16851154
2014-12-16 09:16:26 -08:00
Adam Lesinski
0f0e85a689 Merge "AAPT: attributes showing up after v21 attributes would be removed for pre-21 devices" into lmp-mr1-dev 2014-12-15 23:35:23 +00:00
Adam Lesinski
ea4e5ecc27 AAPT: attributes showing up after v21 attributes would be removed for pre-21 devices
There was an inconsistency in the indexing when removing attributes
in layouts. Now we account for that shift that happens when you delete
an attribute.

Bug:18707321
Change-Id: I656eee3fb614168fa8ceeff379e8594708961dad
2014-12-10 15:55:27 -08:00
Adam Lesinski
73a05114b0 AAPT: Dump status of required flag for uses-feature
Outside of a feature-group, the legacy uses-feature tag
has a boolean required flag that should be emitted in
dump badging.

Bug:17790999
Change-Id: I43023af00e9c9ed4bc35795c3a983fc719bf9b7a
2014-12-08 15:54:12 -08:00
Adam Lesinski
720beef28d Merge "AAPT: Move private attrs to new type for framework" into lmp-mr1-dev 2014-12-04 18:24:41 +00:00
Adam Lesinski
9b624c186c AAPT: Move private attrs to new type for framework
Private attributes are typically placed after public
attributes in the resource table. Each time a new version
of the Android framework is released, new public attributes
take the place of the private attributes, and the private
attributes are shifted after the new public ones.

This means that any apps built against the newer SDK
may inadvertently be using private attributes on older
devices.

This change moves all private attributes to a completely
different type ID, so there will never be collisions across
versions.

These private attributes are automatically moved to a synthesized
type only for the system resources.

Bug:18263655

Change-Id: I7a850512953fadcc9f3524d509cea30249782db8
2014-12-03 15:59:20 -08:00
Adam Lesinski
62c5df52e7 AAPT: Add pathMotion custom classes to Proguard Keep set
Bug:18590044
Change-Id: Ia5dbf55317d2cc89826316e8d10f031b5d340e57
2014-12-02 16:23:59 -08:00
Adam Lesinski
4c488ff931 AAPT: Add custom transition classes to Proguard keep set
Bug:18590044
Change-Id: Ib24831e669a09f0e6f32434081c0e2499702399c
2014-12-02 15:40:17 -08:00
Adam Lesinski
a2bb565db5 AAPT: Ignore densities specified in -c flag
The --preferred-density flag knows how to handle missing resources of
specific densities. Using -c with a density leads to missing resources.

Change-Id: I2251d842f48c08ed083663bb7ed608e14c4983c8
2014-11-10 17:56:11 -08:00
Adam Lesinski
dcdfe9fef4 split-select: Fix rules generated for anydpi density
Change-Id: I9de569ca9a76eb22df4d0e178df847ba1c7d0b01
2014-11-06 14:57:34 -08:00
Adam Lesinski
de7de47fef Add error checking to aapt for split generation
Change-Id: Ica627db6a671f6a6c35f98bfd9c03598ffe103ce
2014-11-03 15:55:44 -08:00
Adam Lesinski
f7ffcaa7a4 Merge "Build the split-select tool without C++11 support" into lmp-mr1-dev 2014-11-03 23:38:56 +00:00
Adam Lesinski
c3dc0b57b8 Build the split-select tool without C++11 support
It was complicated to get the tool building on Windows, Linux,
and OSX with C++11 support.

OSX uses Clang to build C++11 binaries, which requires the libc++
standard library. Since most of the dependencies of this program
are built against libstdc++, this was difficult to resolve.

Now we build without C++11 support.

Change-Id: I4e537c113734508a8f480a1c402ed237de4f0e60
2014-11-03 12:09:58 -08:00
Adam Lesinski
4bf58108d4 Fix issues that will be present in C++11
- char16_t is a distinct type, so stay consistent
  with it throughout the code base.
- char16_t is defined as minimum size of 16 bits.
  Since we mmap and cast data structures onto raw memory,
  we need a precise definition (uint16_t), so we cast between
  that (and static_assert that they are the same size).

Change-Id: I869c32637543bbcfb39d2643e7d9df10d33acd3c
2014-11-03 11:49:47 -08:00
Tim Kilbourn
d9b1cad71e aapt updates for Android TV
- Output whether an app claims to be a game (android:isGame)
- Output android:banner if it is specified at the application level.

Change-Id: I7118b524f62cdfc4effeef21b32b3cdd814d9bfa
2014-10-24 12:59:24 -07:00
Adam Lesinski
40e8eefbed First commit of split-select tool
This tool emits a set of rules as JSON for when a Split APK
should match a target device.

Change-Id: I8bfbdfbdb51efcfc645889dd03e1961f16e39645
2014-10-23 10:39:31 -07:00
Adam Lesinski
6dfe03ae6c am 73a8c596: am 3f8c7dec: Merge "AAPT: Fix path for final generated resources on Windows" into lmp-dev
* commit '73a8c5962d4d28a2e8aa6fa0b0b18e39782ee79c':
  AAPT: Fix path for final generated resources on Windows
2014-10-20 21:05:04 +00:00
Adam Lesinski
aff7c2447d AAPT: Fix path for final generated resources on Windows
Change-Id: Id11ac79b281b51747c73f90406ebd60023c54f92
2014-10-20 12:15:25 -07:00
Adam Lesinski
effd416ee3 am 83fae208: am 3cd840f4: Merge "AAPT: Fix an issue where a resource name was incorrectly derived on Windows" into lmp-dev
* commit '83fae208fee402d8a6a51362f99660f9a49bd5a4':
  AAPT: Fix an issue where a resource name was incorrectly derived on Windows
2014-10-17 23:01:44 +00:00
Adam Lesinski
9306a474e1 AAPT: Fix an issue where a resource name was incorrectly derived on Windows
Calling String8::getLeaf() will assume the system's file path separator,
however the source string was already converted to a unix path.
getLeaf() would therefore not find any occurence of '\' and would
return the full path.

Bug:18036805
Change-Id: Ic2bfac0cc553406740204a296327e266b05c0eff
2014-10-17 21:46:52 +00:00
Adam Lesinski
9086562a6a Minor resource notation/compatibility fixes
- Change the format of mnc/mcc when printing a resource-qualifier
  formatted string from a Configuration object.
- Correctly bump the SDK to 21 when using anydpi in a resource qualifier.

Change-Id: I3c31e344dc5384d45398d6e9f264a073abab65d1
2014-10-17 01:21:50 +00:00
Jerome Dochez
f47f885517 Merge "Added a daemon mode to aapt to receive streams of commands from gradle." into lmp-dev 2014-10-10 19:21:49 +00:00
Adam Lesinski
f15de2e215 AAPT: Gate v21 resource synthesizing logging behind -v flag
This is verbose information and should be hidden behind the -v flag.

Bug:17822471
Change-Id: I36e2c6beb54669a31cde73416427477a80ded8a6
2014-10-03 14:57:28 -07:00
Jerome Dochez
6f1280cf17 Added a daemon mode to aapt to receive streams of commands from gradle.
When crunching png, we used to spawn a separate aapt process from java
which is slow and resource intensive.
Introduced a daemon mode to appt which when invoked with -m parameter
will listen from commands on stdin and give report of command execution
on stdout.

One one command is supported so far :
s f1 f2

This command perform a single png crunch, f1 pointing to the input
png file to crunch, and f2 pointing to the path for the resulting
crunced file.

Expected output from the command is "Done" or "Error".

Change-Id: Iaf1d865e8d5ee5d36abe39dea6443715865a98d3
2014-10-02 15:43:55 -07:00
Andrew Hsieh
c9d32390e5 include direct.h for _mkdir
Bug: 14416410

The new mingw-w64 toolchain x86_64-w64-mingw32-4.8 no longer
declares _mkdir in io.h.

Change-Id: I624b52d2f35db54a7f28df09f997fc883b0f0557
2014-09-30 02:28:05 -07:00
Adam Lesinski
978ab9d929 AAPT: Fix issue with synthesized resource not actually showing up
AAPT keeps around a few pieces of state that are disjoint, so
simply adding to a collection won't add the resource to the final
flattened output. Instead, we create the resource from the top
and then copy over the values into the newly created resource.

Bug:17647890
Change-Id: I214263e84c18f9370c6e6a5aa53aa2d833fc842d
2014-09-24 19:02:52 -07:00
Adam Lesinski
e572c011fe AAPT: Continuation of public/private attribute fix
XML files like layouts are now scanned and checked
for v21 attributes. If those kinds of attributes
are found, then we remove them in the original
version and synthesize a new xml file under the
v21 configuration.

Bug:17520380
Change-Id: Icf984cb96134180a2e35349c1dbf2cef9a8f0bda
2014-09-22 10:51:20 -07:00
Adam Lesinski
82a2dd8efe Fix backwards compat problem with AAPT public attrs
AAPT has traditionally assigned resource IDs to public attributes,
and then followed those public definitions with private attributes.

--- PUBLIC ---
| 0x01010234 | attr/color
| 0x01010235 | attr/background

--- PRIVATE ---
| 0x01010236 | attr/secret
| 0x01010237 | attr/shhh

Each release, when attributes are added, they take the place of the private
attributes and the private attributes are shifted down again.

--- PUBLIC ---
| 0x01010234 | attr/color
| 0x01010235 | attr/background
| 0x01010236 | attr/shinyNewAttr
| 0x01010237 | attr/highlyValuedFeature

--- PRIVATE ---
| 0x01010238 | attr/secret
| 0x01010239 | attr/shhh

Platform code may look for private attributes set in a theme. If an app
compiled against a newer version of the platform uses a new public
attribute that happens to have the same ID as the private attribute
the older platform is expecting, then the behavior is undefined.

We get around this by detecting any newly defined attributes (in L),
copy the resource into a -v21 qualified resource, and delete the
attribute from the original resource. This ensures that older platforms
don't see the new attribute, but when running on L+ platforms, the
attribute will be respected.

We still need to address this problem in the platform moving forward,
as this will only help us in the transition from pre L to L.

Bug:17520380
Change-Id: Ia2a985798b50006c21c7c3431d30d9598f27cd91
2014-09-18 14:05:24 -07:00
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