From bbe3d210ba9776f2e72f17c6213438890e1a8683 Mon Sep 17 00:00:00 2001 From: David Pursell Date: Fri, 25 Sep 2015 08:37:13 -0700 Subject: [PATCH] adb: bump server version to prevent feature mismatch. Devices get a list of supported features from the adb server, not the client, so a mismatch between client and server features can cause the device to use an incorrect feature set. Bumping the server version is the easiest way to make sure the client and server features match and seems like the best solution at the moment. A more automated fix could be to compare client/server features on each connection and restart if they don't match. This requires an extra client <-> server round-trip per command, but removes the need to manually bump the server version number on feature change. Unless the feature set changes often it didn't seem worth the extra overhead. Bug: http://b/24370690 Change-Id: I4e43825d1c15c61e5d924fc8d4110b467debde37 --- adb/adb.h | 2 +- adb/transport.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/adb/adb.h b/adb/adb.h index 037c010c5..a20b3452a 100644 --- a/adb/adb.h +++ b/adb/adb.h @@ -50,7 +50,7 @@ constexpr size_t MAX_PAYLOAD = MAX_PAYLOAD_V2; std::string adb_version(); // Increment this when we want to force users to start a new adb server. -#define ADB_SERVER_VERSION 32 +#define ADB_SERVER_VERSION 33 class atransport; struct usb_handle; diff --git a/adb/transport.cpp b/adb/transport.cpp index ffbb10798..940480b22 100644 --- a/adb/transport.cpp +++ b/adb/transport.cpp @@ -786,6 +786,9 @@ const FeatureSet& supported_features() { // Local static allocation to avoid global non-POD variables. static const FeatureSet* features = new FeatureSet{ kFeatureShell2 + // Increment ADB_SERVER_VERSION whenever the feature list changes to + // make sure that the adb client and server features stay in sync + // (http://b/24370690). }; return *features;