Add new aapt flag --error-on-missing-config-entry

It forces aapt to return an error if aapt fails to find an resource
entry for a configuration.

Bug: 11259444
Change-Id: Ie5674a29dff5d4455e7d7c94f6b25560fb1305b7
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index f2e5254..5c3019d 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -2971,13 +2971,21 @@
                 tHeader->header.size = htodl(data->getSize()-typeStart);
             }
 
+            bool missing_entry = false;
+            const char* log_prefix = bundle->getErrorOnMissingConfigEntry() ?
+                    "error" : "warning";
             for (size_t i = 0; i < N; ++i) {
                 if (!validResources[i]) {
                     sp<ConfigList> c = t->getOrderedConfigs().itemAt(i);
-                    fprintf(stderr, "warning: no entries written for %s/%s\n",
+                    fprintf(stderr, "%s: no entries written for %s/%s\n", log_prefix,
                             String8(typeName).string(), String8(c->getName()).string());
+                    missing_entry = true;
                 }
             }
+            if (bundle->getErrorOnMissingConfigEntry() && missing_entry) {
+                fprintf(stderr, "Error: Missing entries, quit!\n");
+                return NOT_ENOUGH_DATA;
+            }
         }
 
         // Fill in the rest of the package information.