190 Commits

Author SHA1 Message Date
Alan Viverette
11be9317ef AAPT v1 embed compile SDK version and codename into app
Also adds support for dumping compile SDK attributes.

Bug: 63388434
Fixes: 68854953
Test: manual, compiled & dumped ApiDemos APK
Change-Id: I2eef812bd957950cdef5f1257b73b57044a1e731
2017-12-04 17:37:28 -08:00
Donald Chai
d1ac6e1f9e AAPT: treat "-I" with lower precedence than main APK for dumping.
This is the desired behavior if resource IDs may overlap, and also happens to
improve the behavior of:

  aapt dump -I base.apk badging feature.apk

when both APKs use the same package name with different package IDs
(base=0x7F, feature=0x80).  Previously, the final call to
DynamicRefTable::addMapping was for base.apk, and all references to 0x80 were
rewritten in DynamicRefTable::lookupResourceId to 0x7F.  After this
change resources defined in both APKs are resolved correctly.

Note that this is a bit of kludge, and APKs should use different names
to avoid conflating the package IDs.

Fixes: 67070085
Bug: 64058531
Test: manual with sample in b/67070085#comment2
Change-Id: I285adb6f44a297440b08fc7a1f9ad73c700eb9bc
2017-10-12 21:34:22 -07:00
Dan Willemsen
896f01879b Don't compile libaapt with the build number
Only do that for the aapt binary itself. This will allow libaapt to be
converted to Soong.

Also remove a few lines that weren't doing anything: aaptCppflags was
never set, LOCAL_C_INCLUDES := $(LOCAL_PATH) is implied.

Test: m aapt
Test: aapt version
Change-Id: Ia3bcece14921417e1bfd3406630961c013bd497c
2017-09-08 22:58:56 -07:00
Adam Lesinski
57fe48389f AAPT: Allow including dependencies in dump command
Feature splits depend on their base. The dump badging command
does resource resolution, and needs to be able to find resources
located in the base APK of a feature split.

Bug: 38038608
Test: manual
Change-Id: I8c22f0083c46a853a3a56a4049715409ac2723fe
2017-05-10 15:42:22 -07:00
Guang Zhu
8c2df71739 Revert "AAPT: Version <adaptive-icon> to v26"
Bug: 36462965
Bug: 35908647

This reverts commit c7614e5d1e8f9139cccf6ab9b78dda16b98f7656.

Change-Id: I25279e7c53823dad0703c7e2ea8ff91bdbc1a0f2
2017-03-21 03:53:43 +00:00
Adam Lesinski
c7614e5d1e AAPT: Version <adaptive-icon> to v26
Bug: 35908647
Change-Id: I307fb2f666cb8519adb9a7f676b87706dc6c683f
Test: manual
2017-03-16 16:54:23 -07:00
Dianne Hackborn
cd154e9535 Implement issue #34842682: Add ability to limit permissions based on features
Two new attributes for <uses-permission>: android:requiredFeature and
android:requiredNotFeature.

Also update aapt to include this information in badging:

uses-permission: name='android.content.cts.REQUIRED_NOT_FEATURE_UNDEFINED' requiredNotFeature='android.software.cts.undefined'
uses-permission: name='android.content.cts.REQUIRED_MULTI_DENY' requiredFeature='android.software.cts.undefined' requiredNotFeature='android.software.cts'

Test: new PermissionFeatureTest suite.

Change-Id: Icc1f815a4675ae9dd2cb7f61730ab28b5c11228a
2017-03-01 12:40:57 -08:00
Adam Lesinski
2386df23ac AAPT: Dump maxSdkVersion for implicit permissions
Bug: 32599997
Test: Manual
Change-Id: I13bdcf097625e3cb5fb35da1eb2544b0f8906e79
2016-12-28 16:07:24 -05:00
Adam Lesinski
fcb5f7bf36 AAPT: fix error message
Test: none
Bug:9779154
Change-Id: Iebda7d4f0061cdc51db0103977195964fcc1211d
2016-11-02 13:17:10 -07:00
Adam Lesinski
a77685fa59 Remove unused methods from AssetManager.cpp
A lot of the vendor/locale specific code existed pre-1.0
and was reworked into the current system.

Test: refactoring CL, all code except setLocale() was not being executed.
Test: setLocale() change tested manually
Change-Id: Ifb098f9808763a6cf5fb4336e089430adc09e198
2016-10-03 16:33:12 -07:00
Adam Lesinski
fd2cfb17e8 AAPT: Don't imply specific location hardware for dump badging am: 43158773b4 am: 7f56759cfd
am: 5c60cb9208

Change-Id: I7251036c3212a576fb68023d05687d0e10a9f6b5
2016-09-22 06:52:45 +00:00
Adam Lesinski
5c60cb9208 AAPT: Don't imply specific location hardware for dump badging am: 43158773b4
am: 7f56759cfd

Change-Id: Id54d729793267634f1ade9073395ed6d6921ce60
2016-09-22 05:40:44 +00:00
Adam Lesinski
43158773b4 AAPT: Don't imply specific location hardware for dump badging
Permissions such as android.permission.ACCESS_FINE_LOCATION
and android.permission.ACCESS_COARSE_LOCATION assumed the underlying feature
technology and aapt dump badging would emit an implied feature.

This is no longer accurate, so the only implied feature is on the general
android.hardware.location when the target SDK of the app is 21+.

Bug:25218770
Change-Id: Ica9ebf7d4f360b137af54a8c8fd6c0358cd9be6a
2016-09-21 17:52:58 -07:00
Chih-Hung Hsieh
84717d4118 resolve merge conflicts of 17bd236 to stage-aosp-master am: b3d46b44a3
am: c76aa69207

Change-Id: I6bb066d131dde297612c5dcbf5051f4964e62a8b
2016-08-12 19:35:08 +00:00
Chih-Hung Hsieh
b3d46b44a3 resolve merge conflicts of 17bd236 to stage-aosp-master
Change-Id: I08d4500aaa378b08d41e8d046c62101e08dbfba8
2016-08-12 11:44:16 -07:00
Chih-Hung Hsieh
8bd37ba458 Fix clang-tidy warnings in aapt and aapt2.
* Add explicit keyword to conversion constructors.
* Add NOLINT(implicit) comments for implicit conversion constructors.
Bug: 28341362
* Use const reference type for read-only parameters.
Bug: 30407689
* Use const reference type to avoid unnecessary copy.
Bug: 30413862
Test: build with WITH_TIDY=1

Change-Id: Id6d21961f313a1ad92b15a37fdaa5be9e8ab48e1
Merged-In: Id6d21961f313a1ad92b15a37fdaa5be9e8ab48e1
2016-08-11 15:20:10 -07:00
Chih-Hung Hsieh
9b8528fee4 Fix clang-tidy warnings in aapt and aapt2.
* Add explicit keyword to conversion constructors.
* Add NOLINT(implicit) comments for implicit conversion constructors.
Bug: 28341362
* Use const reference type for read-only parameters.
Bug: 30407689
* Use const reference type to avoid unnecessary copy.
Bug: 30413862
Test: build with WITH_TIDY=1

Change-Id: Id6d21961f313a1ad92b15a37fdaa5be9e8ab48e1
2016-08-11 15:16:41 -07:00
Adam Lesinski
72979573d9 AAPT: faketouch feature implied if no touchscreen feature requested. am: ca955a4c3a am: 76cbcd495e
am: 12e5b87771

Change-Id: Idf7c77d4122ab88b0fe1a1b3c42a196fd532d45c
2016-08-02 02:57:35 +00:00
Adam Lesinski
ca955a4c3a AAPT: faketouch feature implied if no touchscreen feature requested.
This changes the default implied feature of 'android.hardware.touchscreen'
to 'android.hardware.faketouch' if no 'android.hardware.touchscreen'
feature is requested, required or otherwise.

Bug:30571641
Change-Id: I1e41242d4b1dc549cf69741d2a309baf476d084e
2016-08-01 17:20:28 -07:00
Adam Lesinski
10de3af152 AAPT: Improve debuggability of aapt dump badging errors
AAPT dump badging errors have been cryptic and difficult
to debug for app developers. Added some line info to the
error statements.

Change-Id: Ieeeb903a1274a91b77329b445e0248b1e67c9568
2016-07-13 17:55:36 -07:00
Chih-Hung Hsieh
d53e3bed1c Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I080090d50f1a368a4e7c1a0732297bb6a295e34f
2016-05-03 10:02:51 -07:00
Adam Lesinski
0d9f32da56 Merge "AAPT: ProGuard config for components in main dex." am: da66fa7526
am: 1d58c18081

* commit '1d58c18081a2f17afc964de2f261a699e11d6f02':
  AAPT: ProGuard config for components in main dex.

Change-Id: I156e1805ad64798be891747a81561589d9543424
2016-04-28 20:18:21 +00:00
Rohit Agrawal
682583c890 AAPT: ProGuard config for components in main dex.
Create an analogue of "aapt -G" which outputs a proguard configuration
that keeps only components which need to be in the main dex.

Bug: 27383099
Bug: 28425556

Change-Id: Ic18c8c563794ff27a5598a214111d1b446a005f1
(cherry picked from commit 86229cb622fccde8ab8cbe85eead91a34313a708)
2016-04-27 19:50:55 +00:00
Rohit Agrawal
6ba873faec AAPT: ProGuard config for components in main dex.
Create an analogue of "aapt -G" which outputs a proguard configuration
that keeps only components which need to be in the main dex.

BUG: 27383099

Change-Id: Ic18c8c563794ff27a5598a214111d1b446a005f1
(cherry picked from commit 86229cb622fccde8ab8cbe85eead91a34313a708)
2016-04-27 11:26:55 -07:00
Rohit Agrawal
86229cb622 AAPT: ProGuard config for components in main dex.
Create an analogue of "aapt -G" which outputs a proguard configuration
that keeps only components which need to be in the main dex.

BUG: 27383099

Change-Id: Ic18c8c563794ff27a5598a214111d1b446a005f1
2016-04-21 18:00:53 -07:00
Adam Lesinski
694d0a7dfd AAPT: Dump uses-feature version in dump badging
Bug:27162500
Change-Id: I4f82cdd8ef1801c92d4ea6b4bb982c6e7d91edb5
2016-04-06 16:40:23 -07:00
Adam Lesinski
087e0fcba6 DO NOT MERGE: AAPT: Dump uses-permission-sdk-23 am: b2c5155638 am: 40d1ab91d2 am: 8c9209183f am: 7f5ad22330
am: 1f7a36b8e6

* commit '1f7a36b8e6aa55dcb22a63c250fb318260ac349f':
  DO NOT MERGE: AAPT: Dump uses-permission-sdk-23
2015-12-16 23:44:25 +00:00
Adam Lesinski
b2c5155638 DO NOT MERGE: AAPT: Dump uses-permission-sdk-23
Include <uses-permission-sdk-23> permissions in dump badging and dump permissions.

This will also add implied features for that permission, marked as -sdk-23 features.

Ex:

uses-permission: name='android.permission.ACCESS_FINE_LOCATION'
uses-permission-sdk-23: name='android.permission.CAMERA'

feature-group: label=''
  uses-feature: name='android.hardware.location'
  uses-implied-feature: name='android.hardware.location' reason='...'
  uses-feature-sdk-23: name='android.hardware.camera'
  uses-implied-feature-sdk-23: name='android.hardware.camera' reason='...'

Bug:24939655
Change-Id: Ifb374696ed4760b0ba2f1cc3516f3bf08e6cb6a3
(cherry picked from commit 5f3b2ecb3e9d27e77bd59c7b9006a6239b773944)
2015-12-16 22:43:07 +00:00
Adam Lesinski
5f3b2ecb3e AAPT: Dump uses-permission-sdk-23
Include <uses-permission-sdk-23> permissions in dump badging and dump permissions.

This will also add implied features for that permission, marked as -sdk-23 features.

Ex:

uses-permission: name='android.permission.ACCESS_FINE_LOCATION'
uses-permission-sdk-23: name='android.permission.CAMERA'

feature-group: label=''
  uses-feature: name='android.hardware.location'
  uses-implied-feature: name='android.hardware.location' reason='...'
  uses-feature-sdk-23: name='android.hardware.camera'
  uses-implied-feature-sdk-23: name='android.hardware.camera' reason='...'

Bug:24939655
Change-Id: Ifb374696ed4760b0ba2f1cc3516f3bf08e6cb6a3
2015-12-10 14:17:52 -08:00
Tao Bai
a6d7e3fb9c Load app resource as shared library.
- Added aapt command line flag --app-as-shared-lib to build app resources
  that could be loaded as shared lib at runtime.
- Added new method AssetManager.addAssetPathAsSharedLibrary() to load an
  app resource as shared library.

Bug 22487604

Change-Id: Ib9b33c35f9c2b7129f3ba205de03d4564623ea39
2015-09-08 18:48:42 -07:00
Elliott Hughes
ba3fe56edc Lose HAVE_ANDROID_OS from frameworks/base.
Change-Id: I713881fdbaec7cbbb5e7f2f4be6f9b8be3d2ca4e
2015-08-12 14:49:53 -07:00
Chris Warrington
4308c2aea4 am 510c24e8: Merge "Fix AAPT daemon mode with paths containg spaces." into lmp-mr1-dev
automerge: 4499888

* commit '449988872be61f273c91db13069d5b7172429032':
  Fix AAPT daemon mode with paths containg spaces.
2015-02-10 20:14:44 +00:00
Chris Warrington
de3ab0a9e8 Fix AAPT daemon mode with paths containg spaces.
Use new line as a delimiter rather than space.
Fixes: https://code.google.com/p/android/issues/detail?id=135757
Gradle CL: https://android-review.googlesource.com/130423

Change-Id: I7c73e680b0417b0e7cff9e0110822675c53ae20f
2015-02-09 21:20:52 -08:00
Adam Lesinski
55188f5918 am c765655a: am fbba9b57: Merge "AAPT: Dump status of required flag for uses-feature" into lmp-mr1-dev
* commit 'c765655ae1ae35f9d5f0958295f0b71270132ca7':
  AAPT: Dump status of required flag for uses-feature
2014-12-09 00:43:14 +00: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
Tim Kilbourn
a9aecc0c29 Merge "aapt updates for Android TV" into lmp-mr1-dev automerge: 6af7d76
automerge: 181c18e

* commit '181c18efd438f7a5e8cc18327367c49bf51795be':
  aapt updates for Android TV
2014-10-24 21:24:59 +00: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
Jerome Dochez
b51644c3c7 am e36550dc: am 0757e5fd: am c9c512e0: am f47f8855: Merge "Added a daemon mode to aapt to receive streams of commands from gradle." into lmp-dev
* commit 'e36550dc9e202450d0921bf65d00d14e7e3e8a54':
  Added a daemon mode to aapt to receive streams of commands from gradle.
2014-10-10 23:21:01 +00: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
Andreas Gampe
5e77475b5d am 152d9aae: am 31629651: Merge "Frameworks/base: Fix more aapt issues"
* commit '152d9aae631381ea28f5701168d372a1486a7502':
  Frameworks/base: Fix more aapt issues
2014-10-02 12:31:16 +00:00
Andreas Gampe
b8dc7bc582 Frameworks/base: Fix more aapt issues
Change-Id: I6da7dc674e9f9e3b0886a3cfd1e3194d6b5ac948
2014-10-01 20:42:00 -07:00
Marcin Kosiba
0bdcb84b55 am 972628dc: am 5128e88e: Merge "Don\'t use reflection when generating the onResourcesLoaded callback." into lmp-dev
* commit '972628dc8c63b02b75f9e976b3ab67e3913da1a8':
  Don't use reflection when generating the onResourcesLoaded callback.
2014-09-11 18:49:07 +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
Dan Albert
6800165351 resolved conflicts for merge of 1d99636f to lmp-dev-plus-aosp
Change-Id: Ic5f808de7d9722056112c6a73c718892e00bc9df
2014-09-09 09:51:01 -07:00
Dan Albert
8085477fb9 Merge "Don't check for null references." 2014-09-09 16:25:41 +00:00
Dan Albert
a8995adc2b Don't check for null references.
The address of a reference will never be null in well formed C++ code.
The function returning the value being checked simply returns a
dereferenced pointer (which is just going to segfault if it is null!).

Change-Id: I3a4eb6adfc003c63ebf21b81d46088d52154d99d
2014-09-08 18:34:29 -07:00
Dan Albert
f348c15ecf Use char16_t for char things.
When compiling in C++ mode, the compiler will complain about conversions
from uint16_t to char16_t. Be consistent in using char16_t for strings.

Change-Id: I052b6176ced635162920b31560052d9a64f92764
2014-09-08 18:30:08 -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
1e466385d4 Have R classes generate their own reference rewrite logic
Change-Id: I0e5b8311fc3479d966a49f9acf0d4c32a6a024d3
2014-08-25 20:04:07 -07:00