diff options
author | Adam Lesinski <adamlesinski@google.com> | 2016-02-13 20:26:45 -0800 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2016-02-17 18:17:25 -0800 |
commit | 355f285ffd000f6cfe76680eb22d010546d124bb (patch) | |
tree | 94d86559ba73ed2f482af1f296ef56374776a8f6 /tools/aapt2/ResourceTable.cpp | |
parent | e4735a99598bf29847a9f12dd7fae6d7df880bc4 (diff) |
AAPT2: Implement density stripping and initial Split support
When a preferred density is supplied, the closest matching densities
will be selected, the rest stripped from the APK.
Split support will be enabled in a later CL. Command line support is still
needed, but the foundation is ready.
Bug:25958912
Change-Id: I56d599806b4ec4ffa24e17aad48d47130ca05c08
Diffstat (limited to 'tools/aapt2/ResourceTable.cpp')
-rw-r--r-- | tools/aapt2/ResourceTable.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/tools/aapt2/ResourceTable.cpp b/tools/aapt2/ResourceTable.cpp index 3e73be4dbc54..8d734f3fc36d 100644 --- a/tools/aapt2/ResourceTable.cpp +++ b/tools/aapt2/ResourceTable.cpp @@ -277,20 +277,31 @@ bool ResourceTable::addFileReference(const ResourceNameRef& name, const Source& source, const StringPiece16& path, IDiagnostics* diag) { - return addFileReference(name, config, source, path, resolveValueCollision, diag); + return addFileReferenceImpl(name, config, source, path, nullptr, kValidNameChars, diag); } -bool ResourceTable::addFileReference(const ResourceNameRef& name, - const ConfigDescription& config, - const Source& source, - const StringPiece16& path, - std::function<int(Value*,Value*)> conflictResolver, - IDiagnostics* diag) { +bool ResourceTable::addFileReferenceAllowMangled(const ResourceNameRef& name, + const ConfigDescription& config, + const Source& source, + const StringPiece16& path, + io::IFile* file, + IDiagnostics* diag) { + return addFileReferenceImpl(name, config, source, path, file, kValidNameMangledChars, diag); +} + +bool ResourceTable::addFileReferenceImpl(const ResourceNameRef& name, + const ConfigDescription& config, + const Source& source, + const StringPiece16& path, + io::IFile* file, + const char16_t* validChars, + IDiagnostics* diag) { std::unique_ptr<FileReference> fileRef = util::make_unique<FileReference>( stringPool.makeRef(path)); fileRef->setSource(source); + fileRef->file = file; return addResourceImpl(name, ResourceId{}, config, StringPiece{}, std::move(fileRef), - kValidNameChars, conflictResolver, diag); + kValidNameChars, resolveValueCollision, diag); } bool ResourceTable::addResourceAllowMangled(const ResourceNameRef& name, |