diff options
Diffstat (limited to 'tools/aapt2/SdkConstants.cpp')
-rw-r--r-- | tools/aapt2/SdkConstants.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/aapt2/SdkConstants.cpp b/tools/aapt2/SdkConstants.cpp index f4b0124abcda..b4b6ff1daaaa 100644 --- a/tools/aapt2/SdkConstants.cpp +++ b/tools/aapt2/SdkConstants.cpp @@ -18,15 +18,17 @@ #include <algorithm> #include <string> -#include <unordered_map> +#include <unordered_set> #include <vector> using android::StringPiece; namespace aapt { -static const char* sDevelopmentSdkCodeName = "Q"; static ApiVersion sDevelopmentSdkLevel = 10000; +static const auto sDevelopmentSdkCodeNames = std::unordered_set<StringPiece>({ + "Q", "R" +}); static const std::vector<std::pair<uint16_t, ApiVersion>> sAttrIdMap = { {0x021c, 1}, @@ -72,8 +74,9 @@ ApiVersion FindAttributeSdkLevel(const ResourceId& id) { return iter->second; } -std::pair<StringPiece, ApiVersion> GetDevelopmentSdkCodeNameAndVersion() { - return std::make_pair(StringPiece(sDevelopmentSdkCodeName), sDevelopmentSdkLevel); +Maybe<ApiVersion> GetDevelopmentSdkCodeNameVersion(const StringPiece& code_name) { + return (sDevelopmentSdkCodeNames.find(code_name) == sDevelopmentSdkCodeNames.end()) + ? Maybe<ApiVersion>() : sDevelopmentSdkLevel; } } // namespace aapt |