From be998744b3af8b811971121b5768bceca5460016 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 27 Mar 2019 18:22:37 +0000 Subject: [PATCH] Switch android device to root as early as possible * Running 'adb root' will cause the device to disconnect, so doing it late when we're selecting an app to debug and want to see if we have debug access means we'll kill our server connection the first time. Instead doing it at enumerate time means the device will already be in root mode. --- renderdoc/android/android.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/renderdoc/android/android.cpp b/renderdoc/android/android.cpp index 1cf943a90..71de1091e 100644 --- a/renderdoc/android/android.cpp +++ b/renderdoc/android/android.cpp @@ -584,6 +584,12 @@ 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++; } }