diff options
author | Adam Lesinski <adamlesinski@google.com> | 2015-05-14 14:25:36 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2015-05-15 15:10:58 -0700 |
commit | 2738c96d998dedfae5b4670d588d0cd299c4ca0f (patch) | |
tree | 76b8571676d42a9c0b3bfa00f1937eebf2c05698 /tools/aapt/AaptConfig.cpp | |
parent | 038959e851603500eb39b52fef33cbe75dbd73e3 (diff) |
Add -round and -notround qualifier to android runtime/aapt
The round qualifier denotes a device with a screen shape that
is round. The qualifier shows up after the 'long/notlong' qualifier
and before the orientation 'port/land/square' qualifiers.
Change-Id: I3044258b2703a9165694b79725bade770fa6cea1
Diffstat (limited to 'tools/aapt/AaptConfig.cpp')
-rw-r--r-- | tools/aapt/AaptConfig.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/tools/aapt/AaptConfig.cpp b/tools/aapt/AaptConfig.cpp index ede9e995b73a..b12867a0c135 100644 --- a/tools/aapt/AaptConfig.cpp +++ b/tools/aapt/AaptConfig.cpp @@ -123,6 +123,14 @@ bool parse(const String8& str, ConfigDescription* out) { part = parts[index].string(); } + if (parseScreenRound(part, &config)) { + index++; + if (index == N) { + goto success; + } + part = parts[index].string(); + } + if (parseOrientation(part, &config)) { index++; if (index == N) { @@ -241,7 +249,9 @@ void applyVersionForCompatibility(ConfigDescription* config) { } uint16_t minSdk = 0; - if (config->density == ResTable_config::DENSITY_ANY) { + if (config->screenLayout2 & ResTable_config::MASK_SCREENROUND) { + minSdk = SDK_MNC; + } else if (config->density == ResTable_config::DENSITY_ANY) { minSdk = SDK_LOLLIPOP; } else if (config->smallestScreenWidthDp != ResTable_config::SCREENWIDTH_ANY || config->screenWidthDp != ResTable_config::SCREENWIDTH_ANY @@ -395,7 +405,26 @@ bool parseScreenLayoutLong(const char* name, ResTable_config* out) { | ResTable_config::SCREENLONG_NO; return true; } + return false; +} +bool parseScreenRound(const char* name, ResTable_config* out) { + if (strcmp(name, kWildcardName) == 0) { + if (out) out->screenLayout2 = + (out->screenLayout2&~ResTable_config::MASK_SCREENROUND) + | ResTable_config::SCREENROUND_ANY; + return true; + } else if (strcmp(name, "round") == 0) { + if (out) out->screenLayout2 = + (out->screenLayout2&~ResTable_config::MASK_SCREENROUND) + | ResTable_config::SCREENROUND_YES; + return true; + } else if (strcmp(name, "notround") == 0) { + if (out) out->screenLayout2 = + (out->screenLayout2&~ResTable_config::MASK_SCREENROUND) + | ResTable_config::SCREENROUND_NO; + return true; + } return false; } |