diff options
| author | 2017-02-02 22:38:40 +0000 | |
|---|---|---|
| committer | 2017-02-03 18:57:09 +0000 | |
| commit | 2968cbf4aa67e952d79dd57e39806dbe92a0148e (patch) | |
| tree | 77988c62bdfe8ddd5215c71f956fb1ba7f73ea11 | |
| parent | fc866baa333a60a988208293fa2eb99d7e90d427 (diff) | |
Strip the resources from the APK using the TableSplitter.
Test: Unit tests pass.
Change-Id: I1dd71581113fb9a6feeefa9c794cc282529c3754
| -rw-r--r-- | tools/aapt2/strip/Strip.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/aapt2/strip/Strip.cpp b/tools/aapt2/strip/Strip.cpp index ac3f244b090f..c34cfbf3580e 100644 --- a/tools/aapt2/strip/Strip.cpp +++ b/tools/aapt2/strip/Strip.cpp @@ -22,6 +22,7 @@ #include "Diagnostics.h" #include "Flags.h" #include "LoadedApk.h" +#include "split/TableSplitter.h" using android::StringPiece; @@ -78,7 +79,21 @@ class StripCommand { context_->GetDiagnostics()->Note(DiagMessage() << "Stripping APK..."); } - // TODO(lecesne): Implement stripping here. + // TODO(lecesne): Add support for more than one density. + if (options_.target_configs.size() > 1) { + context_->GetDiagnostics()->Error(DiagMessage() + << "Multiple densities not supported at the moment"); + return 1; + } + + // Stripping the APK using the TableSplitter with no splits and the target + // density as the preferred density. The resource table is modified in + // place in the LoadedApk. + TableSplitterOptions splitter_options; + splitter_options.preferred_density = options_.target_configs[0].density; + std::vector<SplitConstraints> splits; + TableSplitter splitter(splits, splitter_options); + splitter.SplitTable(apk->GetResourceTable()); std::unique_ptr<IArchiveWriter> writer = CreateZipFileArchiveWriter(context_->GetDiagnostics(), options_.output_path); |