diff options
author | Adam Lesinski <adamlesinski@google.com> | 2014-11-03 12:03:08 -0800 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2014-11-03 15:55:44 -0800 |
commit | de7de47fef1dcaa26d553665d89e4d3792325c3f (patch) | |
tree | 0d9551d2f037b841f325bbbd3ba27a309e9441b3 /tools/aapt/AaptConfig.cpp | |
parent | f7ffcaa7a478eaafc121e84b14dcaf2503dd5457 (diff) | |
download | frameworks_base-de7de47fef1dcaa26d553665d89e4d3792325c3f.zip frameworks_base-de7de47fef1dcaa26d553665d89e4d3792325c3f.tar.gz frameworks_base-de7de47fef1dcaa26d553665d89e4d3792325c3f.tar.bz2 |
Add error checking to aapt for split generation
Change-Id: Ica627db6a671f6a6c35f98bfd9c03598ffe103ce
Diffstat (limited to 'tools/aapt/AaptConfig.cpp')
-rw-r--r-- | tools/aapt/AaptConfig.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/aapt/AaptConfig.cpp b/tools/aapt/AaptConfig.cpp index f447462..848d9a1 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 |