mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Shut down adb when closing qrenderdoc if it's our adb
* This has some possible problems - e.g. if one copy of qrenderdoc is closed and kills the server used by another copy. However it seems impossible to reliably manage adb and we need to ensure we don't leave the process lingering around. * At the moment 95% of users don't use android, so it's most important that they have a smooth experience. * This was the cause of problems around updating versions because adb.exe would hang around and then be 'in use' and not able to be overwritten.
This commit is contained in:
@@ -431,6 +431,8 @@ int main(int argc, char *argv[])
|
||||
config.Save();
|
||||
}
|
||||
|
||||
RENDERDOC_AndroidShutdown();
|
||||
|
||||
PythonContext::GlobalShutdown();
|
||||
|
||||
Formatter::shutdown();
|
||||
|
||||
@@ -577,6 +577,11 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_EnumerateAndroidDevices(rdc
|
||||
*deviceList = ret;
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_AndroidShutdown()
|
||||
{
|
||||
Android::shutdownAdb();
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_StartAndroidRemoteServer(const char *device)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
@@ -37,5 +37,6 @@ void ResetCaptureSettings(const std::string &deviceID);
|
||||
void ExtractDeviceIDAndIndex(const std::string &hostname, int &index, std::string &deviceID);
|
||||
Process::ProcessResult adbExecCommand(const std::string &deviceID, const std::string &args,
|
||||
const string &workDir = ".", bool silent = false);
|
||||
void shutdownAdb();
|
||||
bool InjectWithJDWP(const std::string &deviceID, uint16_t jdwpport);
|
||||
};
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
namespace Android
|
||||
{
|
||||
static bool adbKillServer = false;
|
||||
bool toolExists(const std::string &path)
|
||||
{
|
||||
if(path.empty())
|
||||
@@ -254,7 +255,15 @@ std::string getToolPath(ToolDir subdir, const std::string &toolname, bool checkE
|
||||
|
||||
toolpath = exedir + "/plugins/android/" + toolname;
|
||||
if(toolExists(toolpath))
|
||||
{
|
||||
if(toolname == "adb")
|
||||
{
|
||||
// if we're using our own adb, we should kill the server upon shutdown
|
||||
adbKillServer = true;
|
||||
}
|
||||
|
||||
return toolpath;
|
||||
}
|
||||
}
|
||||
|
||||
toolpath = "";
|
||||
@@ -298,4 +307,9 @@ Process::ProcessResult adbExecCommand(const std::string &device, const std::stri
|
||||
deviceArgs = StringFormat::Fmt("-s %s %s", device.c_str(), args.c_str());
|
||||
return execCommand(adb, deviceArgs, workDir, silent);
|
||||
}
|
||||
void shutdownAdb()
|
||||
{
|
||||
if(adbKillServer)
|
||||
adbExecCommand("", "kill-server", ".", false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2135,6 +2135,9 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_GetAndroidFriendlyName(cons
|
||||
DOCUMENT("Internal function for enumerating android devices.");
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_EnumerateAndroidDevices(rdcstr *deviceList);
|
||||
|
||||
DOCUMENT("Internal function for shutting down android use.");
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_AndroidShutdown();
|
||||
|
||||
DOCUMENT("Internal function for starting an android remote server.");
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_StartAndroidRemoteServer(const char *device);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user