summaryrefslogtreecommitdiff
path: root/include/androidfw
AgeCommit message (Collapse)Author
2016-11-03Re-unite sources with their headers John Reck
Move all the includes for androidfw under a common base path for that library instead of frameworks/base/includes. Also fixes -Werror issues that resulted in no longer being -isystem. Test: builds Change-Id: Ic4312eb61b197af114dded5691d5ae1ec82923f7
2016-10-26AAPT2: Rename to match new style Adam Lesinski
Use Google3 naming style to match new projects' and open source google projects' style. Preferred to do this in a massive CL so as to avoid style inconsistencies that plague legacy code bases. This is a relatively NEW code base, may as well keep it up to date. Test: name/style refactor - existing tests pass Change-Id: Ie80ecb78d46ec53efdfca2336bb57d96cbb7fb87
2016-10-21Change name of overlay subdir 'sku'->'theme' am: 54dcaaba4f Jakub Adamek
am: 6bbb63ad91 Change-Id: I71dfaafbebaa7bd61d182405c734eef1ea7ff1eb
2016-10-20Merge "Add tests for attribute resolution" TreeHugger Robot
2016-10-19Change name of overlay subdir 'sku'->'theme' Jakub Adamek
The name 'sku' does not fit well as we recommend to use the same value for different SKUs if vendors wish to have the same colors on those SKUs. Bug: 32268656 Change-Id: Ib5e5a3386676453dafeb13a6a6bf91f81bb48a11
2016-10-18Fix race with Asset destruction and printing allocation stats Adam Lesinski
am: 2582465bb4 Change-Id: I1dbb7609fa4d770e513e6f628e4c598600607383
2016-10-18Search for RRO both in SKU subdir and in vendor/overlay am: 1f36a2166b Jakub Adamek
am: 27471b30de Change-Id: I5c8655c5f9abe1375c0d53f48705709331d472d9
2016-10-17Add tests for attribute resolution Adam Lesinski
- Adds unit tests for attribute resolution. These include some test data resource tables and compiled XML files. - Convert touched files to Google style guide. Test: make libandroidfw_tests Change-Id: Ib3a36061dc874de5f6a266b4e82c0a12ef435f23
2016-10-18Fix race with Asset destruction and printing allocation stats Adam Lesinski
A race could occur when printing the list of Asset allocations for debugging purposes. Each Asset object would insert themselves into a global linked list on construction and remove themselves on destruction. Iterating the list and the insertion/remove operations all acquire a global lock. The race occurs after the Asset subclass destructor runs but before the Asset base class destructor runs, which performs the actual removal from the list. The vtable of the object being destroyed ends up pointing at the base Asset class' vtable, and during the iteration of the global list, a pure virtual method is called leading to an abort, since the wrong vtable is dereferenced. This change moves the insertion/removal of the Asset object into the global list to the concrete class, which adds some maintenance overhead but solves the problem. Bug:31113965 Test: make libandroidfw_tests Change-Id: I1a620897e5e04a8519ee247883bba0719b1fa6f3 (cherry picked from commit 0358efe4f76f42d9eea91600202a5ab0831d9cef)
2016-10-17Fix race with Asset destruction and printing allocation stats Adam Lesinski
A race could occur when printing the list of Asset allocations for debugging purposes. Each Asset object would insert themselves into a global linked list on construction and remove themselves on destruction. Iterating the list and the insertion/remove operations all acquire a global lock. The race occurs after the Asset subclass destructor runs but before the Asset base class destructor runs, which performs the actual removal from the list. The vtable of the object being destroyed ends up pointing at the base Asset class' vtable, and during the iteration of the global list, a pure virtual method is called leading to an abort, since the wrong vtable is dereferenced. This change moves the insertion/removal of the Asset object into the global list to the concrete class, which adds some maintenance overhead but solves the problem. Bug:31113965 Test: make libandroidfw_tests Change-Id: I1a620897e5e04a8519ee247883bba0719b1fa6f3
2016-10-17Search for RRO both in SKU subdir and in vendor/overlay Jakub Adamek
Currently, if the "ro.boot.vendor.overlay.subdir" property is set, we only search in the subdir. It seems more powerful to search both in there and in the standard /vendor/overlay directory. Also, RRO packages have the "priority" attribute in the <overlay> attribute in AndroidManifest.xml which serves for disambiguation. Bug: 32202741 Change-Id: I7acff1b7f0e153830924047349f003295648a53b
2016-10-12Move attribute resolution from core/jni to libandroidfw Adam Lesinski
Without the entire JNI environment, testing the attribute resolution code will be much easier and enable safer refactoring. Change-Id: I2815cc1e10a694a3b01bc37e191a0d5e9d0e6735 Test: Existing CTS tests pass
2016-10-04AssetManager: Remove more methods, fix comments Adam Lesinski
Remove a few vendor-related methods and fix comments to no longer reference legacy concepts like vendor. Change-Id: I61dbe53b6b305d8fb3468423462f5de2925b78bd Test: dead-code removal, if builds, it works
2016-10-03Remove unused methods from AssetManager.cpp Adam Lesinski
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-03Change name of overlay subdir property to sku. am: c03d9483f0 Jakub Adamek
am: e60842aba3 Change-Id: Ifda5c5a7fc7eaff49aa2f65671d543e285b7f8a4
2016-10-03Change name of overlay subdir property to sku. Jakub Adamek
Also move the SKU subdirectories directly under /vendor/overlay. Bug: 31692079 Change-Id: I68c712b13918cc99629534580ee4f77d9e5b3823
2016-09-28Search for runtime resource overlays in subdir. am: 1c15c63578 Jakub Adamek
am: ff5cb98888 Change-Id: I726b08026ceb250cc95669d3b5a5c35e15bf82e4
2016-09-28Search for runtime resource overlays in subdir. Jakub Adamek
See go/sku-colors. This changes the directory to search for framework overlays if the right system property is defined. This allows OEMs to specify different resources based on device SKUs. Bug: 31692079 Change-Id: I9cb121b286b7f52aa26de1757fde1f3110cd47fd
2016-06-15Move matching Tagalog and Filipino to ResourceTypes.cpp Roozbeh Pournader
Previously, if a mix of "fil" and "tl" resources existed in Resources (from mixing resources from libraries for example), only resources from one or the other would be chosen, resulting in default resources getting surprisingly used. Now, we resolve the equivalent languages at a per-resource levels (breaking ties for the identical code). Also, previously if both "tl" and "fil" resources were present in assets, getLocales() could return a list with duplicate locales. This change removes Filipino duplicates in the return value of AssetManager::getLocales(). Finally, there was a bug in the replacement of "tl" with "fil" that considered any locale starting with the letter "tl" to be Tagalog. This failed in case of various languages, including Klingon ("tlh") and Tlingit ("tli"). It's now fixed. Bug: 29073000 Change-Id: I0e8b9ae337ced2e640a2575897948c4c5ca307d3
2016-05-20Performance improvements in AssetManager Adam Lesinski
Change the implementation of getLocales() to iterate the set of configurations using a templated method, instead of using the result of getConfigurations(). Also remove the check for AndroidManifest.xml when adding an asset path. This is unneccessary. Bug:28625993 Change-Id: I16de5da598d0c371421d1dc8eee054dce9baf53a
2016-05-10Resource shared libraries: fix theme references Adam Lesinski
Theme values that would reference other theme values would not work if they were declared in a shared library. We now introduce a parallel resource type to TYPE_DYNAMIC_REFERENCE, TYPE_DYNAMIC_ATTRIBUTE, which allows us to lookup and resolve theme value references from shared libraries. Bug:28687378 Change-Id: I4f2364e3e8b567679f90784fcaaea12b6b05e926
2016-04-28ZipUtils: Fix wrong timestamps when getEntryInfo Shammi Khattar
"tm_mon" format should align with "ZipEntry::setModWhen" in aapt. "tm_isdst" should be initialized, or it will because random value and cause error in function mktime(). BUG:28021145 (cherry picked from commit bb0eb3f4cb33c077b296a18555a9a1a966ff696b) Change-Id: Ia39cf63fcd4bb39c24af080562960279106f526c
2016-03-09AssetManager: Cache a pre-filtered list of configurations Adam Lesinski
When we set the parameters for a ResTable, we can pre-filter which resources match and only look at that smaller list when getting entries. This helps A LOT with types that have many configurations, like strings and all their various locales. We must store the cached entries in a parallel data structure because parts of the main Type object are shared with other ResTables, causing data races. Bug:25499111 Change-Id: I63e37dcbd683fc9f1e7d0f3a6ed4c1c01e0fc575
2016-03-07Merge "Revert "AssetManager: Cache a pre-filtered list of configurations"" ↵ Adam Lesinski
into nyc-dev
2016-03-07Revert "AssetManager: Cache a pre-filtered list of configurations" Adam Lesinski
There is a race due to the modification of shared data structures in the framework ResTable. See b/27499488 This reverts commit d4b169173ad7805369204277580d3942cb08174a. Change-Id: I3f400a2ad3b5ffc652b84dd5fe777f7cf34b5548
2016-03-03Fix script-related parts of locale resource matching Roozbeh Pournader
Previously, a bit was kept to find if the script of a locale was explicitly "provided" in a resource. This was not backward compatible, and failed in some edge cases when the package was created with older versions of AAPT that did not set the bit. The cases would happen when the old resource had an explicit script specified in its locale, but since the "provided" bit was not set in the package, we would assume that the script was computed by us. This CL replaces the "provided" bit with a "computed" bit, so the default value of the bit (set to "false" for old packages) would be correct. Bug: 27156990 Change-Id: I99e7f1ad8f70c90e25ab3640ed34cc1a6f8d1d64
2016-02-25AssetManager: Cache a pre-filtered list of configurations Adam Lesinski
When we set the parameters for a ResTable, we can pre-filter which resources match and only look at that smaller list when getting entries. This helps A LOT with types that have many configurations, like strings and all their various locales. Bug:25499111 Change-Id: Ie6894c44bc67e16a10dbe028c8f3e119e5c29ac7
2016-02-01Make default resources a better match for en-US requests Roozbeh Pournader
When locale fallback landed, resources which specified an 'English' locale started to be considered a better match for en-US, even though traditionally, apps tend to ship US English resources under their default locale. This fixes that, and makes en-US requests match default locales. Bug: 26756573 Bug: 26789680 Bug: 26803868 Change-Id: I460c276bfc6ddba0439dcdf87497a0aece0fa05d
2016-01-22Move localeScriptWasProvided to end of ResTable_config Roozbeh Pournader
This is to try and be safer with different versions potentially interpreting the data differently. Change-Id: I599b6a20d908e8379727a5b06cc6631f1954bcff
2016-01-22Merge "Add choreographer API to the NDK." Michael Wright
2016-01-21Add choreographer API to the NDK. Michael Wright
Change-Id: Icb8cffd3cd3bd06814466be72db3e26f6a62cbc6
2016-01-21Implement smarter locale resource selection Roozbeh Pournader
* Add support for determining script from language and region. * Add support for determining special parents of locales. * Add support for smart comparison of locales with only a difference in region, using the locale parentage tree. * Fix LocaleData.matchScore() to not fallback to old locale matching behavior if we can't determine a script. * Allow four-character variant codes. (Previously, only five- to eight-character variant codes were allowed.) Bug: 7296673 Bug: 26589793 Change-Id: Ibde0a48c0564ff383b41068095a5cbacfe7b94bc
2016-01-04Avoid matching system locales in locale negotiation Roozbeh Pournader
Also: 1. Add AssetManager method for finding non-system locales: This is used in per-app locale negotiation. (Normally, AssetManager#getLocales() returns both system and non-system locales.) 2. Match pseudolocales correctly in locale negotiation. Bug: 25800576 Bug: 26236938 Change-Id: I116caf3a91c290deb4ad68b291c65b7035b18dd4
2015-09-08Load app resource as shared library. Tao Bai
- 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-08-10Only relaunch activity on significant size configuration changes. Filip Gruszczynski
Currently if the configuration width/height/smallest width changes, we relaunch the activity or invoke onConfigurationChanged callback. When it comes to size based configuration changes it might not be necessary: if the size change doesn't pass one of the threshold defined by the resources, it means there is no need to relaunch the activity. In this CL the ActivityManager will receive the thresholds from the application and use them to decide, whether to relaunch the activity. The application reads the thresholds from the resources, specifically from resource qualifiers used by the app. Change-Id: Ie3cf0a172dc1ba0b865cf30c2962e7cfd9ad8436
2015-06-22Let findSupportedAbi and hasRenderscriptBitcode scan only relevant files Yusuke Sato
for better performance. Without the optimization, these two functions may check more than 100k file names in the pre-installed APK files, which can take a few seconds to finish even on a recent device. Bug: 21957428 Change-Id: I315fd3c6d5aa1076b993752525de449a9933de12
2015-06-17ZipFileRO: Use precise widths for zip file types. Narayan Kamath
getEntryInfo crashes on 64-bit devices because "long" types were being passed int pointers (that pointed to a stack frame) that were reinterpret_cast'ed to long* (sigh.). To fix this issue once and for all, use types with explicitly defined widths. This change also removes some dead invariant checking from Asset.cpp instead of cleaning it up. Note that we've introduced a wart in NativeLibraryHelper, where we need to deal with zlib's uLong type, which is "at least 32 bits wide". bug: 21622286 Change-Id: Iae675a9601db7aae03a8b80b40321d2cc1d97f50
2015-05-15Add -round and -notround qualifier to android runtime/aapt Adam Lesinski
The round qualifier denotes a device with a screen shape that is round. The qualifier shows up after the 'long/notlong' qualifier and before the orientation 'port/land/square' qualifiers. Change-Id: I3044258b2703a9165694b79725bade770fa6cea1
2015-05-06Improve keying for theme caches, rebase system theme on config change Alan Viverette
Themes now use an array of applied styles rather than a String to store their history. They are keyed based on a hash code computed from the history of applied styles. The themed drawable cache has been abstracted out into its own class. Also updates system context to use DayNight as the default and ensures that GlobalActions uses the correct context, which exercises the change. CTS tests have been added in another CL. Bug: 20421157 Change-Id: I9eb4b7dffd198ad24d02f656eaf0839570b59caa
2015-05-05Add API for obtaining changing configurations bitmask from Theme Alan Viverette
Required to know when to reload the system context's theme in response to configuration changes, and thus needed to support the DayNight theme. Bug: 20267825 Change-Id: I7df5e28b7a6d8b611ea030032544cf4800788514
2015-04-15am 7b09e7a9: am 44d7989a: am 571c5a26: Merge "Fix UB in ↵ Dan Albert
ResourceTable::stringToInt." * commit '7b09e7a9f3ef804e9cd159023b64eac1ef8b7931': Fix UB in ResourceTable::stringToInt.
2015-04-14Merge "Fix UB in ResourceTable::stringToInt." Dan Albert
2015-04-09am e24d36b7: am 1f799a6b: am d9f32b16: Merge "Ensure alignment of ↵ Dan Albert
Res_png_9patch." * commit 'e24d36b7b744540ccd3401609248ed9d48be4cc9': Ensure alignment of Res_png_9patch.
2015-04-09Ensure alignment of Res_png_9patch. Dan Albert
This doesn't alter the alignment of the data within the struct, but enforces that this structure will be appropriately aligned when used. The image_info struct has this struct preceded by a bool, which causes odd alignment for the members of this struct. Change-Id: Ia2ef5c81b2f961c0f61858a10a7821d82f600919
2015-04-08Fix UB in ResourceTable::stringToInt. Dan Albert
Was here because UBsan found integer overflow in the parsing for hex numbers, since hex numbers here are actually unsigned but assigned to a signed integer. Also fixes a number of missing error conditions. Change-Id: Iaea576daedfc6c75521cde02de3fe9dd0198a3b7
2015-04-03Merge "AAPT2" Adam Lesinski
2015-04-02AAPT2 Adam Lesinski
First checking of AAPT2. The individual phases of AAPT2 work, but there are some missing pieces. For early testing we are missing: - Need to properly mark file references and include them in package - Need to package into zip Final AAPT for apps we are missing: - Need to crush PNGs - Need to parse 9-patches - Need to validate all of AndroidManifest.xml - Need to write align method to align resource tables for splits. Final AAPT for apps + system we are missing: - Need to handle overlays - Need to store comments for R file - Need to handle --shared-lib (dynamic references too). New AAPT features coming: - Need to import compiled libraries - Name mangling - R file generation for library code Change-Id: I95f8a63581b81a1f424ae6fb2c373c883b72c18d
2015-03-26Add payload-size preflight stage to full transport backup Christopher Tate
We now peform a total-size preflight pass before committing data to the wire. This is to eliminate the large superfluous network traffic that would otherwise happen if the transport enforces internal quotas: we now instead ask the transport up front whether it's prepared to accept a given payload size for the package. From the app's perspective this preflight operation is indistinguishable from a full-data backup pass. If the app has provided its own full-data handling in a subclassed backup agent, their usual file-providing code path will be executed. However, the files named for backup during this pass are not opened and read; just measured for their total size. As far as component lifecycles, this measurement pass is simply another call to the agent, immediately after it is bound, with identical timeout semantics to the existing full-data backup invocation. Once the app's file set has been measured the preflight operation invokes a new method on BackupTransport, called checkFullBackupSize(). This method is called after performFullBackup() (which applies any overall whitelist/blacklist policy) but before any data is delivered to the transport via sendBackupData(). The return code from checkFullBackupSize() is similar to the other transport methods: TRANSPORT_OK to permit the full backup to proceed; or TRANSPORT_REJECT_PACKAGE to indicate that the requested payload is unacceptable; or TRANSPORT_ERROR to report a more serious overall transport-level problem that prevents a full-data backup operation from occurring right now. The estimated payload currently does not include the size of the source-package metadata (technically, the manifest entry in its archive payload) or the size of any widget metadata associated with the package's install. In practice this means the preflighted size underestimates by 3 to 5 KB. In addition, the preflight API currently cannot distinguish between payload sizes larger than 2 gigabytes; any payload estimate larger than that is passed as Integer.MAX_VALUE to the checkFullBackupSize() query. Bug 19846750 Change-Id: I44498201e2d4b07482dcb3ca8fa6935dddc467ca
2015-03-16Output modified bcp47 tag in ResTable_config::toString() Adam Lesinski
We expect to be able to parse the output of ResTable_config::toString(), so it should use modified bcp47 (b+en+Latn+US). Change-Id: I597a1779a1fa5cff171c473e6a0368d93b9c7722
2015-01-27am 3523e4fc: am efe085ff: Merge "Handle bad ninepatch data." into lmp-mr1-dev Leon Scroggins III
* commit '3523e4fcb3c74a5dee2f4497e2b8ec7b9e2b5e57': Handle bad ninepatch data.