diff options
author | 2014-11-05 12:30:25 -0800 | |
---|---|---|
committer | 2014-11-05 12:30:25 -0800 | |
commit | 685d363d7a3e8833edc9368a3c59b69755e0ba29 (patch) | |
tree | e04662b84ae8cc05665206336a148928c23b7cab /tools/aapt/AaptConfig.cpp | |
parent | b3d260222fd003c8b537bb9f86625a200bd0f999 (diff) | |
parent | fb96e54ba8d43a9f3162c92760e53ab61c7486ff (diff) |
Merge commit 'fb96e54' into manualmerge
Conflicts:
tools/aapt/Resource.cpp
Change-Id: I4147c3550e9426f3429146eaeb16f10ba76b5b15
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 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 |