diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/aapt/AaptConfig.cpp | 10 | ||||
-rw-r--r-- | tools/aapt/SdkConstants.h | 3 | ||||
-rw-r--r-- | tools/aapt2/ConfigDescription.cpp | 10 | ||||
-rw-r--r-- | tools/aapt2/ConfigDescription_test.cpp | 8 | ||||
-rw-r--r-- | tools/aapt2/SdkConstants.h | 3 |
5 files changed, 32 insertions, 2 deletions
diff --git a/tools/aapt/AaptConfig.cpp b/tools/aapt/AaptConfig.cpp index b12867a0c135..565d2f0a0549 100644 --- a/tools/aapt/AaptConfig.cpp +++ b/tools/aapt/AaptConfig.cpp @@ -249,7 +249,10 @@ void applyVersionForCompatibility(ConfigDescription* config) { } uint16_t minSdk = 0; - if (config->screenLayout2 & ResTable_config::MASK_SCREENROUND) { + if ((config->uiMode & ResTable_config::MASK_UI_MODE_TYPE) + == ResTable_config::UI_MODE_TYPE_VR_HEADSET) { + minSdk = SDK_O; + } else if (config->screenLayout2 & ResTable_config::MASK_SCREENROUND) { minSdk = SDK_MNC; } else if (config->density == ResTable_config::DENSITY_ANY) { minSdk = SDK_LOLLIPOP; @@ -477,6 +480,11 @@ bool parseUiModeType(const char* name, ResTable_config* out) { (out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE) | ResTable_config::UI_MODE_TYPE_WATCH; return true; + } else if (strcmp(name, "vrheadset") == 0) { + if (out) out->uiMode = + (out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE) + | ResTable_config::UI_MODE_TYPE_VR_HEADSET; + return true; } return false; diff --git a/tools/aapt/SdkConstants.h b/tools/aapt/SdkConstants.h index 16e622ab67ef..d92de062bcf0 100644 --- a/tools/aapt/SdkConstants.h +++ b/tools/aapt/SdkConstants.h @@ -39,6 +39,9 @@ enum { SDK_LOLLIPOP = 21, SDK_LOLLIPOP_MR1 = 22, SDK_MNC = 23, + SDK_NOUGAT = 24, + SDK_NOUGAT_MR1 = 25, + SDK_O = 26, // STOPSHIP replace with real version }; #endif // H_AAPT_SDK_CONSTANTS diff --git a/tools/aapt2/ConfigDescription.cpp b/tools/aapt2/ConfigDescription.cpp index 289919a39373..b1bd4012c1df 100644 --- a/tools/aapt2/ConfigDescription.cpp +++ b/tools/aapt2/ConfigDescription.cpp @@ -254,6 +254,11 @@ static bool parseUiModeType(const char* name, ResTable_config* out) { out->uiMode = (out->uiMode & ~ResTable_config::MASK_UI_MODE_TYPE) | ResTable_config::UI_MODE_TYPE_WATCH; return true; + } else if (strcmp(name, "vrheadset") == 0) { + if (out) + out->uiMode = (out->uiMode & ~ResTable_config::MASK_UI_MODE_TYPE) | + ResTable_config::UI_MODE_TYPE_VR_HEADSET; + return true; } return false; @@ -772,7 +777,10 @@ success: void ConfigDescription::ApplyVersionForCompatibility( ConfigDescription* config) { uint16_t min_sdk = 0; - if (config->screenLayout2 & ResTable_config::MASK_SCREENROUND) { + if ((config->uiMode & ResTable_config::MASK_UI_MODE_TYPE) + == ResTable_config::UI_MODE_TYPE_VR_HEADSET) { + min_sdk = SDK_O; + } else if (config->screenLayout2 & ResTable_config::MASK_SCREENROUND) { min_sdk = SDK_MARSHMALLOW; } else if (config->density == ResTable_config::DENSITY_ANY) { min_sdk = SDK_LOLLIPOP; diff --git a/tools/aapt2/ConfigDescription_test.cpp b/tools/aapt2/ConfigDescription_test.cpp index c331dc0f6909..1d22ce03ef1c 100644 --- a/tools/aapt2/ConfigDescription_test.cpp +++ b/tools/aapt2/ConfigDescription_test.cpp @@ -99,4 +99,12 @@ TEST(ConfigDescriptionTest, TestParsingRoundQualifier) { EXPECT_EQ(std::string("notround-v23"), config.toString().string()); } +TEST(ConfigDescriptionTest, ParseVrAttribute) { + ConfigDescription config; + EXPECT_TRUE(TestParse("vrheadset", &config)); + EXPECT_EQ(android::ResTable_config::UI_MODE_TYPE_VR_HEADSET, config.uiMode); + EXPECT_EQ(SDK_O, config.sdkVersion); + EXPECT_EQ(std::string("vrheadset-v26"), config.toString().string()); +} + } // namespace aapt diff --git a/tools/aapt2/SdkConstants.h b/tools/aapt2/SdkConstants.h index 9b38ecbeae99..5352b5398544 100644 --- a/tools/aapt2/SdkConstants.h +++ b/tools/aapt2/SdkConstants.h @@ -45,6 +45,9 @@ enum { SDK_LOLLIPOP = 21, SDK_LOLLIPOP_MR1 = 22, SDK_MARSHMALLOW = 23, + SDK_NOUGAT = 24, + SDK_NOUGAT_MR1 = 25, + SDK_O = 26, // STOPSHIP Replace with real version }; size_t FindAttributeSdkLevel(const ResourceId& id); |