Loading adb/adb.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -239,6 +239,10 @@ void parse_banner(const std::string& banner, atransport* t) { // "device::ro.product.name=x;ro.product.model=y;ro.product.device=z;". std::vector<std::string> pieces = android::base::Split(banner, ":"); // Reset the features list or else if the server sends no features we may // keep the existing feature set (http://b/24405971). t->SetFeatures(""); if (pieces.size() > 2) { const std::string& props = pieces[2]; for (auto& prop : android::base::Split(props, ";")) { Loading adb/transport.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -796,6 +796,10 @@ std::string FeatureSetToString(const FeatureSet& features) { } FeatureSet StringToFeatureSet(const std::string& features_string) { if (features_string.empty()) { return FeatureSet(); } auto names = android::base::Split(features_string, {kFeatureStringDelimiter}); return FeatureSet(names.begin(), names.end()); Loading adb/transport_test.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,9 @@ TEST(transport, SetFeatures) { ASSERT_FALSE(t.has_feature("foo")); ASSERT_TRUE(t.has_feature("bar")); ASSERT_TRUE(t.has_feature("baz")); t.SetFeatures(""); ASSERT_EQ(0U, t.features().size()); } TEST(transport, parse_banner_no_features) { Loading Loading
adb/adb.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -239,6 +239,10 @@ void parse_banner(const std::string& banner, atransport* t) { // "device::ro.product.name=x;ro.product.model=y;ro.product.device=z;". std::vector<std::string> pieces = android::base::Split(banner, ":"); // Reset the features list or else if the server sends no features we may // keep the existing feature set (http://b/24405971). t->SetFeatures(""); if (pieces.size() > 2) { const std::string& props = pieces[2]; for (auto& prop : android::base::Split(props, ";")) { Loading
adb/transport.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -796,6 +796,10 @@ std::string FeatureSetToString(const FeatureSet& features) { } FeatureSet StringToFeatureSet(const std::string& features_string) { if (features_string.empty()) { return FeatureSet(); } auto names = android::base::Split(features_string, {kFeatureStringDelimiter}); return FeatureSet(names.begin(), names.end()); Loading
adb/transport_test.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,9 @@ TEST(transport, SetFeatures) { ASSERT_FALSE(t.has_feature("foo")); ASSERT_TRUE(t.has_feature("bar")); ASSERT_TRUE(t.has_feature("baz")); t.SetFeatures(""); ASSERT_EQ(0U, t.features().size()); } TEST(transport, parse_banner_no_features) { Loading