summaryrefslogtreecommitdiff
path: root/libs/androidfw/include
diff options
context:
space:
mode:
author Ryan Mitchell <rtmitchell@google.com> 2019-01-24 10:58:23 -0800
committer Ryan Mitchell <rtmitchell@google.com> 2019-02-20 09:46:00 -0800
commita55dc2ed6bf2b4e6ad0ab2d1ae501bf7ec4c1e15 (patch)
treeae357da8ff44ed100c7444ce8b89b4c32ef9dd53 /libs/androidfw/include
parentde19d80f378fb1930e396ef8b5b27764b6a8b2d3 (diff)
Fix long paths on Windows
util::mkdirs iteratively creates each directory of a specified path. For windows, Calling mkdir on only the drive letter or on the extended path prefix (\?\\) will result in an error. Start after the long path prefix and the drive letter. This also changes AAPT2 to use AssetMaanager2 to retrieve symbols from the symbol table. AssetManager2's zip library uses _wopen to open windows files. Bug:123251200 Test: aapt2_tests.exe Change-Id: I26169d83b22d441485de3c49d63a6c4ed710e292
Diffstat (limited to 'libs/androidfw/include')
-rw-r--r--libs/androidfw/include/androidfw/AssetManager2.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/libs/androidfw/include/androidfw/AssetManager2.h b/libs/androidfw/include/androidfw/AssetManager2.h
index fc5aa9c7f1b9..1e2b36cb1703 100644
--- a/libs/androidfw/include/androidfw/AssetManager2.h
+++ b/libs/androidfw/include/androidfw/AssetManager2.h
@@ -257,11 +257,12 @@ class AssetManager2 {
// Creates a new Theme from this AssetManager.
std::unique_ptr<Theme> NewTheme();
- template <typename Func>
- void ForEachPackage(Func func) const {
+ void ForEachPackage(const std::function<bool(const std::string&, uint8_t)> func) const {
for (const PackageGroup& package_group : package_groups_) {
- func(package_group.packages_.front().loaded_package_->GetPackageName(),
- package_group.dynamic_ref_table.mAssignedPackageId);
+ if (!func(package_group.packages_.front().loaded_package_->GetPackageName(),
+ package_group.dynamic_ref_table.mAssignedPackageId)) {
+ return;
+ }
}
}
@@ -282,10 +283,13 @@ class AssetManager2 {
// care about the value. In this case, the value of `FindEntryResult::type_flags` is incomplete
// and should not be used.
//
+ // When `ignore_configuration` is true, FindEntry will return always select the first entry in
+ // for the type seen regardless of its configuration.
+ //
// NOTE: FindEntry takes care of ensuring that structs within FindEntryResult have been properly
// bounds-checked. Callers of FindEntry are free to trust the data if this method succeeds.
ApkAssetsCookie FindEntry(uint32_t resid, uint16_t density_override, bool stop_at_first_match,
- FindEntryResult* out_entry) const;
+ bool ignore_configuration, FindEntryResult* out_entry) const;
// Assigns package IDs to all shared library ApkAssets.
// Should be called whenever the ApkAssets are changed.