New aapt feature to do smarter filtering of configurations.
This adds a --preferred-configurations flag that specifies the
specific configurations you would like to have.
It is smarter than "-c" because it will avoid stripping a
configuration if that would result in there being no value
for the resource.
It is dumber than "-c" because it can't process as many kinds
of resources. It is really only intended for bitmaps and use
with density configs.
This required re-arranging AaptAssets to group files together
by config again, like they used to be. I think this hasn't
broken anything. Hopefully.
Change-Id: I4e9d12ff6e6dbd1abb8fd4cb1814c6674b19d0e5
diff --git a/tools/aapt/ResourceFilter.h b/tools/aapt/ResourceFilter.h
new file mode 100644
index 0000000..647b7bb
--- /dev/null
+++ b/tools/aapt/ResourceFilter.h
@@ -0,0 +1,33 @@
+//
+// Copyright 2011 The Android Open Source Project
+//
+// Build resource files from raw assets.
+//
+
+#ifndef RESOURCE_FILTER_H
+#define RESOURCE_FILTER_H
+
+#include "AaptAssets.h"
+
+/**
+ * Implements logic for parsing and handling "-c" and "--preferred-configurations"
+ * options.
+ */
+class ResourceFilter
+{
+public:
+ ResourceFilter() : mData(), mContainsPseudo(false) {}
+ status_t parse(const char* arg);
+ bool isEmpty() const;
+ bool match(int axis, uint32_t value) const;
+ bool match(int axis, const ResTable_config& config) const;
+ bool match(const ResTable_config& config) const;
+ const SortedVector<uint32_t>* configsForAxis(int axis) const;
+ inline bool containsPseudo() const { return mContainsPseudo; }
+
+private:
+ KeyedVector<int,SortedVector<uint32_t> > mData;
+ bool mContainsPseudo;
+};
+
+#endif