Only run 'adb root' when getting friendly name

* This avoid spamming adb root into the log often when we only need to run it
  once when a device is first seen.
This commit is contained in:
baldurk
2019-04-25 12:36:01 +01:00
parent 72880a8f07
commit 82a35343e6
2 changed files with 9 additions and 6 deletions
-6
View File
@@ -584,12 +584,6 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_EnumerateAndroidDevices(rdc
// Forward the ports so we can see if a remoteserver/captured app is already running.
Android::adbForwardPorts(idx, tokens[0], 0, 0, true);
// run adb root now, so we hit any disconnection that we're going to before trying to connect.
// If we can't be root, this is cheap, if we're already root, this is cheap, if we can be root
// and this changes us it will block only the first time - and we expect this function to be
// slow-ish.
Android::adbExecCommand(tokens[0], "root");
idx++;
}
}
+9
View File
@@ -157,6 +157,15 @@ std::string GetFriendlyName(std::string deviceID)
if(it != friendlyNameCache.end())
return it->second;
// run adb root now, so we hit any disconnection that we're going to before trying to connect.
// If we can't be root, this is cheap, if we're already root, this is cheap, if we can be root
// and this changes us it will block only the first time - and we expect this function to be
// slow-ish.
//
// We do this here so that we sneakily take advantage of the above caching - otherwise we spam adb
// root commands into the log
Android::adbExecCommand(deviceID, "root");
std::string manuf =
trim(Android::adbExecCommand(deviceID, "shell getprop ro.product.manufacturer").strStdout);
std::string model =