452 Commits

Author SHA1 Message Date
Jeff Davidson
df08d1c24d Add --replace-version flag to aapt.
Motivation: we'd like to programmatically specify the version
name/code (i.e. to include the build number from the build server).
However, this means that we cannot specify version info in the
AndroidManifest.xml file, as this takes precedence. Not doing so makes
IDE use more difficult, as the IDE gets version code 0 and won't
install over an existing non-IDE version unless you first force a
downgrade to an IDE build from the command line.

This flag allows us to specify a very high version code in the
AndroidManifest.xml file, making IDE builds take precedence, while
still allowing us to override this info when performing command-line
(official) builds.

Change-Id: I5d01048698af5c26bdf19066c6cd4eca1115112a
2014-02-25 13:42:12 -08:00
Narayan Kamath
91447d88f2 Extended locales in AAPT / AssetManager.
Support 3 letter language codes, script codes &
variants. The bulk of the changes are related to
the implementation of command line filtering of
locales etc. The previous code assumed that the
value of each "axis" (locale, density, size etc.)
could be represented by a 4 byte type. This is
no longer the case.

This change introduces a new class, AaptLocaleValue
which holds a (normalized) locale parsed from a
directory name or a filter string. This class takes
responsibility for parsing locales as well as
writing them to ResTable_config structures, which is
their representation in the resource table.

This includes minor changes at the java / JNI level
for AssetManager. We now call locale.toLanguageTag()
to give the native layer a well formed BCP-47 tag.
I've removed some duplicated parsing code in
AssetManager.cpp and replaced them with functions on
ResTable_config. The native getLocales function has
been changed to return well formed BCP-47 locales as
well, so that the corresponding java function can use
Locale.forLanguageTag to construct a Locale object
out of it.

Finally, this change introduces default and copy
constructors for ResTable_config to prevent having
to memset() the associated memory to 0 on every
stack allocation.

Change-Id: I899a56a9a182ee6be52b9389d1ae59266f5482e9
2014-02-10 15:50:16 +00:00
Adam Lesinski
94c40a4cf9 resolved conflicts for merge of 1b5b60d6 to master
Change-Id: I2b713a55fcdf02c01afa99f175bf14248f210460
2014-02-04 11:00:03 -08:00
Adam Lesinski
1b5b60d696 am 203356a3: Merge "Add support for multiple asset dirs (-A)" into klp-modular-dev
* commit '203356a34a82bfc759be02dfa1caa4529dce0732':
  Add support for multiple asset dirs (-A)
2014-02-04 18:36:10 +00:00
Adam Lesinski
203356a34a Merge "Add support for multiple asset dirs (-A)" into klp-modular-dev 2014-02-04 18:31:23 +00:00
Narayan Kamath
7c4887f66b Change ResourceType cookies to int32_t.
Also change the order of parameters in ResTable constructors
to avoid ambiguity.

(cherry picked from commit 00b314436f4fdfada4bbf1e79ec12e9fa38aeaf1)

Change-Id: I874c5d03c134dc3c331fba423b5280366296287c
2014-01-31 13:47:27 +00:00
Narayan Kamath
00b314436f Change ResourceType cookies to int32_t.
Also change the order of parameters in ResTable constructors
to avoid ambiguity.

Change-Id: If7bfa1f640dddca39b9f26a3ce84081fa7b6e6e3
2014-01-28 16:27:52 +00:00
Narayan Kamath
f85e41f29a AssetManager cookies are now int32_t, not void*.
Change-Id: Id383e31922ca81c52dad52d422c5c1ab1a1365ce
2014-01-27 10:31:11 -08:00
Bryan Mawhinney
9ab9b93eae Filter unneeded assets from additional resource directories
This change ensures that assets that are not needed for the
preferred density are stripped from additional directories
specified by the -S flag

For simplicity, the logic for deciding which assets are not
needed is still applied per directory, rather than globally,
which may still result in some unneeded assets being included
in the final output.

Bug: 12604267
Change-Id: Ic1378570c2d9cd1c854c507e784233818c19efca
2014-01-27 10:31:10 -08:00
Narayan Kamath
9a9fa163c3 Don't pseudolocalize untranslatable strings.
bug: https://code.google.com/p/android/issues/detail?id=63004

(cherry picked from commit 7e1b8ff3e15b35b92978e572ccbfbc47cedce242)

Change-Id: I99ba1a915ae8fc61f70ce570b782108171d0fcaa
2014-01-27 10:31:10 -08:00
Narayan Kamath
9636071bdc Reimplement ZipFileRO in terms of libziparchive.
This lets us share zip archive processing code with both
the runtime (Art, dalvik) and critical java code
(StrictJarFile).

This change also moves several utility methods to ZipUtils
and dedups code across several zip inflation methods.

One of the side effects of this change is that several
processing loops are now O(n) instead of O(n^2).

bug: 10193060

(cherry picked from commit e9d380f9303692950166472b1dfab083e1af8133)

Change-Id: I53e7d0c0af266cb1fe4e293e1177b2590cc44224
2014-01-27 10:31:09 -08:00
Ying Wang
cd28bd37ea Add new aapt flag --error-on-missing-config-entry
It forces aapt to return an error if aapt fails to find an resource
entry for a configuration.

Bug: 11259444
Change-Id: Ie5674a29dff5d4455e7d7c94f6b25560fb1305b7
2014-01-27 10:31:09 -08:00
Adam Lesinski
58f1f3617c Dump maxSdk of uses-permission during badging
If the manifest specifies a maxSdkVersion for which to
stop granting a certain permission, output that value
when dumping badging.

bug:11630700
Change-Id: I922a3186340383828e1af3ce0815efb407d9d535
2014-01-27 10:31:09 -08:00
Elliott Hughes
b30296b5fd Re-apply several tools fixes lost by the directory rearrangement.
Leaks on error in tools/aapt/Images.cpp.
https://code.google.com/p/android/issues/detail?id=61552

Two missing fclose calls in tools/aapt/Resource.cpp.
https://code.google.com/p/android/issues/detail?id=61553

Missing fclose in tools/aidl/aidl.cpp.
https://code.google.com/p/android/issues/detail?id=61554

Change-Id: I56ce144958296961b77354815efc1a245564594b
2014-01-27 10:31:08 -08:00
Maurice Chu
2675f76967 Escape strings that are output by aapt dump badging
Also, changed getComponentName() to output a String8 object
instead of a const char * because the const char * is an internal
buffer of a String8 object which gets immediately destroyed
after returning from getComponentName().

Bug: 11329761
Change-Id: Ic459dec0ad3b20162c36de0ee492bcc022863b12
2014-01-27 10:31:08 -08:00
Adam Lesinski
8cf6184518 Prune unneeded density resources from APK
When a preferred density is specified, prune all but the
closest matching density when the exact density resource does not
exist.

If a preferred density resource does not exist and a higher density
resource exists, prune all but the resource with the next highest
density relative to the preferred density.

If a preferred density resource does not exist and there is no
higher density resource, prune all but the resource with the next
lowest density relative to the preferred density.

Manual merge of I99b3950fe3d8116a5625968ed383442315ae8526 from
frameworks/base/tools to frameworks/tools

bug:11224465
Change-Id: Idddf55dad27f114ffc429b61317c3a5b1435d808
2014-01-27 10:31:08 -08:00
Maurice Chu
76327314d2 Fix aapt when outputting meta-data tag values
This fixes outputting string as well as not crashing when the
<meta-data> element has an "android:resource" attribute instead
of an "android:value" attribute.

Bug: 11255844
Change-Id: Iadb62b5dcb18ea3db8dbd2ba3241f489606d535d
2014-01-27 10:31:07 -08:00
Adam Lesinski
8ff15b4cad AAPT emits error for res with no 'default' product
Rather than ignoring resources that do not match the specified
product, we keep track of the ignored ones and make sure that
some variant of the resource that matches the product was processed.

bug:10860838
Change-Id: I7a35f37fda2c9561634f75323bd4cb2b9047e29b
2014-01-27 10:31:07 -08:00
Adam Lesinski
94fc9124f5 resolved conflicts for merge of 0c923b7c to master
Change-Id: I4f314b48c7714706329509d931d2c53079f5e248
2014-01-27 10:31:06 -08:00
Adam Lesinski
a5018c900f resolved conflicts for merge of 5223a5ff to master
Change-Id: I6523e4b7df88f21fbe0ecd3ab8f493e5a9867305
2014-01-27 10:31:06 -08:00
Michael Wright
ec4fdec76f Add support for supports-input element to aapt
Change-Id: Ie8c8c44f126383c351f2ebb9ae7c3694fb0a9b16
2014-01-27 10:31:05 -08:00
John Reck
859e19f97d libpng usage tweaks
Bug: 10447005

 Call png_set_interlace_handling explicitly instead of relying on
 implicit handling that logs warnings

 Include filename when printing warnings

Change-Id: Ia343427f5522dc8ab1010f8d7017e86f389caf99
2014-01-27 10:31:05 -08:00
Chet Haase
7cce7bb5d8 Remove scenes from Resource.cpp
Part of the Transition API changes, except that the tools/ directory
got moved between klp and master, so re-making the same changes here.

Issue #10460684 KLP API Review: android.view.transition and android.animation

Change-Id: Icedca1dc689285b4b213f9376656b26f18c7f23e
2014-01-27 10:31:04 -08:00
Adam Lesinski
282e181b58 Revert "Move frameworks/base/tools/ to frameworks/tools/"
This reverts commit 9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.
2014-01-27 10:31:04 -08:00
Narayan Kamath
745d4efc83 AssetManager cookies should be int32_t and not void*.
Cookies are really indices into vectors and arrays, so
they don't need to be void*. We choose int32_t instead
of size_t to allow their width to be well specified.

(cherry picked from commit ebfdd0f467e39c3af8d92cade78263935340acb7)
(cherry picked from commit a7fa2e592e2e579e5acdb903dba83fc074ebc215)
(cherry picked from commit a9d5701b034ed2d9771b3f0943e1add00741d7cd)

Change-Id: I2aed3db568b6fdc487bf99e2c5dd123206736fda
2014-01-27 11:20:24 +00:00
Adam Lesinski
09384303de Add support for multiple asset dirs (-A)
Bug: 12608034
Change-Id: I02c5a1a73b83498d799570428cca3dd914f8ac11
2014-01-23 12:43:42 -08:00
Narayan Kamath
3da645f307 Merge "Don't pseudolocalize untranslatable strings." 2013-12-18 12:46:41 +00:00
Narayan Kamath
d21752dff4 Merge "Reimplement ZipFileRO in terms of libziparchive." 2013-12-11 11:41:10 +00:00
Narayan Kamath
7e1b8ff3e1 Don't pseudolocalize untranslatable strings.
bug: https://code.google.com/p/android/issues/detail?id=63004
Change-Id: I8e47a53d887144dc867111e42313d0e113b83ea1
2013-12-10 13:37:32 +00:00
Narayan Kamath
afd31e0829 Reimplement ZipFileRO in terms of libziparchive.
This lets us share zip archive processing code with both
the runtime (Art, dalvik) and critical java code
(StrictJarFile).

This change also moves several utility methods to ZipUtils
and dedups code across several zip inflation methods.

One of the side effects of this change is that several
processing loops are now O(n) instead of O(n^2).

bug: 10193060

Change-Id: I3c7188496837a47246c4f342e45485a70fef3169
2013-12-09 16:23:16 +00:00
The Android Open Source Project
dbccd44a63 Merge commit 'b873a17ce7be0a9771c24999adca6964431728f6' into HEAD
Change-Id: I938755073e70602cc8f51ce9bd420fdcf870cecd
2013-11-22 11:18:57 -08:00
Elliott Hughes
ed84dea928 am 8f592378: am 69920427: Merge "Fix a variety of small publicly-reported bugs."
* commit '8f592378a1ea7f31d57253dc202f42707ef4da36':
  Fix a variety of small publicly-reported bugs.
2013-10-29 13:35:04 -07:00
Elliott Hughes
c367d48c55 Fix a variety of small publicly-reported bugs.
Possible NULL dereference in cmds/bootanimation/BootAnimation.cpp.
https://code.google.com/p/android/issues/detail?id=61556

Missing fclose in core/jni/android_os_Debug.cpp.
https://code.google.com/p/android/issues/detail?id=61546

Bad loop guards in core/jni/android_util_Process.cpp.
https://code.google.com/p/android/issues/detail?id=61557

Assignment to wrong variable in libs/androidfw/AssetManager.cpp.
https://code.google.com/p/android/issues/detail?id=61560

Missing delete[]s in libs/androidfw/ObbFile.cpp.
https://code.google.com/p/android/issues/detail?id=61549

Leaks on error in tools/aapt/Images.cpp.
https://code.google.com/p/android/issues/detail?id=61552

Two missing fclose calls in tools/aapt/Resource.cpp.
https://code.google.com/p/android/issues/detail?id=61553

Missing fclose in tools/aidl/aidl.cpp.
https://code.google.com/p/android/issues/detail?id=61554

Change-Id: I5820f3824e72d07a9acb776cf0af3e7443f5694a
2013-10-29 13:12:55 -07:00
Adam Lesinski
91b47365f6 am 16e8c4f7: am 7d292145: Merge "Prune unneeded density resources from APK" into klp-dev
* commit '16e8c4f7db87d743410751410c7f761350792fe2':
  Prune unneeded density resources from APK
2013-10-18 13:45:19 -07:00
Adam Lesinski
9438c2df13 Prune unneeded density resources from APK
When a preferred density is specified, prune all but the
closest matching density when the exact density resource does not
exist.

If a preferred density resource does not exist and a higher density
resource exists, prune all but the resource with the next highest
density relative to the preferred density.

If a preferred density resource does not exist and there is no
higher density resource, prune all but the resource with the next
lowest density relative to the preferred density.

bug:11224465
Change-Id: I99b3950fe3d8116a5625968ed383442315ae8526
2013-10-15 17:18:51 -07:00
Adam Lesinski
f2163cb0d1 am ea4e0751: am c884fc9f: Merge "AAPT emits error for res with no \'default\' product" into klp-dev
* commit 'ea4e07518cd1844b1654175ef27cf9501e0dd7eb':
  AAPT emits error for res with no 'default' product
2013-10-07 16:02:13 -07:00
Adam Lesinski
2b8e82fd51 AAPT emits error for res with no 'default' product
Rather than ignoring resources that do not match the specified
product, we keep track of the ignored ones and make sure that
some variant of the resource that matches the product was processed.

bug:10860838
Change-Id: I804cd04a053269a35b7e1c1cc743b77493337bf9
2013-10-04 15:14:09 -07:00
Adam Lesinski
4056c94adf am 0c923b7c: Merge "Add badging of Payment apps" into klp-dev
* commit '0c923b7ce1f4e40b401bcd342f4ee4399f4ad9d7':
  Add badging of Payment apps
2013-09-30 17:09:58 -07:00
Adam Lesinski
db239f91d6 am 5223a5ff: Merge "Add support for dumping new badging" into klp-dev
* commit '5223a5ff24bed6d0a0ac618083a3ed050bdd98b2':
  Add support for dumping new badging
2013-09-30 17:09:54 -07:00
Adam Lesinski
d831e80a2f Add badging of Payment apps
HCE apps that declare themselves as payment apps will receive
that badge when running aapt dump badging.

bug:10899864
Change-Id: I7c095214412465ad7a925285d6167e12de16b600
2013-09-27 11:22:46 -07:00
Adam Lesinski
b1249b822c Add support for dumping new badging
APKs with AccessibilityServices, PrintServices, and or DeviceAdmin
will have those services dumped when running 'aapt dump badging'.

bug:10899864
Change-Id: I9c1f1f36c397b128dca802510368573a54977459
2013-09-27 11:10:37 -07:00
Michael Wright
f17e8ee379 am 86974463: Merge "Added support for supports-input manifest element" into klp-dev
* commit '86974463e9e28108e14fa255efd3c429358c0605':
  Added support for supports-input manifest element
2013-09-05 18:31:04 -07:00
Michael Wright
eaeb190486 Added support for supports-input manifest element
Change-Id: Ifa7c87908081585c1940b5a47fdf5138a287d9ea
2013-09-05 18:15:57 -07:00
Chet Haase
09ed072028 am 49ee555f: Merge "Transition API changes from API council recommendations" into klp-dev
* commit '49ee555f239c79871b661e5ff135061f26665e1c':
  Transition API changes from API council recommendations
2013-09-04 16:49:39 -07:00
Chet Haase
d82c8ac4db Transition API changes from API council recommendations
Issue #10460684 KLP API Review: android.view.transition and android.animation
Issue #10570740 Transitions: inflate transition targets from xml

Change-Id: I7a3f6d3aece2fcafc5efd555d033f79e86635c98
2013-09-04 14:46:38 -07:00
Mike Lockwood
9f6a119c8a Move frameworks/base/tools/ to frameworks/tools/
Change-Id: I3ffafdab27cc4aca256c3a5806b630795b75d5c8
2013-08-28 09:44:17 -07:00
Victoria Lease
c27bc4fbb2 am adae1e91: am 1b8c33c6: Merge "Forward compatibility fixes"
* commit 'adae1e91de4b2be7a67a33e8f3c3161f5cec15e1':
  Forward compatibility fixes
2013-08-27 09:57:26 -07:00
John Reck
e982b7231f Forward compatibility fixes
Change-Id: Iaf387a10c387e5e157bb16d120a1e033b3d1a6e8
2013-08-26 16:53:40 -07:00
Maurice Chu
681c4f45bf Modify 'aapt dump badging' to output <meta-data> tags
This enables output of <meta-data> tags within the <application>
element of the AndroidManifest.xml if the --include-meta-data
command line option is invoked.  For example, by

  aapt dump --include-meta-data badging Foo.apk

Bug: 10257318
Change-Id: I88da1a14ab21146b64ac947e0eeb1107816acd4d
2013-08-21 18:06:50 -07:00
John Reck
6c16fff219 Fixes for libpng 1.6
png_set_filler() now fails if the color type doesn't support
 a filler (such as RGB_ALPHA)
 png_set_unknown_chunk location bug was fixed and now enforces
 proper location setting

Change-Id: If3834e3744d9618c308cc442e66d85e9cffcea38
2013-08-14 14:15:06 -07:00