Handle launching more apps on Android

We can check whether an Android app has already been connected to RenderDoc, and warn the user to close the previous app before launching a new one.
This commit is contained in:
tabi.katalin
2019-01-09 16:27:00 +00:00
committed by Baldur Karlsson
parent db2ef74d13
commit d19a495ee0
2 changed files with 22 additions and 0 deletions
+20
View File
@@ -508,6 +508,16 @@ void MainWindow::OnCaptureTrigger(const QString &exe, const QString &workingDir,
return;
LambdaThread *th = new LambdaThread([this, exe, workingDir, cmdLine, env, opts, callback]() {
if(isCapturableAppRunningOnAndroid())
{
RDDialog::warning(this, tr("RenderDoc is already capturing an app on this device"),
tr("A running app on this device is already being captured with RenderDoc. "
"First please close the app then try to launch again."),
QMessageBox::Ok);
return;
}
QString capturefile = m_Ctx.TempCaptureFilename(QFileInfo(exe).baseName());
ExecuteResult ret =
@@ -2848,3 +2858,13 @@ void MainWindow::showLaunchError(ReplayStatus status)
}
GUIInvoke::call(this, [this, title, message]() { RDDialog::warning(this, title, message); });
}
bool MainWindow::isCapturableAppRunningOnAndroid()
{
if(!m_Ctx.Replay().CurrentRemote() || !m_Ctx.Replay().CurrentRemote()->IsADB())
return false;
rdcstr host = m_Ctx.Replay().CurrentRemote()->hostname;
uint32_t ident = RENDERDOC_EnumerateRemoteTargets(host.c_str(), 0);
return ident != 0;
}