[adb] Cache features set inside the client process

Test: manual
Change-Id: I99962edd85e9694c3ca309624368cda6355da008
This commit is contained in:
Yurii Zubrytskyi 2019-06-27 13:47:17 -07:00 committed by Songchun Fan
parent f7970cee69
commit e800af5c23
1 changed files with 9 additions and 3 deletions

View File

@ -398,9 +398,15 @@ std::string format_host_command(const char* command) {
}
bool adb_get_feature_set(FeatureSet* feature_set, std::string* error) {
std::string result;
if (adb_query(format_host_command("features"), &result, error)) {
*feature_set = StringToFeatureSet(result);
static FeatureSet* features = nullptr;
if (!features) {
std::string result;
if (adb_query(format_host_command("features"), &result, error)) {
features = new FeatureSet(StringToFeatureSet(result));
}
}
if (features) {
*feature_set = *features;
return true;
}
feature_set->clear();