168 Commits

Author SHA1 Message Date
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
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
Adam Lesinski
89147ed84b Merge "Revert "Fix aapt dump for APKs with no resources"" into lmp-dev 2014-08-15 04:37:53 +00:00
Adam Lesinski
18560886cb Revert "Fix aapt dump for APKs with no resources"
This reverts commit 0e475302cd196f45a01a525c49089018b238d4ba.

I'll re-upload this CL with the correct fix in LoadedApk.

Change-Id: I17c6381f8e5907dab9f996f89c5d435b9c08a13a
2014-08-15 17:18:21 +00:00
Adam Lesinski
4b2d0f20db Fix crash in ResStringPool
When a String isn't found in the StringPool,
we should not try to construct a String8 object
from the NULL string.

Bug:15163956
Change-Id: I51e701918b10a72c18a860b8a36dce2afd9c0b82
2014-08-15 06:39:01 +00:00
Adam Lesinski
e23a91e2bd Fix aapt dump for APKs with no resources
All APKs are expected to have at least one resource table (even if
it is empty). We were missing the creation of an empty DynamicRefTable.

Bug:16895517
Change-Id: I6a6e887f91b3b4bbcc52b3fd2741ef3d05fab1fd
2014-08-14 21:20:41 +00:00
Adam Lesinski
d7df9d7b38 Merge "Fix aapt dump for APKs with no resources" into lmp-dev 2014-08-14 16:46:52 +00:00
Adam Lesinski
8d5667d2a2 Print xxxhdpi from ResTable_config::toString
Change-Id: I2e1a07649cb498c12023b198d8e50534f9d91840
2014-08-14 21:35:37 +00:00
Adam Lesinski
ccf25c7bf6 Fix shared library bug in bag attributes
A ResTable_map entry has a name attribute, which
could be a dynamic reference if it comes from
a shared library. It was not being patched with
the correct package id.

Bug:16795890
Change-Id: Ia8df6a943269b2fefb2132c3ed74eb1997d7701b
2014-08-11 09:16:01 -07: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
f28d505dc5 Ensure the ResTable data is at least the size of a ResTable_header
Change-Id: Ib8d5574bd6a125797a582837987332e66721e84d
2014-07-29 17:42:34 +00:00
Martin Kosiba
7df3625d5b Allow for appending of resources to an AssetManager.
BUG: 11505352
Change-Id: Ifa290580a6dc63c2f471d0bbf5f066db14aed4d7
2014-07-17 18:10:02 +01:00
Elliott Hughes
e8e968a7c6 am 583a845c: am 3964ea46: am d74f99d3: Merge "Switch frameworks/base/libs/androidfw to the new icu."
* commit '583a845c6eb6308d7ada72cb0e91444efc91cc54':
  Switch frameworks/base/libs/androidfw to the new icu.
2014-07-10 00:42:48 +00:00
Elliott Hughes
583a845c6e am 3964ea46: am d74f99d3: Merge "Switch frameworks/base/libs/androidfw to the new icu."
* commit '3964ea46750cd5715f29ad4d9cada4a35208ad7a':
  Switch frameworks/base/libs/androidfw to the new icu.
2014-07-10 00:16:43 +00:00
Elliott Hughes
6a4deeda70 Switch frameworks/base/libs/androidfw to the new icu.
Change-Id: Id82830750dd7e83bbc66811a1133b403cc697c97
2014-07-09 16:58:28 -07:00
Narayan Kamath
10eb3b0665 am e0849423: am 501bb0a5: Merge "Fix issue when converting fil->tl."
* commit 'e0849423214007d4377638fb42db15276e3ca575':
  Fix issue when converting fil->tl.
2014-07-07 10:11:23 +00:00
Narayan Kamath
fec5106c8e Fix issue when converting fil->tl.
We should call ResourceTable::getLocales directly,
and not AssetManager::getLocales. The latter will convert
"tl" to "fil" so we'll end up thinking we have resources
for "fil" when we don't really have any.

bug: 15873165

Change-Id: I9753e4608aaecede328a40ee1f3ee6b016d0dedc
2014-07-07 09:51:01 +01:00
Narayan Kamath
23902f5f4d am 10eb3b06: am e0849423: am 501bb0a5: Merge "Fix issue when converting fil->tl."
* commit '10eb3b0665dd7c636af5f0d657512c1a2e309e0c':
  Fix issue when converting fil->tl.
2014-07-07 10:26:42 +00:00
Nick Kralevich
a00144ca89 resolved conflicts for merge of a8dbd7b4 to master
Change-Id: I90f42546c6d0a8f21af3041e59baf6a226247b1c
2014-07-02 15:41:21 -07:00
Narayan Kamath
a8dbd7b433 am 39e4f590: am f56399f6: Merge "Fall back to "tl" if "fil" is absent."
* commit '39e4f590787246ce35b995c0c0ce37b676a05e0c':
  Fall back to "tl" if "fil" is absent.
2014-07-02 10:09:45 +00:00
Narayan Kamath
e4345dbd2a Fall back to "tl" if "fil" is absent.
For JB-MR1, there was a hack that used "tl" where
we really meant "fil" because ICU didn't have localizations
for "fil". This has now been fixed, and we now support 3 letter
language codes for AAPT so we can use "fil" where required.

For the benefit of apps that need to target older platforms,
we fall back to "tl" if the app has assets for "tl" and the
resource locale is "fil".

See bugs 7291355, 7207176 and 8049507 for more context.

Change-Id: I1ac8502525f99b40f9091d5efd2df33518d47a41
2014-07-02 10:53:43 +01:00
Narayan Kamath
8c1c0a6881 am 7f319c47: am 1dc550fa: Merge "Fix packing of values at offset 16."
* commit '7f319c47c8f5e947638eb1e5e73789ff83123bba':
  Fix packing of values at offset 16.
2014-07-01 10:23:44 +00:00
Narayan Kamath
b297591622 Fix packing of values at offset 16.
Our bitmask for setting the highest bit to 0 for
0b11100000 (0xef) instead of 0b01111111 (0x7f) so
we would end up setting bit 5 of each offset to
zero. Fix this and expand test coverage by adding
a fake language (tgp) that has this bit set in both
its bytes.

This issue was discovered while adding CTS tests for
"tgl".

Change-Id: Ibb6de03000951c907c252049771039ab7466187a
2014-06-30 16:20:27 +01:00
Narayan Kamath
c7400b0ce6 am 8c1c0a68: am 7f319c47: am 1dc550fa: Merge "Fix packing of values at offset 16."
* commit '8c1c0a6881b1507f9ae25d753b64de185a7615b2':
  Fix packing of values at offset 16.
2014-07-01 10:43:41 +00:00
Narayan Kamath
70bf06986a am b20b0629: am 71dfc7e9: Merge "Memory leak in parsePackage"
* commit 'b20b0629c2ea6a8e1f7bebd0791dd21e545a4605':
  Memory leak in parsePackage
2014-06-24 14:26:45 +00:00
Narayan Kamath
71dfc7e9ac Merge "Memory leak in parsePackage" 2014-06-24 06:22:45 +00:00
Henrik Baard
5f7ce10c93 Memory leak in parsePackage
The method parsePackage failes to delete some resources
in case of failures.

Added delete of "package" in the cases that was previously
missed.

Change-Id: I183e9ec5864c5ed18bb48410ab41317cb3d96bda
2014-06-23 14:03:46 +02:00
Adam Lesinski
fb600d60c0 Fix build break in log statement
For logging purposes, a uint32_t was being converted into
a void pointer, which on certain systems would be a conversion
to a different size.

Change-Id: I90af69ab975d84c9c8cbb1cce94ff4e9cc6edcf2
2014-06-18 13:00:28 -07: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
Adam Lesinski
f5cb96cfbb am 51736de1: am 4c488cca: Merge "[Asset Manager] Fix memory leakage bug"
* commit '51736de19a4c225a54cda73754d0f57aa68def4f':
  [Asset Manager] Fix memory leakage bug
2014-06-17 19:13:58 +00:00
Adam Lesinski
7efc0eb163 am f5cb96cf: am 51736de1: am 4c488cca: Merge "[Asset Manager] Fix memory leakage bug"
* commit 'f5cb96cfbbd2a7148b4b337097c94bea3f52d5f3':
  [Asset Manager] Fix memory leakage bug
2014-06-17 19:21:56 +00:00
sean_lu
7c57d23371 [Asset Manager] Fix memory leakage bug
Symptom: memory leakage
Root Cause: new SortedVector but not free it in native cpp
Solution: free the SortedVector
Project: AOSP
Note:

Change-Id: Iab5a7f2e8d8509631301e7231427927d4797c856
2014-06-16 15:11:29 +08:00
Adam Lesinski
961dda7796 Creating an empty package should be succesfull
Bug: 15473436
Change-Id: I788deb21a1298281c508429bab635aa713803984
2014-06-09 17:10:29 -07:00
Adam Lesinski
7322ea7b73 Fix potential crash in libandroidfw
A malformed APK may cause a crash if it
encodes its chunk size as a signed number
(MSB set to 1).

Bug:14898892
Change-Id: I342853c2b0859e5be15d712d451323afc367d329
2014-05-14 11:46:19 -07:00
Adam Lesinski
fab50875b9 Add support for building split APKs
Build multiple APKs, each containing a disjoint subset
of configurations. These can then be loaded into the device
AssetManager and should operate as if they were never split.

Use the idea of building multiple sets of files, where each
set represents an APK. An ApkBuilder can place files
in a set based on its configuration, but you can actually
add directly to a set, in the case of the resources.arsc and
generated AndroidManifest.xml for splits.

Change-Id: Ic65d3f0ac1bbd290185695b9971d425c85ab1de3
2014-05-11 18:30:12 -07:00
John Spurlock
0a0454fdcc am 642421aa: am 5c31e487: Merge "Introduce new UI_MODE_TYPE_WATCH and qualifier." into klp-modular-dev
* commit '642421aa7f284817cc1a972a7f9c7a64696a0116':
  Introduce new UI_MODE_TYPE_WATCH and qualifier.
2014-04-04 19:34:11 +00:00
John Spurlock
642421aa7f am 5c31e487: Merge "Introduce new UI_MODE_TYPE_WATCH and qualifier." into klp-modular-dev
* commit '5c31e487c4577e1c47ee7c949325d6a13f0d462e':
  Introduce new UI_MODE_TYPE_WATCH and qualifier.
2014-04-04 19:28:09 +00:00
John Spurlock
6c191299a7 Introduce new UI_MODE_TYPE_WATCH and qualifier.
Default ui mode to watch if we have FEATURE_WATCH.

Bug:13395758
Change-Id: Ie5ff95de60e69e91ad3612c7d2f1fca7f49061bd
2014-04-04 15:21:53 -04:00
Narayan Kamath
ecd072161e resolved conflicts for merge of 22d07464 to master
Change-Id: Ic037261eedd6e224938c960d2b4597590c81ed9d
2014-03-27 14:22:47 +00:00
Ashok Bhat
f5df700e6c AArch64: Make frameworks/base code more portable
Changes in this patch include

[x] Use %zu for size_t, %zd for ssize_t

[x] Some minor changes have been done to conform with
    standard JNI practice (e.g. use of jint instead of int
    in JNI function prototypes)

Change-Id: Id1aaa7894a7d0b85ac7ecd7b2bfd8cc40374261f
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
2014-03-27 12:30:42 +00:00
Adam Lesinski
de898ff429 Shared library resource support
Shared libraries can now export resources for applications
to use.

Exporting resources works the same way the framework exports
resources, by defining the public symbols in res/values/public.xml.

Building a shared library requires aapt to be invoked with the
--shared-lib option. Shared libraries will be assigned a package
ID of 0x00 at build-time. At runtime, all loaded shared libraries
will be assigned a new package ID.

Currently, shared libraries should not import other shared libraries,
as those dependencies will not be loaded at runtime.

At runtime, reflection is used to update the package ID of resource
symbols in the shared library's R class file. The package name of
the R class file is assumed to be the same as the shared library's
package name declared in its manifest. This will be customizable in
a future commit.

See /tests/SharedLibrary/ for examples of a shared library and its
client.

Bug:12724178
Change-Id: I60c0cb8ab87849f8f8a1a13431562fe8603020a7
2014-03-25 12:09:56 -07:00
Mark Salyzyn
7e9e305994 am 9ca25502: am 48250e14: am 9a09a523: am 0b472ae1: Merge "androidfw: resolve 64-bit build issues"
* commit '9ca25502c05854288733ee5142e8bf6594821f83':
  androidfw: resolve 64-bit build issues
2014-03-19 19:58:00 +00:00
Mark Salyzyn
00adb8685e androidfw: resolve 64-bit build issues
- uid_t/gid_t cast to unsigned long
- unused argument warnings
- tab and space requirements

Change-Id: Ib446d8165b9082be02edb55e6b71fd1a03ea3431
2014-03-19 11:11:14 -07:00
Narayan Kamath
b5c4e7fd38 resolved conflicts for merge of 92860a74 to master
Change-Id: I3036ef9f1251c756092dc5ee2c4fed8146855e1e
2014-03-10 10:57:05 +00:00
Narayan Kamath
6381dd4ff2 LP64: Make 9 patches architecture agnostic.
The Res_png_9patch struct had several pointer members
whose size differed between 32 and 64 bit platforms.

These members have been replaced by uint32_t offsets
to serialized data. The serialized form for 9patches
places a Res_png_9patch object at the beginning of
serialized data, followed by int32_t arrays of xDivs,
yDivs and colors.

Note that these offsets are not strictly required,
since they can be computed from the values of numXDivs,
numYDivs & numColors, however they are called in tight
loops so having them computed once is a beneficial.

This change also removed the unused patch_equals function
from aapt's Image.cpp.

Change-Id: I3b9ac8ae5c05510d41377cae4dff1c69b40c2531
2014-03-10 10:00:02 +00:00
Narayan Kamath
e0d10cd923 am d8ccf8b7: am be094d89: am 8fb22ae7: am eee2c72f: Merge "Various format string fixes for 64bit"
* commit 'd8ccf8b789461e1706d10df44d109849fa974fc5':
  Various format string fixes for 64bit
2014-02-28 13:53:15 +00:00
Kévin PETIT
95ece35c2f Various format string fixes for 64bit
Change-Id: I74532a4e0400033f5ee3e3f6827ac42f77d16f53
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
2014-02-24 17:39:46 +00:00
Christopher Tate
b048c33d5b Don't assume that we're at start of file at ctor time
BackupDataReader / BackupDataWriter were implicitly assuming that when
instantiated, the underlying fd was positioned at start-of-file.  If one
tried to e.g. open an existing data stream to append further data to it,
things might randomly fail (at read time, possibly when consuming the
stream later) due to incorrect alignment of the data entities: the
appending writer would assume that no padding was needed to achieve
correct alignment, and this might easily be false.

Now the underlying native reader/writer helpers recognize the true
position within the file when constructed, and as a result it's now
safe to e.g. construct a BackupDataOutput for an existing file and
then append to it.

Change-Id: If0484921e687852f923a4b4efabff573a6c16981
2014-02-21 12:58:04 -08:00
Narayan Kamath
f9bf991cb5 am bcb433b4: am b1903653: am 128599e4: am 2b3c14bf: Merge "libandroidfw: fix build error for 64-bit"
* commit 'bcb433b43acb424ff7bc6afab03ce12d8cc9a198':
  libandroidfw: fix build error for 64-bit
2014-02-20 21:28:09 +00:00
Patrik Bannura
443dd9313f libandroidfw: fix build error for 64-bit
Fixed casting int to pointer in logging code.
Previously ints where printed as pointers and
the %p format specifier was used for convenience
to get hex output. This change uses %x and also
gets rid of the casts.

Change-Id: Ia2539769d245f50c0f3884119f80682defe69d61
2014-02-20 10:06:23 +00:00