summaryrefslogtreecommitdiff
path: root/tools/aapt/AaptConfig.cpp
diff options
context:
space:
mode:
author Adam Lesinski <adamlesinski@google.com> 2014-11-05 19:31:22 +0000
committer android-build-merger <android-build-merger@google.com> 2014-11-05 19:31:22 +0000
commitfb96e54ba8d43a9f3162c92760e53ab61c7486ff (patch)
tree6bdef8acddc2e1f7c97826ad07e0d99ee4fee898 /tools/aapt/AaptConfig.cpp
parenta72b2228c278363c2ff5bd38f9a8b36e3c4cd70c (diff)
parent69ecfa903492b502b7b1636345e050b57313c251 (diff)
Merge "Add error checking to aapt for split generation" into lmp-mr1-dev
automerge: 69ecfa9 * commit '69ecfa903492b502b7b1636345e050b57313c251': Add error checking to aapt for split generation
Diffstat (limited to 'tools/aapt/AaptConfig.cpp')
-rw-r--r--tools/aapt/AaptConfig.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/aapt/AaptConfig.cpp b/tools/aapt/AaptConfig.cpp
index f447462ae975..848d9a1b3b91 100644
--- a/tools/aapt/AaptConfig.cpp
+++ b/tools/aapt/AaptConfig.cpp
@@ -794,4 +794,23 @@ bool isSameExcept(const ResTable_config& a, const ResTable_config& b, int axisMa
return a.diff(b) == axisMask;
}
+bool isDensityOnly(const ResTable_config& config) {
+ if (config.density == ResTable_config::DENSITY_NONE) {
+ return false;
+ }
+
+ if (config.density == ResTable_config::DENSITY_ANY) {
+ if (config.sdkVersion != SDK_L) {
+ // Someone modified the sdkVersion from the default, this is not safe to assume.
+ return false;
+ }
+ } else if (config.sdkVersion != SDK_DONUT) {
+ return false;
+ }
+
+ const uint32_t mask = ResTable_config::CONFIG_DENSITY | ResTable_config::CONFIG_VERSION;
+ const ConfigDescription nullConfig;
+ return (nullConfig.diff(config) & ~mask) == 0;
+}
+
} // namespace AaptConfig