summaryrefslogtreecommitdiff
path: root/tools/aapt/Resource.cpp
AgeCommit message (Collapse)Author
2020-11-17Revert^2 "libandroidfw hardening for IncFs"Ryan Mitchell
55ef6167a2c235bd88c7216238b2001b46795b79 Change-Id: I02d4890d181655dfd0a14c188468db512559d27b
2020-11-13Revert "libandroidfw hardening for IncFs"Ryan Mitchell
Revert "Move map_ptr to incfs namspace" Revert submission 12787270 Reason for revert: b/173250495 Reverted Changes: I5cd1bc8a2:libandroidfw hardening for IncFs Ice5dbcfb2:Move map_ptr to incfs namspace I29ccdc8ed:Do not cache bag parent stack until requested I1e9e9acaa:Cache resolved theme values Change-Id: Ib90ef68339710086df41e9abe0833a542d03a74f
2020-11-12libandroidfw hardening for IncFsRyan Mitchell
Migrate libandroifw to using incfs::util::map_ptr to prevent processes from crashing when parsing the resources.arsc, parsing compiled xml, files, and retrieving resource values. This change propagates incremental failures to the JNI level where they are raised as ResourcesNotFoundException. Performance of ResourcesPerfWorkloads without change (time in nanoseconds): [1/3] com.android.resources.perf.PerfTest#youtube: PASSED (11.883s) youtube_ns_median: 93812805 youtube_ns_standardDeviation: 4387062 youtube_ns_mean: 94455597 [2/3] com.android.resources.perf.PerfTest#maps: PASSED (11.265s) maps_ns_standardDeviation: 2997543 maps_ns_mean: 83480371 maps_ns_median: 82210941 [3/3] com.android.resources.perf.PerfTest#gmail: PASSED (24.963s) gmail_ns_median: 266141091 gmail_ns_standardDeviation: 3492043 gmail_ns_mean: 267472765 With change and verification forcibly enabled for all apks (including the framework-res.apk): [1/3] com.android.resources.perf.PerfTest#youtube: PASSED (11.646s) youtube_ns_median: 101999396 youtube_ns_standardDeviation: 4625782 youtube_ns_mean: 102631770 [2/3] com.android.resources.perf.PerfTest#maps: PASSED (11.286s) maps_ns_standardDeviation: 2692088 maps_ns_mean: 91326538 maps_ns_median: 90519884 [3/3] com.android.resources.perf.PerfTest#gmail: PASSED (24.694s) gmail_ns_median: 290284442 gmail_ns_standardDeviation: 5764632 gmail_ns_mean: 291660464 With change and verification disabled: [1/3] com.android.resources.perf.PerfTest#youtube: PASSED (11.748s) youtube_ns_median: 95490747 youtube_ns_standardDeviation: 7282249 youtube_ns_mean: 98442515 [2/3] com.android.resources.perf.PerfTest#maps: PASSED (10.862s) maps_ns_standardDeviation: 4484213 maps_ns_mean: 87912988 maps_ns_median: 86325549 [3/3] com.android.resources.perf.PerfTest#gmail: PASSED (24.034s) gmail_ns_median: 282175838 gmail_ns_standardDeviation: 6560876 gmail_ns_mean: 282869146 These tests were done on a Pixel 3 and with cpu settings configured by libs/hwui/tests/scripts/prep_generic.sh: Locked CPUs 4,5,6,7 to 1459200 / 2803200 KHz Disabled CPUs 0,1,2,3 Bug: 160635104 Bug: 169423204 Test: boot device && atest ResourcesPerfWorkloads Change-Id: I5cd1bc8a2257bffaba6ca4a1c96f4e6640106866
2017-12-04AAPT v1 embed compile SDK version and codename into appAlan Viverette
Also adds support for dumping compile SDK attributes. Bug: 63388434 Fixes: 68854953 Test: manual, compiled & dumped ApiDemos APK Change-Id: I2eef812bd957950cdef5f1257b73b57044a1e731
2017-04-17AAPT: Auto-alias application adaptive-iconAdam Lesinski
When a developer specifies an adaptive application icon, and a non-adaptive round application icon, create an alias from the round icon to the regular icon for v26 APIs and up. We do this because certain devices prefer android:roundIcon over android:icon regardless of the API levels of the drawables set for either. This auto-aliasing behaviour allows an app to prefer the android:roundIcon on API 25 devices, and prefer the adaptive icon on API 26 devices. An app developer can override this behaviour by explicitly setting the android:roundIcon to a drawable that has a v26 qualifier. Bug: 34829129 Test: manual Change-Id: Iaaaa5d8367e4f3f9e9f2e3b51c782d3be6a3bb71
2017-03-28AAPT: Version <adaptive-icon> to v26Adam Lesinski
Bug: 35908647 Test: manual Change-Id: Ic8f43efe34385192fbab18675eb5898ed80912a5
2017-03-21Revert "AAPT: Version <adaptive-icon> to v26"Guang Zhu
Bug: 36462965 Bug: 35908647 This reverts commit c7614e5d1e8f9139cccf6ab9b78dda16b98f7656. Change-Id: I25279e7c53823dad0703c7e2ea8ff91bdbc1a0f2
2017-03-16AAPT: Version <adaptive-icon> to v26Adam Lesinski
Bug: 35908647 Change-Id: I307fb2f666cb8519adb9a7f676b87706dc6c683f Test: manual
2017-03-10AAPT: Process XML in mipmap directoryAdam Lesinski
Mipmap directories should be treated like drawables. They are just a convention that prevents them from being split or stripped for multi-apk. Bug: 36068314 Test: manual Change-Id: I93ab3871c7d9d403b77989bcc88304e9939866c4
2017-02-17Removes an already defined warning in aapt.Aurimas Liutikas
Apps that expect to use the current SDK don't specify anything in their manifest and the build system rightfully injects the current SDK. Any apps that specify their own <uses-sdk> or versionCode are telling the build system that they are purposely using some other minSdkVersion, etc (support library demos). Test: None Change-Id: I0aba3a71e15703c7bcafcf4d35608a1851dd8567 Fixes: 34901699
2017-01-24Finish font support for AAPTAdam Lesinski
Test: make CtsContentTestCases in cts/tests/tests/content Change-Id: Ie1e08deeef56611de261bd12f25f53c88068950e
2017-01-20AAPT: Add support for 'font' resource typeAdam Lesinski
Change-Id: I5bc459e34715779ab3b1c415f40f592a4ccbb96e Test: manual
2016-09-23Merge "aapt: remove duplicate definition of ZD" am: ac2d839d7c am: ↵Colin Cross
3efa1e7c17 am: e43f2d4ef5 am: b62cc13c7c Change-Id: Ieb593095a6bdc1842b95863fa2cf08ff1fb0669f
2016-09-22Merge "aapt: remove duplicate definition of ZD" am: ac2d839d7c am: 3efa1e7c17Colin Cross
am: e43f2d4ef5 Change-Id: I71e7bfd44396aa2a7d79ba983bcc71d7684a36c1
2016-09-16aapt: remove duplicate definition of ZDColin Cross
ZD and ZD_TYPE are set by utils/Compat.h, remove them from StringPool.cpp and Resource.cpp. Test: m -j native Bug: 31492149 Change-Id: I6154e4598dd1f279e348ef6c0b32d756464bda8a
2016-08-15AAPT: Fix use-after-free error am: 193ed74c2d am: 646f2d9c33Adam Lesinski
am: 9e8da4a476 Change-Id: I591fd51bf456cd42fe8c633de8924a9f2c844866
2016-08-15AAPT: Fix use-after-free error am: 193ed74c2dAdam Lesinski
am: 646f2d9c33 Change-Id: If9fe7a52e62ae6b2900aa187996b4b785894ab03
2016-08-15AAPT: Fix use-after-free errorAdam Lesinski
Re-order deletion of ResXMLTree and the Asset object it iterates over. Bug:30844391 Change-Id: Ied033d0a8f93343006228a2054c6d0f42bb4717a
2016-08-12resolve merge conflicts of 17bd236 to stage-aosp-master am: b3d46b44a3Chih-Hung Hsieh
am: c76aa69207 Change-Id: I6bb066d131dde297612c5dcbf5051f4964e62a8b
2016-08-12resolve merge conflicts of 17bd236 to stage-aosp-masterChih-Hung Hsieh
Change-Id: I08d4500aaa378b08d41e8d046c62101e08dbfba8
2016-08-11Fix clang-tidy warnings in aapt and aapt2.Chih-Hung Hsieh
* 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-11Fix clang-tidy warnings in aapt and aapt2.Chih-Hung Hsieh
* 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-07-20Aapt main dex proguard rules - always keep applicationIvan Gavrilovic
Aapt with -D option was not keeping the application and instrumentation subclasses, which were instead handled by mainDexClasses.rules. Instead, include them in the aapt -D output. Change-Id: Ia3b89fc2edd45d379c4d06f0bf674716646fcb3d
2016-07-18AAPT: Don't keep processing files that failed to be addedAdam Lesinski
AAPT will continue ahead without reporting an error if a file failed to be added to the ResourceTable. This would cause crashes later when the file was assumed to be present. Bug:30200166 Change-Id: Ieb2daf97ccf0345153b6f4598d130a38d108c937
2016-05-09Stop emitting javadoc for @removed attributes.Michael Wright
We need the attributes to remain public because people might still be linking against them, but we don't want them showing up in the documentation any more. Them showing up in the documentation also had the side effect that it would accidentally mark the parent class of attributes as @removed, which was not intended. Bug: 28663748 Change-Id: I2f6eb09455fddf1086e6b24bc3bea5292e8e32b7
2016-04-27AAPT: ProGuard config for components in main dex.Rohit Agrawal
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-27AAPT: ProGuard config for components in main dex.Rohit Agrawal
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-02-11AAPT: Remove warnings for public resources without commentsAdam Lesinski
There are so many public resources that do not warrant comments that having a warning that no one cares about is just producing log spam. Bug:21495023 Change-Id: I84e3b39c7139ee67fb5cb711d5ab466d8f4ef2e0
2016-01-16Merge "Make the appropriate cast to protect from mingw." am: dbf8c17bd2Dan Albert
am: 2edfa8c9b0 * commit '2edfa8c9b00cd0c0bd18738f75e0928394b99c76': Make the appropriate cast to protect from mingw.
2016-01-15Make the appropriate cast to protect from mingw.Dan Albert
As the comment at the top of the file says: STATUST: mingw does seem to redefine UNKNOWN_ERROR from our enum value, so a cast is necessary. Bug: http://b/26523949 Change-Id: I9d86cafdc47bbb9ce0e967cdde9315babc083432
2015-12-07Specify private resource package in Android.mkAdam Lesinski
Private resource package shouldn't be buried in some resource file. It can now be specified on the command line via the Android.mk file. Change-Id: I9e3cb0bf54830d6b021077af271913306c024701
2015-11-30Implement AAPT Bundle formatAdam Lesinski
AAPT will scan XML files looking for the <aapt:attr> XML tag. <!-- @layout/bundle.xml --> <ImageView xmlns:aapt="http://schemas.android.com/aapt"> <aapt:attr name="android:src"> <vector android:pathData="..." ...> </vector> </aapt:attr> </ImageView> The SINGLE child element of the <aapt:attr> tag is extracted into its own top level resource. It is given a generated name. The parent element of <aapt:attr> is then given the resource attribute that was assigned to the `name' attribute. The value is set to a reference to the generated resource. <!-- @layout/bundle.xml --> <ImageView android:src="@drawable/bundle_1.xml"> </ImageView> <!-- @layout/bundle_1.xml --> <vector android:pathData="..." ...> </vector> Bug:22627686 Change-Id: I8575fc4f739011402662fbf6b3db96df0012f598
2015-11-30Revert "Implement AAPT Bundle format"Adam Lesinski
This reverts commit 9d0f7d44d5cc5322415f52f7ce03cc37a478b350. Caused a build breakage when parsing some attributes. Change-Id: I89ca958b2f2e820d353648df8aadd90bbe8d8339
2015-11-24Implement AAPT Bundle formatAdam Lesinski
AAPT will scan XML files looking for the <aapt:attr> XML tag. <!-- @layout/bundle.xml --> <ImageView xmlns:aapt="http://schemas.android.com/aapt"> <aapt:attr name="android:src"> <vector android:pathData="..." ...> </vector> </aapt:attr> </ImageView> The SINGLE child element of the <aapt:attr> tag is extracted into its own top level resource. It is given a generated name. The parent element of <aapt:attr> is then given the resource attribute that was assigned to the `name' attribute. The value is set to a reference to the generated resource. <!-- @layout/bundle.xml --> <ImageView android:src="@drawable/bundle_1.xml"> </ImageView> <!-- @layout/bundle_1.xml --> <vector android:pathData="..." ...> </vector> Bug:22627686 Change-Id: I31bc96aae30d38bfd0b16508d0f585de5fd88a07
2015-09-11Merge "AAPT: Don't try to rewrite String constants when loading shared lib"Adam Lesinski
2015-09-10AAPT: Don't try to rewrite String constants when loading shared libAdam Lesinski
Bug:20138255 Change-Id: Ieb6a31ee9afe0de3d1c99b21f78aa48fe07015c6
2015-08-17am 12cf0f9c: am eba23aaa: Merge "Replace HAVE_MS_C_RUNTIME with _WIN32 in ↵Elliott Hughes
frameworks/base/tools." * commit '12cf0f9c4cf8e6aed738da7349f556bd716ec09e': Replace HAVE_MS_C_RUNTIME with _WIN32 in frameworks/base/tools.
2015-08-17Replace HAVE_MS_C_RUNTIME with _WIN32 in frameworks/base/tools.Elliott Hughes
Change-Id: Ideef62acbf53a442167c9b8038021affffef9e8a
2015-06-02aapt: add option for stricter symbol generationAdrian Roos
Adds an option that prevents generating java symbols for string resources that don't have a default localization. Bug: 21537397 Change-Id: Ifafa942b24d5cdbed93651cde363e859be13d395
2015-04-09Merge "Re-enable -Wall and -Werror that were lost in a merge"Colin Cross
2015-04-08Re-enable -Wall and -Werror that were lost in a mergeColin Cross
-Wall and -Werror were lost during a merge when they were added to aaptCFLAGS instead of aaptCFlags. Fix the typo, and the warnings that crept in while it was disabled. Change-Id: Ib944b8d6149278e4f3861c1acac277bcd95cc7c2
2015-04-03Only Windows doesn't have %zd.Elliott Hughes
Change-Id: I0e4b0fdc61641c5ecb724fd096bd2315dcf8ed4a
2014-12-16am 503a4494: am f1f179a7: Merge "AAPT: Copy android:revisionCode to Splits" ↵Adam Lesinski
into lmp-mr1-dev * commit '503a4494d64d30f9b904b24a56fff986810da610': AAPT: Copy android:revisionCode to Splits
2014-12-16AAPT: Copy android:revisionCode to SplitsAdam Lesinski
Bug:18706179 Change-Id: I669b56e0b67dd1bfda7749ef433b55af16851154
2014-12-03am 72a6aeac: am 91ca64ea: Merge "AAPT: Add pathMotion custom classes to ↵Adam Lesinski
Proguard Keep set" into lmp-mr1-dev * commit '72a6aeaca0712d9b72b9f773e2b72bb45ddd3cb8': AAPT: Add pathMotion custom classes to Proguard Keep set
2014-12-02AAPT: Add pathMotion custom classes to Proguard Keep setAdam Lesinski
Bug:18590044 Change-Id: Ia5dbf55317d2cc89826316e8d10f031b5d340e57
2014-12-03am f17611a2: am 130e30fe: Merge "AAPT: Add custom transition classes to ↵Adam Lesinski
Proguard keep set" into lmp-mr1-dev * commit 'f17611a29e3b0d0c7a5d28a1ce92682a2c097de6': AAPT: Add custom transition classes to Proguard keep set
2014-12-02AAPT: Add custom transition classes to Proguard keep setAdam Lesinski
Bug:18590044 Change-Id: Ib24831e669a09f0e6f32434081c0e2499702399c
2014-11-05Merge commit 'fb96e54' into manualmergeAdam Lesinski
Conflicts: tools/aapt/Resource.cpp Change-Id: I4147c3550e9426f3429146eaeb16f10ba76b5b15
2014-11-03Merge commit '78be0498' into manualmergeAdam Lesinski
Conflicts: libs/androidfw/ResourceTypes.cpp tools/aapt/Android.mk tools/aapt/StringPool.cpp tools/aapt/StringPool.h Change-Id: I9d69efdfb892032895ace12159d193304f02dc6c