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
diff --git a/tools/aapt2/ResourceTable.h b/tools/aapt2/ResourceTable.h
index 8ffff1f..7f5c2b8 100644
--- a/tools/aapt2/ResourceTable.h
+++ b/tools/aapt2/ResourceTable.h
@@ -23,6 +23,7 @@
#include "ResourceValues.h"
#include "Source.h"
#include "StringPool.h"
+#include "io/File.h"
#include <android-base/macros.h>
#include <map>
@@ -202,17 +203,17 @@
IDiagnostics* diag);
bool addFileReference(const ResourceNameRef& name,
- const ConfigDescription& config,
- const Source& source,
- const StringPiece16& path,
- IDiagnostics* diag);
+ const ConfigDescription& config,
+ const Source& source,
+ const StringPiece16& path,
+ IDiagnostics* diag);
- bool addFileReference(const ResourceNameRef& name,
- const ConfigDescription& config,
- const Source& source,
- const StringPiece16& path,
- std::function<int(Value*,Value*)> conflictResolver,
- IDiagnostics* diag);
+ bool addFileReferenceAllowMangled(const ResourceNameRef& name,
+ const ConfigDescription& config,
+ const Source& source,
+ const StringPiece16& path,
+ io::IFile* file,
+ IDiagnostics* diag);
/**
* Same as addResource, but doesn't verify the validity of the name. This is used
@@ -280,6 +281,14 @@
private:
ResourceTablePackage* findOrCreatePackage(const StringPiece16& name);
+ bool addFileReferenceImpl(const ResourceNameRef& name,
+ const ConfigDescription& config,
+ const Source& source,
+ const StringPiece16& path,
+ io::IFile* file,
+ const char16_t* validChars,
+ IDiagnostics* diag);
+
bool addResourceImpl(const ResourceNameRef& name,
ResourceId resId,
const ConfigDescription& config,