AAPT: Version <adaptive-icon> to v26
Bug: 35908647
Change-Id: I307fb2f666cb8519adb9a7f676b87706dc6c683f
Test: manual
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index 15648bd..fdcc7aa 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -2501,14 +2501,21 @@
const size_t numConfigs = gp->getFiles().size();
for (size_t j = 0; j < numConfigs; j++) {
status_t err = NO_ERROR;
- if (ignoreConfig) {
- err = builder->getBaseSplit()->addEntry(gp->getPath(), gp->getFiles().valueAt(j));
- } else {
- err = builder->addEntry(gp->getPath(), gp->getFiles().valueAt(j));
+ const sp<AaptFile>& file = gp->getFiles().valueAt(j);
+ if (!file->hasData()) {
+ // Empty files do not get written.
+ continue;
}
+
+ if (ignoreConfig) {
+ err = builder->getBaseSplit()->addEntry(gp->getPath(), file);
+ } else {
+ err = builder->addEntry(gp->getPath(), file);
+ }
+
if (err != NO_ERROR) {
fprintf(stderr, "Failed to add %s (%s) to builder.\n",
- gp->getPath().string(), gp->getFiles()[j]->getPrintableSource().string());
+ gp->getPath().string(), file->getPrintableSource().string());
return err;
}
}