summaryrefslogtreecommitdiff
path: root/cmds/idmap2/libidmap2
Commit message (Collapse)AuthorAgeFilesLines
* Merge changes I6da18cdb,I9de6ba64,I1af88c6d,I154783ff into sc-devRyan Mitchell2021-06-035-5/+18
|\ | | | | | | | | | | | | | | * changes: idmap2: fix cpplint warnings OMS: include idmap data in dump idmap2: create in-memory FRRO before creating file OMS: update shell command --help
| * idmap2: fix cpplint warningsMårten Kongstad2021-06-025-5/+18
| | | | | | | | | | | | Bug: 189963636 Test: frameworks/base/cmds/idmap2/static-checks.sh Change-Id: I6da18cdbbd2fc33db711696445230a9f316dc143
* | Disable incremental hardening on own resourcesRyan Mitchell2021-05-271-1/+1
|/ | | | | | | | | | | | | | | When an application is incrementally installed, and a resources operation fails due to the resources not being fully present, the app should crash instead of swallowing the error and returning default values to not alter the experience of using the application. Disable IncFsFileMap protections on ApkAssets that are a part of the application that is running (base and splits). Bug: 187220960 Test: atest ResourcesHardeningTest Change-Id: Ibc67aca688720f983c7c656f404593285a54999b
* OverlayManager Fabricated RROsRyan Mitchell2021-02-093-7/+35
| | | | | | | | | | | | | | | | | | | | | Adds registering and unregistering of FabricatedOverlay to the OMS. The process that creates the fabricated overlays owns it and is the only process allowed to unregister it. When a fabricated overlay is registered, overlay settings for it are initialized in all users. When a fabricated overlay is unregistered, it is disabled and removed from all users. When a new user is created, it will be able to use the fabricated overlay as well. On boot, fabricated overlays that are not referenced in overlay settings will be deleted. When the package that created the fabricated overlay is uninstalled, its fabricated overlays are also unregistered. Bug: 172471315 Test: atest OverlayDeviceTests Change-Id: I0539656f4c919246b13129579b0286c08a398dc2
* Add fabricated RRO generation to libidmap2Ryan Mitchell2021-02-0911-614/+931
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fabricated Runtime Resource Overlays are overlays that are generated at runtime and are stored in the data/ partition. The system can fabricate RROs at runtime to dynamically theme the device. Idmaps can now be created from APK RROs and fabricated RROs. Rather than operating on ApkAssets, libidmap2 now operates on abstract resource "containers" that supply resource values. Target resource containers implement methods needed to query overlayable and target overlay information. Currently only APKs can be loaded as target resource containers. Overlay resource containers implement methods to supply the mapping of target resource to overlay value and other overlay information. The format of a fabricated RRO is as follows: 0x00 - 0x04 : fabricated overlay magic (always FRRO) 0x04 - 0x08 : file format version 0x08 - 0x0c : crc of version + proto data 0x0c - EOF : proto fabricated overlay data The magic is used to quickly detect if the file is a fabricated overlay. The version is incremented whenever backwards incompatible changes are made to the proto file format. Idmap must always be able to upgrade fabricated overlays from previous versions to new versions, so all previous versions must be checked into the tree. Bug: 172471315 Test: libidmap2_tests && libandroidfw_tests Change-Id: I4c9f29da278672e5695fb57d131a44c11a835180
* Merge "Optimize FilterApkAssets by caching config"TreeHugger Robot2021-01-141-4/+2
|\
| * Optimize FilterApkAssets by caching configRyan Mitchell2021-01-131-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | ResTable_config of every ResTable_type is read from device every time AssetManager::RebuildFilterList is invoked. For large APKs (like framework-res.apk), this causes a large number of page faults when accessing the config from disk. The configs are also used in the slow path of AssetManager::FindEntryInternal, which makes it even slower. Instead cache the config on the TypeSpec of its ApkAsset. Bug: 177247024 Test: libandroidfw_tests Change-Id: I66d507c4eeb2399f7558f3d9dfc53c157129ada0
* | Fail idmap parsing earlier if version differsRyan Mitchell2021-01-131-2/+11
|/ | | | | | | | | | | | | Variable length strings are now in the idmap format. Idmap attempts to parse the old idmap files using the new format and can interpret old data as the length of a variable length string. Fail parsing idmap header early if the idmap magic or version differs from what is expected. Bug: 177295273 Test: boot, apply change, reboot Change-Id: I2914f11547424457fdb78de0ad03976e1fc81084
* Read manifest values using resource id in idmap2Ryan Mitchell2021-01-082-26/+50
| | | | | | | | | | | | | Idmap2 currently reads android:targetPackage and android:targetName from overlay manifests by looking for an attribute with the name of the attribute resource. This fixes the divergence from package parsing by finding the attributes using their resource ids. Bug: 175060836 Test: libidmap2_tests Change-Id: I09965e5880a1e6c48c3f8077db0c595484804ce7
* Accept --overlay-name flag in idmap2Ryan Mitchell2021-01-065-56/+56
| | | | | | | | | | | | | | | | | | To support allowing for multiple <overlay> tags in one package, idmap2 must be able to generate an idmap for an individual <overlay> tag. `idmap2 create` now accepts a --overlay-name flag that specifies which tag to use to generate the idmap. The value of --overlay-name should be set to the value of the android:name attribute on the <overlay> tag to use. If the flag is not present, idmap2 will look for an <overlay> tag with no value for android:name. Bug: 162841629 Test: libandroidfw_tests Test: libidmap2_tests Change-Id: I02316d0b88773f02c04a5d462be9825016fa496d
* Remove idmap path 256 length limitRyan Mitchell2021-01-065-93/+59
| | | | | | | | | | | | | Overlay and target package paths can be longer than 256 characters. Currently, the idmap will fail to be generated if either path is longer than 256 characters. This change removes the 256 character limit and makes parsing variable length strings easier in libandroidfw. Bug: 174676094 Test: idmap2_tests && libandroidfw_tests Change-Id: Ic240cdb8700566b2ac2ade08da58bea852e4ae0c
* Merge "Add explicit Result::ok() checks where needed" am: c08d3ef8a8 am: ↵Bernie Innocenti2020-12-221-1/+1
|\ | | | | | | | | | | | | | | | | | | ae613dd6c4 am: f454301ae6 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1532909 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I22f3e4f97d523bd09b898ebdf4de18114cb4c34f
| * Add explicit Result::ok() checks where neededBernie Innocenti2020-12-211-1/+1
| | | | | | | | | | | | Test: m checkbuild continuous_instrumentation_tests continuous_instrumentation_tests_api_coverage continuous_native_tests device-tests platform_tests Exempt-From-Owner-Approval: mechanical mass refactoring Change-Id: I3117833c51cdb333cccdfd159d1582f2adef77db
| * Revert^2 "libandroidfw hardening for IncFs"Ryan Mitchell2020-12-084-44/+42
| | | | | | | | | | | | | | 55ef6167a2c235bd88c7216238b2001b46795b79 Change-Id: I02d4890d181655dfd0a14c188468db512559d27b Merged-In: I02d4890d181655dfd0a14c188468db512559d27b
| * idmap2: remove the 'scan' commandMårten Kongstad2020-12-081-60/+0
| | | | | | | | | | | | | | | | | | | | | | | | The 'scan' command has been replaced by 'create-multiple'. Remove the unused code. Also remove unused functions and #includes from FileUtils, and the obsolete JNI plumbing. Test: atest idmap2_tests OverlayDeviceTests OverlayHostTests Change-Id: Iae073c13ce64b5db48f22f7e723bc8c0c5fcd2c9 Merged-In: Iae073c13ce64b5db48f22f7e723bc8c0c5fcd2c9
* | Revert^2 "libandroidfw hardening for IncFs"Ryan Mitchell2020-11-174-44/+42
| | | | | | | | | | | | 55ef6167a2c235bd88c7216238b2001b46795b79 Change-Id: I02d4890d181655dfd0a14c188468db512559d27b
* | Revert "libandroidfw hardening for IncFs"Ryan Mitchell2020-11-134-42/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | libandroidfw hardening for IncFsRyan Mitchell2020-11-124-44/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge changes I1d3e5e66,I86b869af,Iab4d3902,I645ee722 am: 72864d2930 am: ↵Treehugger Robot2020-10-195-131/+201
|\| | | | | | | | | | | | | | | 968582e45f am: cb2ebfc692 am: c59b81c978 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1461087 Change-Id: Ib58c1acbb9629a6654eb8e1666872974f0c75944
| * Fix <overlay-config-signature> commentsRyan Mitchell2020-10-141-3/+3
| | | | | | | | | | | | | | | | | | Fix comments that refer to <overlay-config-signature> as <config-signature>. Bug: none Test: build Change-Id: I1d3e5e66ec3da993082f3441997b0d243d61520b
| * Remove malloc/free for inline overlay valuesRyan Mitchell2020-10-145-128/+198
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove malloc/free of android::ResTable_entry for inline overlay values. Add `target_entry_inline` to the idmap format to encode inline overlay values separate from direct mapping of target resource to overlay resource. This reduces the number of bytes needed to represent a direct mapping of target resource to overlay resource from 9 bytes to 8 bytes per entry. Fixed all idmap alignment issues that required the framework to use "#pragma pack(push, 1)" when loading idmaps. Bug: 170341022 Test: idmap2_tests and libandroidfw_tests Change-Id: Iab4d3902508f02773464724913e0ee966e3689e4
| * OMS: Add config_signature policy handlingZoran Jovanovic2020-10-141-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Alongside SIGNATURE and ACTOR_SIGNATURE policies, add CONFIG_SIGNATURE policy to overlayable that overlay fulfills if it is signed with the same certificate as the reference package whose package name is declared in 'config-signature' tag of SystemConfig and is vetted by OMS that it's a system pre-installed package. BUG: 158726924 TEST: regular aapt2, idmap2, OMS tests Merged-In: I645ee72271496008742886274be0d63a2985201b Change-Id: I645ee72271496008742886274be0d63a2985201b
* | OMS: Add config_signature policy handlingZoran Jovanovic2020-07-281-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Alongside SIGNATURE and ACTOR_SIGNATURE policies, add CONFIG_SIGNATURE policy to overlayable that overlay fulfills if it is signed with the same certificate as the reference package whose package name is declared in 'config-signature' tag of SystemConfig and is vetted by OMS that it's a system pre-installed package. BUG: 158726924 TEST: regular aapt2, idmap2, OMS tests Change-Id: I645ee72271496008742886274be0d63a2985201b
* | idmap2: remove the 'scan' commandMårten Kongstad2020-07-201-60/+0
| | | | | | | | | | | | | | | | | | | | | | The 'scan' command has been replaced by 'create-multiple'. Remove the unused code. Also remove unused functions and #includes from FileUtils, and the obsolete JNI plumbing. Test: atest idmap2_tests OverlayDeviceTests OverlayHostTests Change-Id: Iae073c13ce64b5db48f22f7e723bc8c0c5fcd2c9
* | Merge "idmap2: Set aidl_return to true on success" into rvc-dev am: ↵TreeHugger Robot2020-06-101-6/+6
|\| | | | | | | | | | | | | | | 6700d5e48c am: 8f8122eed5 am: b0f11fa2cc am: 79013fbe59 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11795074 Change-Id: Ifb0a3fe0aad6d991002be2f11aecea23d56e916c
| * idmap2: Set aidl_return to true on successRyan Mitchell2020-06-091-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | idmap2d did not set the aidl return value to true when IdmapHeader::IsUpToDate succeeded. This regressed OMS initialization time. This change sets aidl_return to true when the header is up-to-date and also replaces usages of `uint32_t` for fulfilled_policies with `PolicyBitmask`. Bug: 158491243 Bug: 158535227 Bug: 158468195 Test: enable/disable overlays and onserve that verify succeeds Test: change the values of enforce overlayable and fulfilled policies and confirm that idmap verify fails Change-Id: If8febbfd0283d53211263690f85e2970706a33b7
* | idmap2: fix cpplint warningsMårten Kongstad2020-06-101-0/+2
|/ | | | | | | | | | | | | | | | | Fix the following to make cpplint happy again: - Use C++ style casts - Rename a few header guards - Add missing includes of standard C++ headers - Add comments to the end of namespaces Also, for consistency, always use "..." instead of <...> for local include files, i.e. #include "idmap2/.*" Test: cmds/idmap2/static-checks.sh Change-Id: Ie735a36d562d1fc51b61f1f0f45aec0d160f602d
* Add policies and enforce overlayable to headerRyan Mitchell2020-06-014-26/+55
| | | | | | | | | | | | | | | If the fulfilled policies change without the contents of the target and overlay APKs changing, the idmap for the overlay should be regenerated. This change adds fulfilled policies and enforce overlayable to the idmap header so that idmap2d can determine if the polices or enforce overlayable changed from what was used to generate the idmap. Bug: 119328308 Test: idmap2_tests Test: atest RegenerateIdmapTest Change-Id: I96f970e82b5243be01b205ac2cb6ab249c6100bc
* Reduce OMS start timeRyan Mitchell2020-04-281-17/+21
| | | | | | | | | | | | | | | | | | | This change attempts to reduce the amount of time initializing the OMS. The change: 1) Reduces the amount of time between subsequent attempts to connect to the idmap2d service when it is not alive. 2) Caches package infos retrieved from getOverlayPackages 3) Caches the crc of the android package to preventing having to retrieve it for every overlay package targeting the framework This chance reduced OMS start up time from ~500ms to ~100ms on a Pixel 3. If the idmap2d service is running when system sever starts then start up time will be around ~70ms. Bug: 151481016 Test: adb shell stop && adb shell start && [capture trace] Change-Id: I6137c385baf099413b62e98557419fffb9fd2d93
* Refactor overlayable policyWinson2020-02-263-91/+68
| | | | | | | | | | | | | | | | | | | | To make it easier to add the actor policy in a follow up CL, move most of the policy handling to a central location. The strings and transformation between strings and flags is now handled in libidmap2policies, with libandroidfw containing the single source of policy flags. This also extracts all the test resource IDs into an R.h so they can be swapped without having to edit a dozen files each time. Bug: 130563563 Test: m aapt2_tests idmapt2_tests and run from host test output Test: atest libandroidfw_tests Change-Id: Ie533c9cebf938215df7586f00c38763ae467e606
* Fix resourcesMap to work with shared librariesRyan Mitchell2020-02-062-8/+15
| | | | | | | | | | android:resourcesMap is not working at all with shared libraries. This change fixes that so overlays built as shared libraries can use the attribute. Bug: None Test: idmap2_tests Change-Id: I767481f88c58892a3818a919616056291b09b57e
* Allow for overlaying dynamic shared librariesRyan Mitchell2020-01-101-1/+11
| | | | | | | | | | | | | | | | Overlays targeting shared libraries should be loaded into the resources of every target that depends on the shared library. Static shared libraries are currently not supported because overlays should override all versions of static shared libraries and there is not currently support for an overlay targeting multiple APKs. Also created a test instrumentation and host test suite for testing overlays and packages on the system image. Bug: 140790224 Test: atest OverlayRemountedTest Change-Id: I20a217b6368d6cf92b2b9f46908fd58012933f72
* idmap2: add sections to 'idmap2 dump' outputMårten Kongstad2019-12-201-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the introduction of the debug info, the output of 'idmap2 dump' is becoming messy. Add sections to combat this. Example output: $ idmap2 create \ --target-apk-path frameworks/base/cmds/idmap2/tests/data/target/target.apk \ --overlay-apk-path frameworks/base/cmds/idmap2/tests/data/overlay/overlay.apk \ --idmap-path /tmp/a.idmap \ --policy public \ --policy oem $ idmap2 dump --idmap-path /tmp/a.idmap Paths: target apk path : frameworks/base/cmds/idmap2/tests/data/target/target.apk overlay apk path : frameworks/base/cmds/idmap2/tests/data/overlay/overlay.apk Debug info: I fulfilled_policies=oem|public enforce_overlayable=true W failed to find resource "integer/not_in_target" in target resources Mapping: 0x7f010000 -> 0x7f010000 integer/int1 0x7f02000c -> 0x7f020000 string/str1 [...] Test: idmap2_tests Change-Id: Ie42f97484b31af0c0b34f1856d321533904dbf7a
* idmap2: add debug information to idmap file formatMårten Kongstad2019-12-195-24/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new variable length string to the idmap file format. This string will hold debug information like fulfilled policies and any warnings triggered while generating the file. Bump the idmap version to 3. Adjust the idmap header definition in ResourceType.h to take the new string into account. Example debug info: $ idmap2 create \ --target-apk-path frameworks/base/cmds/idmap2/tests/data/target/target.apk \ --overlay-apk-path frameworks/base/cmds/idmap2/tests/data/overlay/overlay.apk \ --idmap-path /tmp/a.idmap \ --policy public \ --policy oem $ idmap2 dump --idmap-path /tmp/a.idmap target apk path : frameworks/base/cmds/idmap2/tests/data/target/target.apk overlay apk path : frameworks/base/cmds/idmap2/tests/data/overlay/overlay.apk I fulfilled_policies=oem|public enforce_overlayable=true W failed to find resource "integer/not_in_target" in target resources 0x7f010000 -> 0x7f010000 integer/int1 0x7f02000c -> 0x7f020000 string/str1 [...] $ idmap2 dump --idmap-path /tmp/a.idmap --verbose 00000000: 504d4449 magic 00000004: 00000003 version 00000008: 76a20829 target crc 0000000c: c054fb26 overlay crc 00000010: ........ target path: frameworks/base/cmds/idmap2/tests/data/target/target.apk 00000110: ........ overlay path: frameworks/base/cmds/idmap2/tests/data/overlay/overlay.apk 00000210: ........ debug info: ... 00000294: 7f target package id 00000295: 7f overlay package id [...] Also, tell cpplint to accept non-const references as function parameters: they make more sense as out-parameters than pointers that are assumed to be non-null. Also, switch to regular expressions in the RawPrintVisitorTests: no more manual fixups of the stream offsets! Tell cpplint that the <regex> header is OK to use. Bug: 140790707 Test: idmap2_tests Change-Id: Ib94684a3b4001240321801e21af8e132fbcf6609
* Idmap format changes for bidirectional lookupRyan Mitchell2019-10-176-162/+242
| | | | | | | | | | | | | | | | | | This change modifies the idmap file format to allow for target resources to map to arbitrary type/value combinations and to allow overlay resources to be mapped back to target resource ids so references to overlay resources can appear as references to target resources at runtime. The mappings of target resources to overlay resources and vice-versa are both encoded as sparse arrays. Instead of looking up a resource by indexing into an array that maps to the overlay resource id, the runtime will binary search over the sparse array to find the type and value that overlays the target resource. Bug: 135943783 Test: idmap2_tests Change-Id: I5d5344cdb7fe35f4f2e8d6781016299dea5d1e20
* Parse <overlay> and abstract resource mappingRyan Mitchell2019-10-043-172/+476
| | | | | | | | | | | | | | | This change introduces idmap parsing of <overlay> tags. The <overlay> tag allows one to explicitly map resources in the target to either a resource in the overlay or an inline attribute value. Use the android:resourcesMap atttribute on the <overlay> tag in the android manifest to specify a file to provide the resource mapping. Bug: 135943783 Bug: 135051420 Test: idmap2_tests Change-Id: I1740dcdc01849c43b1f2cb8c6645d666dbb05dba
* Improve idmap2 xml parsingRyan Mitchell2019-10-043-104/+200
| | | | | | | | | | | | | | | | | To parse the <overlay> tags for internal overlay references, we require the ability to parse XML. The current implementation only allows idmap2 to find a tag somewhere in an xml file. This implementation allows for the retrieval of an iterator that iterates over direct children xml elements. Now we can enforce that the <overlay> tag in the manifest is nested within the <manifest> tag and we can ensure <item> tags are within the <overlay> tags of the overlay resource configuration xml. Bug: 135051420 Bug: 135943783 Test: idmap2_tests Change-Id: I12f965b55c18960af6cf9dc6ca46429f53124c9a
* Merge "Revert "Improve idmap2 xml parsing""Ryan Mitchell2019-10-023-200/+104
|\
| * Revert "Improve idmap2 xml parsing"Ryan Mitchell2019-10-023-200/+104
| | | | | | | | | | | | | | | | This reverts commit 58cdc2a8226e8618331a81c1e1b77a4421bb5629. Reason for revert: <aosp/1129572 caused a build failure> Change-Id: Iecae19877dacf9ec5c2b2bc59dca362f573e9a7a
* | Merge "Add requiredSystemPropertyValue support in idmap2" am: b30f65713f am: ↵Ryan Mitchell2019-10-021-0/+10
|\ \ | |/ |/| | | | | | | | | | | fa9362aec9 am: b8a749dac6 am: 042900cf9a Change-Id: I8b7f30cc8088b4d04856358e7f1ffc18159b1b7f
| * Add requiredSystemPropertyValue support in idmap2Gabriel Siqueira2019-09-271-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up to Android P, there was this feature were we are able to define "requiredSystemPropertyValue" in the AndroidManifest.xml of the RRO apk, so that it will only be loaded if requiredSystemPropertyValue/requiredSystemPropertyName are matched. Porting support from idmap https://android.googlesource.com/platform/frameworks/base/+/master/cmds/idmap/scan.cpp#135 To idmap2 https://android.googlesource.com/platform/frameworks/base/+/master/cmds/idmap2/idmap2/Scan.cpp#175 Bug: 140891738 Change-Id: I47752af93efa4563a60e336c1e1b1ffc081b51ec
* | Improve idmap2 xml parsingRyan Mitchell2019-10-013-104/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To parse the <overlay> tags for internal overlay references, we require the ability to parse XML. The current implementation only allows idmap2 to find a tag somewhere in an xml file. This implementation allows for the retrieval of an iterator that iterates over direct children xml elements. Now we can enforce that the <overlay> tag in the manifest is nested within the <manifest> tag and we can ensure <item> tags are within the <overlay> tags of the overlay resource configuration xml. Bug: 135051420 Bug: 135943783 Test: idmap2_tests Change-Id: I1a1c4329514eb63b7575c4376adc0d8cda217269
* | idmap2: ZipFile::Open: fix potential memory leakMårten Kongstad2019-09-261-0/+1
|/ | | | | | | | | Even if OpenArchive in libziparchive returns a non-zero value (indicating failure), it will have allocated memory that needs to be freed via CloseArchive. Add the missing call. Test: valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 $ANDROID_HOST_OUT/nativetest64/idmap2_tests/idmap2_tests Change-Id: I92d47459c27e62ba4544327d7b7f3c4106e6ad34
* libidmap2: track libziparchive API change.Elliott Hughes2019-05-061-2/+2
| | | | | | Bug: http://b/129068177 Test: treehugger Change-Id: Id1e855d17cde15b2db37df5e192e2011c60eaebe
* Add odm and oem policiesRyan Mitchell2019-04-172-17/+25
| | | | | | | | | This change adds parsing, encoding, and validating of odm and oem overlayable policies to aapt2, libandroidfw, and idmap2. Bug: 121033532 Test: aapt2_tests, idmap2_tests Change-Id: Ifc0d4b6c9f9c37e06b2988abade69dbb277c50c2
* Run idmap2 static-checks and fix formatting issuesRyan Mitchell2019-04-1511-23/+24
| | | | | | Bug: 130324774 Test: builds Change-Id: I2cf9d3aa268ffe38e525fadee9d81fc6aefe19b1
* Fix idmap2 policy concatenationRyan Mitchell2019-04-031-4/+2
| | | | | | | | | | When printing warning messages while generating idmaps, put the vertical bar chracater in between the policies. Bug: none Test: manual Change-Id: I8efee753d9ed7ce99ccafd49b6c8744eea031839
* Merge "idmap2: move Idmap.h to Result"TreeHugger Robot2019-03-211-44/+29
|\
| * idmap2: move Idmap.h to ResultMårten Kongstad2019-03-201-44/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the signatures of Idmap::FromApkAssets and Idmap::FromBinaryStream from std::unique_ptr<const Idmap> func(..., std::ostream& out_error); to Result<std::unique_ptr<const Idmap>> func(...); The returned pointer is still a unique pointer to ensure the dynamically allocated memory is automatically released when no longer used. This means that using the returned value of either function requires one of two patterns: const auto idmap = func(...); if (!idmap) { return Error(...); } (*idmap)->accept(...); or auto result = func(...); if (!result) { return Error(...); } const auto idmap = std::move(*result); idmap->accept(...); Note that in the second example, result must be non-const or the call to std::move(*result) will not compile. With this change, the entire idmap2 project has been converted to use Result. Test: make idmap2_tests Change-Id: I533f4e03b99645523d94dd5f446ad76fb435f661
* | idmap2: clang-formatMårten Kongstad2019-03-201-1/+1
|/ | | | | Test: cmds/idmap2/static-checks.sh Change-Id: I17a0268058156373e9af1e00a7bcca5a8cc8f100