summaryrefslogtreecommitdiff
path: root/tools/aapt/AaptConfig.cpp
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2017-01-18 16:34:42 -0800
committer Romain Guy <romainguy@google.com> 2017-01-19 18:44:00 -0800
commitc9ba55902123be5abcf2dcda5af9995be0b8d3d8 (patch)
tree953bf264c1f748816ad8ebc4898f580d163ce959 /tools/aapt/AaptConfig.cpp
parenta2b1774d758b58fc5977f631eff76fa21d303906 (diff)
Add wide color gamut and HDR resource qualifiers
Bug: 32984164 Test: Config_test, AaptConfig_test and aapt2_tests Change-Id: Ie9c82bfe2d36b1d6180ee223250ab5bb2ce90dd4
Diffstat (limited to 'tools/aapt/AaptConfig.cpp')
-rw-r--r--tools/aapt/AaptConfig.cpp60
1 files changed, 59 insertions, 1 deletions
diff --git a/tools/aapt/AaptConfig.cpp b/tools/aapt/AaptConfig.cpp
index 565d2f0a0549..d0026a28ba16 100644
--- a/tools/aapt/AaptConfig.cpp
+++ b/tools/aapt/AaptConfig.cpp
@@ -131,6 +131,22 @@ bool parse(const String8& str, ConfigDescription* out) {
part = parts[index].string();
}
+ if (parseWideColorGamut(part, &config)) {
+ index++;
+ if (index == N) {
+ goto success;
+ }
+ part = parts[index].string();
+ }
+
+ if (parseHdr(part, &config)) {
+ index++;
+ if (index == N) {
+ goto success;
+ }
+ part = parts[index].string();
+ }
+
if (parseOrientation(part, &config)) {
index++;
if (index == N) {
@@ -250,7 +266,9 @@ void applyVersionForCompatibility(ConfigDescription* config) {
uint16_t minSdk = 0;
if ((config->uiMode & ResTable_config::MASK_UI_MODE_TYPE)
- == ResTable_config::UI_MODE_TYPE_VR_HEADSET) {
+ == ResTable_config::UI_MODE_TYPE_VR_HEADSET
+ || config->colorimetry & ResTable_config::MASK_WIDE_COLOR_GAMUT
+ || config->colorimetry & ResTable_config::MASK_HDR) {
minSdk = SDK_O;
} else if (config->screenLayout2 & ResTable_config::MASK_SCREENROUND) {
minSdk = SDK_MNC;
@@ -431,6 +449,46 @@ bool parseScreenRound(const char* name, ResTable_config* out) {
return false;
}
+bool parseWideColorGamut(const char* name, ResTable_config* out) {
+ if (strcmp(name, kWildcardName) == 0) {
+ if (out) out->colorimetry =
+ (out->colorimetry&~ResTable_config::MASK_WIDE_COLOR_GAMUT)
+ | ResTable_config::WIDE_COLOR_GAMUT_ANY;
+ return true;
+ } else if (strcmp(name, "widecg") == 0) {
+ if (out) out->colorimetry =
+ (out->colorimetry&~ResTable_config::MASK_WIDE_COLOR_GAMUT)
+ | ResTable_config::WIDE_COLOR_GAMUT_YES;
+ return true;
+ } else if (strcmp(name, "nowidecg") == 0) {
+ if (out) out->colorimetry =
+ (out->colorimetry&~ResTable_config::MASK_WIDE_COLOR_GAMUT)
+ | ResTable_config::WIDE_COLOR_GAMUT_NO;
+ return true;
+ }
+ return false;
+}
+
+bool parseHdr(const char* name, ResTable_config* out) {
+ if (strcmp(name, kWildcardName) == 0) {
+ if (out) out->colorimetry =
+ (out->colorimetry&~ResTable_config::MASK_HDR)
+ | ResTable_config::HDR_ANY;
+ return true;
+ } else if (strcmp(name, "highdr") == 0) {
+ if (out) out->colorimetry =
+ (out->colorimetry&~ResTable_config::MASK_HDR)
+ | ResTable_config::HDR_YES;
+ return true;
+ } else if (strcmp(name, "lowdr") == 0) {
+ if (out) out->colorimetry =
+ (out->colorimetry&~ResTable_config::MASK_HDR)
+ | ResTable_config::HDR_NO;
+ return true;
+ }
+ return false;
+}
+
bool parseOrientation(const char* name, ResTable_config* out) {
if (strcmp(name, kWildcardName) == 0) {
if (out) out->orientation = out->ORIENTATION_ANY;