mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 13:00:32 +00:00
Start/Shutdown Android server from RemoteManager dialog.
ANativeActivity_finish when renderdoccmd() returns.
This commit is contained in:
committed by
Baldur Karlsson
parent
53c0c20c8a
commit
70f55a1458
@@ -172,7 +172,7 @@ void PersistantConfig::AddAndroidHosts()
|
||||
{
|
||||
for(int i = RemoteHosts.count() - 1; i >= 0; i--)
|
||||
{
|
||||
if(RemoteHosts[i]->Hostname.startsWith(lit("adb:")))
|
||||
if(RemoteHosts[i]->IsHostADB())
|
||||
delete RemoteHosts.takeAt(i);
|
||||
}
|
||||
|
||||
@@ -193,6 +193,8 @@ void PersistantConfig::AddAndroidHosts()
|
||||
{
|
||||
RemoteHost *host = new RemoteHost();
|
||||
host->Hostname = lit("adb:") + hostName;
|
||||
// Just a command to display in the GUI and allow Launch() to be called.
|
||||
host->RunCommand = lit("org.renderdoc.renderdoccmd");
|
||||
RemoteHosts.push_back(host);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,8 +102,17 @@ void RemoteHost::CheckStatus()
|
||||
|
||||
void RemoteHost::Launch()
|
||||
{
|
||||
int WAIT_TIME = 2000;
|
||||
|
||||
if(IsHostADB())
|
||||
{
|
||||
RENDERDOC_StartAndroidRemoteServer();
|
||||
QThread::msleep(WAIT_TIME);
|
||||
return;
|
||||
}
|
||||
|
||||
RDProcess process;
|
||||
process.start(RunCommand);
|
||||
process.waitForFinished(2000);
|
||||
process.waitForFinished(WAIT_TIME);
|
||||
process.detach();
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ public:
|
||||
QString Hostname;
|
||||
DOCUMENT("The command to run locally to try to launch the server remotely.");
|
||||
QString RunCommand;
|
||||
|
||||
bool IsHostADB() const { return Hostname.startsWith(lit("adb:")); }
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(RemoteHost);
|
||||
@@ -325,7 +325,11 @@ void RemoteManager::updateConnectButton()
|
||||
|
||||
if(host)
|
||||
{
|
||||
if(host->Hostname == lit("localhost"))
|
||||
bool isLocalhost = host->Hostname == lit("localhost");
|
||||
if(isLocalhost || host->IsHostADB())
|
||||
ui->runCommand->setEnabled(false);
|
||||
|
||||
if(isLocalhost)
|
||||
{
|
||||
ui->connect->setEnabled(false);
|
||||
}
|
||||
|
||||
@@ -103,6 +103,8 @@ vector<string> getRenderdoccmdArgs()
|
||||
iss >> sub;
|
||||
ret.push_back(sub);
|
||||
}
|
||||
android_state->activity->vm->DetachCurrentThread();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -116,10 +118,10 @@ void handle_cmd(android_app *app, int32_t cmd)
|
||||
if(!args.size())
|
||||
break; // Nothing for APK to do.
|
||||
renderdoccmd(GlobalEnvironment(), args);
|
||||
// activity is done and should be closed
|
||||
ANativeActivity_finish(android_state->activity);
|
||||
break;
|
||||
}
|
||||
case APP_CMD_TERM_WINDOW: break;
|
||||
default: __android_log_print(ANDROID_LOG_INFO, LOGCAT_TAG, "event not handled: %d", cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user