summaryrefslogtreecommitdiffstats
path: root/include/androidfw/ResourceTypes.h
Commit message (Collapse)AuthorAgeFilesLines
* am 3523e4fc: am efe085ff: Merge "Handle bad ninepatch data." into lmp-mr1-devLeon Scroggins III2015-01-271-3/+3
|\ | | | | | | | | * commit '3523e4fcb3c74a5dee2f4497e2b8ec7b9e2b5e57': Handle bad ninepatch data.
| * Handle bad ninepatch data.Leon Scroggins III2015-01-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Changes proposed by Ben Hawkes of Google Project Zero. NinePatchPeeker.cpp: Instead of asserting, return false for bad data. ResourceTypes.h: Store ninepatch values as unsigned. BUG:19151999 Change-Id: Ibe35e7569f632c6bb8a34a7701e26bb6ed547ec2
* | am aee7225e: Merge "Process base APK" into lmp-mr1-devAdam Lesinski2015-01-201-1/+1
|\ \ | |/ | | | | | | | | | | automerge: 554a6f5 * commit '554a6f5278ec05077d8252249afc911897fbfe76': Process base APK
| * Process base APKAdam Lesinski2015-01-161-1/+1
| | | | | | | | | | | | | | | | | | The base APK may have resources with configurations that compete against some splits. The base APK must be involved in the selection of splits. Bug:18982001 Change-Id: Ieb29b5a36cf2c68e7831484d98a9fd275acd97e8
* | Merge commit '0953ab27' into manualmergeAdam Lesinski2014-12-051-0/+3
|\ \ | |/ | | | | Change-Id: I36dea45f7571096136ea7bda5e2680bd85a0df32
| * AAPT: Move private attrs to new type for frameworkAdam Lesinski2014-12-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Private attributes are typically placed after public attributes in the resource table. Each time a new version of the Android framework is released, new public attributes take the place of the private attributes, and the private attributes are shifted after the new public ones. This means that any apps built against the newer SDK may inadvertently be using private attributes on older devices. This change moves all private attributes to a completely different type ID, so there will never be collisions across versions. These private attributes are automatically moved to a synthesized type only for the system resources. Bug:18263655 Change-Id: I7a850512953fadcc9f3524d509cea30249782db8
* | am f89a2fda: Merge "Frameworks/base: Fix two warnings in cmds"Andreas Gampe2014-11-081-3/+1
|\ \ | | | | | | | | | | | | * commit 'f89a2fdacb2ba907f180188dc79f9de81e3eb254': Frameworks/base: Fix two warnings in cmds
| * | Frameworks/base: Fix two warnings in cmdsAndreas Gampe2014-11-081-3/+1
| | | | | | | | | Change-Id: Ifb9c7fb7a2d28c13010ddc186bea5f5f0daefb4a
* | | resolved conflicts for merge of 487ae9b8 to lmp-mr1-dev-plus-aospAndreas Gampe2014-11-071-2/+2
|\ \ \ | |/ / | | / | |/ |/| Change-Id: I395f184d885a7ef30aa113ab01fcaacc94243008
| * Frameworks/base: Wall Werror in libs/androidfwAndreas Gampe2014-11-071-2/+2
| | | | | | | | | | | | | | Turn on -Wall -Werror in libs/androidfw. Fix warnings. Refactor some code. Change-Id: I66fe54ace433c15dee5de328b149ca142f74b2dd
| * am 8bdb265f: am 19f9d54f: Merge "Fix backwards compat problem with AAPT ↵Adam Lesinski2014-09-191-0/+2
| |\ | | | | | | | | | | | | | | | | | | public attrs" into lmp-dev * commit '8bdb265f0a73bc6f2114ca70f141c214a23696c7': Fix backwards compat problem with AAPT public attrs
| * \ resolved conflicts for merge of 6c585756 to lmp-dev-plus-aospDan Albert2014-09-081-10/+10
| |\ \ | | | | | | | | | | | | Change-Id: I5a25f2bac44ac5efcd7462af91005e09680a1d96
| | * | Use char16_t for char things.Dan Albert2014-09-081-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Merge "Fix issues that will be present in C++11" into lmp-mr1-devAdam Lesinski2014-11-031-12/+23
|\ \ \ \
| * | | | Fix issues that will be present in C++11Adam Lesinski2014-11-031-12/+23
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - char16_t is a distinct type, so stay consistent with it throughout the code base. - char16_t is defined as minimum size of 16 bits. Since we mmap and cast data structures onto raw memory, we need a precise definition (uint16_t), so we cast between that (and static_assert that they are the same size). Change-Id: I869c32637543bbcfb39d2643e7d9df10d33acd3c
* | | | Distinguish unspecified and explicit null values in resourcesAlan Viverette2014-10-291-1/+10
|/ / / | | | | | | | | | | | | BUG: 17919345 Change-Id: Ic4f04f7dd0f986f58a749b5950d80c1cfdb074ea
* | | Fix backwards compat problem with AAPT public attrsAdam Lesinski2014-09-181-0/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AAPT has traditionally assigned resource IDs to public attributes, and then followed those public definitions with private attributes. --- PUBLIC --- | 0x01010234 | attr/color | 0x01010235 | attr/background --- PRIVATE --- | 0x01010236 | attr/secret | 0x01010237 | attr/shhh Each release, when attributes are added, they take the place of the private attributes and the private attributes are shifted down again. --- PUBLIC --- | 0x01010234 | attr/color | 0x01010235 | attr/background | 0x01010236 | attr/shinyNewAttr | 0x01010237 | attr/highlyValuedFeature --- PRIVATE --- | 0x01010238 | attr/secret | 0x01010239 | attr/shhh Platform code may look for private attributes set in a theme. If an app compiled against a newer version of the platform uses a new public attribute that happens to have the same ID as the private attribute the older platform is expecting, then the behavior is undefined. We get around this by detecting any newly defined attributes (in L), copy the resource into a -v21 qualified resource, and delete the attribute from the original resource. This ensures that older platforms don't see the new attribute, but when running on L+ platforms, the attribute will be respected. We still need to address this problem in the platform moving forward, as this will only help us in the transition from pre L to L. Bug:17520380 Change-Id: Ia2a985798b50006c21c7c3431d30d9598f27cd91
* | Stamp platform version code into app ApksAdam Lesinski2014-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | 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
* | Introduce anydpi density resource qualifierAdam Lesinski2014-08-251-0/+1
| | | | | | | | | | | | | | | | | | | | This is meant to be used with scaleable vector drawables, and are chosen as the best match unless there is a configuration that matches the density requested exactly. Bug:17007265 Change-Id: Ic3288d0236fe0bff20bb1599aba2582c25b0db32
* | AAPT: Fix regression generating dynamic ref table for shared librariesAdam Lesinski2014-08-201-0/+3
| | | | | | | | | | | | AAPT stopped generating dynamic reference tables for shared libraries. Change-Id: Ib0025811bdca1a4756eb21080dd6b6bb3fc1ca3d
* | AAPT support for feature splitsAdam Lesinski2014-08-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Support multiple resource tables with same packageAdam Lesinski2014-06-181-13/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | am 642421aa: am 5c31e487: Merge "Introduce new UI_MODE_TYPE_WATCH and ↵John Spurlock2014-04-041-0/+1
|\ \ | | | | | | | | | | | | | | | | | | qualifier." into klp-modular-dev * commit '642421aa7f284817cc1a972a7f9c7a64696a0116': Introduce new UI_MODE_TYPE_WATCH and qualifier.
| * \ am 5c31e487: Merge "Introduce new UI_MODE_TYPE_WATCH and qualifier." into ↵John Spurlock2014-04-041-0/+1
| |\ \ | | |/ | |/| | | | | | | | | | | | | klp-modular-dev * commit '5c31e487c4577e1c47ee7c949325d6a13f0d462e': Introduce new UI_MODE_TYPE_WATCH and qualifier.
| | * Introduce new UI_MODE_TYPE_WATCH and qualifier.John Spurlock2014-04-041-0/+1
| | | | | | | | | | | | | | | | | | | | | Default ui mode to watch if we have FEATURE_WATCH. Bug:13395758 Change-Id: Ie5ff95de60e69e91ad3612c7d2f1fca7f49061bd
* | | Shared library resource supportAdam Lesinski2014-03-251-4/+82
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | LP64: Make 9 patches architecture agnostic.Narayan Kamath2014-03-101-25/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Extended locales in AAPT / AssetManager.Narayan Kamath2014-02-141-14/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. (cherry-picked from commit 91447d88f2bdf9c2bf8d1a53570efef6172fba74) Change-Id: I1b43086860661012f949fb8e5deb7df44519b854
* | AssetManager support for 3 letter lang/country codes.Narayan Kamath2014-02-141-4/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 3 letter codes are packed into the existing 32 bit locale field in ResTable_config - We introduce new fields for script / variant information. Note that we define a "match" between two ResTable_config structures to be purely on the basis of their language & country (disregarding the script and the variant). However, configs with scripts and variants are considered to be more specific than those without. (cherry picked from commit 378c6775a62d9c461cde51f06c1b14bb014c78fd) Change-Id: I7dce82a3fe2412834252723f458826ae41535a78
* | Fix build.Dianne Hackborn2014-02-121-2/+2
| | | | | | | | | | | | | | | | At least part of what is broken. Other stuff still seems to be. (cherry picked from 32bb5fae353b5bb6275e75952e89c514c7369cee) Change-Id: I280376645166fe772ff7a31ff2e8494dce2adbf8
* | Runtime resource overlay, iteration 2Mårten Kongstad2014-02-031-21/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support any number of overlay packages. Support any target package. UPDATED PACKAGE MATCHING ------------------------ In Runtime resource overlay, iteration 1, only a single overlay package was considered. Package matching was based on file paths: /vendor/overlay/system/framework-res.apk corresponded to /system/framework-res.apk. Introduce a more flexible matching scheme where any package is an overlay package if its manifest includes <overlay targetPackage="com.target.package"/> For security reasons, an overlay package must fulfill certain criteria to take effect: see below. THE IDMAP TOOL AND IDMAP FILES ------------------------------ Idmap files are created by the 'idmap' binary; idmap files must be present when loading packages. For the Android system, Zygote calls 'idmap' as part of the resource pre-loading. For application packages, 'idmap' is invoked via 'installd' during package installation (similar to 'dexopt'). UPDATED FLOW ------------ The following is an outline of the start-up sequences for the Android system and Android apps. Steps marked with '+' are introduced by this commit. Zygote initialization Initial AssetManager object created + idmap --scan creates idmaps for overlays targeting 'android', \ stores list of overlays in /data/resource-cache/overlays.list AssetManager caches framework-res.apk + AssetManager caches overlay packages listed in overlays.list Android boot New AssetManager's ResTable acquired AssetManager re-uses cached framework-res.apk + AssetManager re-uses cached 'android' overlays (if any) App boot ActivityThread prepares AssetManager to load app.apk + ActivityThread prepares AssetManager to load app overlays (if any) New AssetManager's ResTable acquired as per Android boot SECURITY -------- Overlay packages are required to be pre-loaded (in /vendor/overlay). These packages are trusted by definition. A future iteration of runtime resource overlay may add support for downloaded overlays, which would likely require target and overlay signatures match for the overlay to be trusted. LOOKUP PRIORITY --------------- During resource lookup, packages are sequentially queried to provide a best match, given the constraints of the current configuration. If any package provide a better match than what has been found so far, it replaces the previous match. The target package is always queried last. When loading a package with more than one overlay, the order in which the overlays are added become significant if several packages overlay the same resource. Had downloaded overlays been supported, the install time could have been used to determine the load order. Regardless, for pre-installed overlays, the install time is randomly determined by the order in which the Package Manager locates the packages during initial boot. To support a well-defined order, pre-installed overlay packages are expected to define an additional 'priority' attribute in their <overlay> tags: <overlay targetPackage="com.target.package" priority="1234"/> Pre-installed overlays are loaded in order of their priority attributes, sorted in ascending order. Assigning the same priority to several overlays targeting the same base package leads to undefined behaviour. It is the responsibility of the vendor to avoid this. The following example shows the ResTable and PackageGroups after loading an application and two overlays. The resource lookup framework will query the packages in the order C, B, A. +------+------+- -+------+------+ | 0x01 | | ... | | 0x7f | +------+------+- -+------+------+ | | "android" Target package A | Pre-installed overlay B (priority 1) | Pre-installed overlay C (priority 2) Change-Id: If49c963149369b1957f7d2303b3dd27f669ed24e
* | New command line tool 'idmap'Mårten Kongstad2014-02-031-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new tool 'idmap' to handle generation and verification of idmap files. The tool is modelled on 'dexopt', and is intended to be used similarly, notably by 'installd'. See cmds/idmap/idmap.cpp for further documentation on 'idmap'. Note: this commit is interdependent on a commit in project build/ to add 'idmap' to PRODUCT_PACKAGES. Note: the changes to androidfw are only stubs. The actual implementation will be provided in Runtime resource overlay, iteration 2. Change-Id: I7131b74ece1e46c8a9c0a31d103e686aa07da2bb
* | Change ResourceType cookies to int32_t.Narayan Kamath2014-01-311-7/+6
|/ | | | | | | | | Also change the order of parameters in ResTable constructors to avoid ambiguity. (cherry picked from commit 00b314436f4fdfada4bbf1e79ec12e9fa38aeaf1) Change-Id: I874c5d03c134dc3c331fba423b5280366296287c
* Fix ResTable_config::CONFIG_* typo (MCC vs MNC)Mårten Kongstad2013-12-161-1/+1
| | | | | | | | | | | | | | In commit 08d5b8f, the ResTable_config::CONFIG_* enum was incorrectly changed to assign the same value to both CONFIG_MCC and CONFIG_MNC: - CONFIG_MCC = 0x0001, - CONFIG_MNC = 0x0002, + CONFIG_MCC = ACONFIGURATION_MCC, + CONFIG_MNC = ACONFIGURATION_MCC, This commit assigns CONFIG_MNC the value ACONFIGURATION_MNC, as intended. Change-Id: I3b8799914a55debdb3ff30a82ada7ad990c49970
* Resource memory optimization.Dianne Hackborn2013-07-311-4/+10
| | | | | | | | | | | Don't ever need the cached UTF-16 string conversions on the device. Don't need to create those strings, and don't need to create the lookup array for them at all. This requires fixing all of the remaining places in the platform where we interacted with the resources with the blind assumption that the strings are UTF-16. Change-Id: Ia0e5a150499837471e494e85b23b05fa06e0cf1d
* Move input library code to frameworks/native.Jeff Brown2013-07-011-2/+0
| | | | | | | | | No longer compile libandroidfw as a static library on the device since it already exists as a shared library. Keeping the static library would force us to provide a static library version of libinput for the device as well which doesn't make sense. Change-Id: I3517881b87b47dcc209d80dbd0ac6b5cf29a766f
* Allow compiling aapt for the deviceBjorn Bringert2013-04-261-1/+1
| | | | | | | | | | | | | | Changes: - The static device version of libandroidfw now includes the extra functions needed by aapt. I could only find a few host tools that use the static library, so this is hopefully not a problem. - The pseudolocalization code is moved into aapt. It was previously in libhost, but only used by aapt. Change-Id: Ib393ebb7dcebee8abbb628cbe5255ea1679674ac
* Implement issue #6646859: 4K!!!! 4K!!!! 4K!!!!Dianne Hackborn2013-02-121-0/+1
| | | | Change-Id: Ib05a2eb6a03db50074805a437a3639a7d10684a0
* Add support for "-rtl" in resourcesFabrice Di Meglio2012-08-231-2/+10
| | | | | | - fix bug #7035019 Need to have "-rtl" support for Resource Change-Id: Ic82145c2ac672729d8a6c695a5f343276a1a0a2c
* frameworks/base refactoring.Mathias Agopian2012-02-171-0/+1592
step 2: move libutils headers to their new home: androidfw Change-Id: I14624ba23db92a81f2cb929f104386e1fab293ef