Merge changes from topic "R"
am: 39a77f1951
Change-Id: I32a27fb346e236a6836d4c139cac2fb4cfdb733d
This commit is contained in:
@@ -497,9 +497,9 @@ Maybe<int> ParseSdkVersion(const StringPiece& str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try parsing the code name.
|
// Try parsing the code name.
|
||||||
std::pair<StringPiece, int> entry = GetDevelopmentSdkCodeNameAndVersion();
|
Maybe<int> entry = GetDevelopmentSdkCodeNameVersion(trimmed_str);
|
||||||
if (entry.first == trimmed_str) {
|
if (entry) {
|
||||||
return entry.second;
|
return entry.value();
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,15 +18,17 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using android::StringPiece;
|
using android::StringPiece;
|
||||||
|
|
||||||
namespace aapt {
|
namespace aapt {
|
||||||
|
|
||||||
static const char* sDevelopmentSdkCodeName = "Q";
|
|
||||||
static ApiVersion sDevelopmentSdkLevel = 10000;
|
static ApiVersion sDevelopmentSdkLevel = 10000;
|
||||||
|
static const auto sDevelopmentSdkCodeNames = std::unordered_set<StringPiece>({
|
||||||
|
"Q", "R"
|
||||||
|
});
|
||||||
|
|
||||||
static const std::vector<std::pair<uint16_t, ApiVersion>> sAttrIdMap = {
|
static const std::vector<std::pair<uint16_t, ApiVersion>> sAttrIdMap = {
|
||||||
{0x021c, 1},
|
{0x021c, 1},
|
||||||
@@ -72,8 +74,9 @@ ApiVersion FindAttributeSdkLevel(const ResourceId& id) {
|
|||||||
return iter->second;
|
return iter->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<StringPiece, ApiVersion> GetDevelopmentSdkCodeNameAndVersion() {
|
Maybe<ApiVersion> GetDevelopmentSdkCodeNameVersion(const StringPiece& code_name) {
|
||||||
return std::make_pair(StringPiece(sDevelopmentSdkCodeName), sDevelopmentSdkLevel);
|
return (sDevelopmentSdkCodeNames.find(code_name) == sDevelopmentSdkCodeNames.end())
|
||||||
|
? Maybe<ApiVersion>() : sDevelopmentSdkLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace aapt
|
} // namespace aapt
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ enum : ApiVersion {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ApiVersion FindAttributeSdkLevel(const ResourceId& id);
|
ApiVersion FindAttributeSdkLevel(const ResourceId& id);
|
||||||
std::pair<android::StringPiece, ApiVersion> GetDevelopmentSdkCodeNameAndVersion();
|
Maybe<ApiVersion> GetDevelopmentSdkCodeNameVersion(const android::StringPiece& code_name);
|
||||||
|
|
||||||
} // namespace aapt
|
} // namespace aapt
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user