mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-02 03:45:50 +00:00
Pass command-line args as 'intent args' when launching apk. Refs #987
This commit is contained in:
@@ -386,6 +386,9 @@ struct ICaptureDialog
|
||||
DOCUMENT("Update the current state of the global hook, e.g. if it has been enabled.");
|
||||
virtual void UpdateGlobalHook() = 0;
|
||||
|
||||
DOCUMENT("Update the current state based on the current remote host, when that changes.");
|
||||
virtual void UpdateRemoteHost() = 0;
|
||||
|
||||
protected:
|
||||
ICaptureDialog() = default;
|
||||
~ICaptureDialog() = default;
|
||||
|
||||
@@ -984,6 +984,16 @@ void CaptureDialog::UpdateGlobalHook()
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureDialog::UpdateRemoteHost()
|
||||
{
|
||||
const RemoteHost *host = m_Ctx.Replay().CurrentRemote();
|
||||
|
||||
if(host && host->IsADB())
|
||||
ui->cmdLineLabel->setText(tr("Intent Arguments"));
|
||||
else
|
||||
ui->cmdLineLabel->setText(tr("Command-line Arguments"));
|
||||
}
|
||||
|
||||
void CaptureDialog::SetEnvironmentModifications(const rdcarray<EnvironmentModification> &modifications)
|
||||
{
|
||||
m_EnvModifications = modifications;
|
||||
|
||||
@@ -73,6 +73,7 @@ public:
|
||||
void LoadSettings(const rdcstr &filename) override;
|
||||
void SaveSettings(const rdcstr &filename) override;
|
||||
void UpdateGlobalHook() override;
|
||||
void UpdateRemoteHost() override;
|
||||
|
||||
public slots:
|
||||
bool checkAllowClose();
|
||||
|
||||
@@ -1602,6 +1602,9 @@ void MainWindow::messageCheck()
|
||||
|
||||
m_Ctx.Replay().DisconnectFromRemoteServer();
|
||||
}
|
||||
|
||||
if(m_Ctx.HasCaptureDialog())
|
||||
m_Ctx.GetCaptureDialog()->UpdateRemoteHost();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1714,6 +1717,9 @@ void MainWindow::switchContext()
|
||||
statusText->setText(QString());
|
||||
|
||||
SetTitle();
|
||||
|
||||
if(m_Ctx.HasCaptureDialog())
|
||||
m_Ctx.GetCaptureDialog()->UpdateRemoteHost();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1788,6 +1794,9 @@ void MainWindow::switchContext()
|
||||
}
|
||||
|
||||
contextChooser->setEnabled(true);
|
||||
|
||||
if(m_Ctx.HasCaptureDialog())
|
||||
m_Ctx.GetCaptureDialog()->UpdateRemoteHost();
|
||||
});
|
||||
});
|
||||
th->selfDelete(true);
|
||||
@@ -1879,6 +1888,9 @@ void MainWindow::OnCaptureClosed()
|
||||
tr("Remote server disconnected. To attempt to reconnect please select it again."));
|
||||
contextChooser->setText(tr("Replay Context: %1").arg(tr("Local")));
|
||||
m_Ctx.Replay().DisconnectFromRemoteServer();
|
||||
|
||||
if(m_Ctx.HasCaptureDialog())
|
||||
m_Ctx.GetCaptureDialog()->UpdateRemoteHost();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ int GetCurrentPID(const std::string &deviceID, const std::string &packageName)
|
||||
}
|
||||
|
||||
ExecuteResult StartAndroidPackageForCapture(const char *host, const char *package,
|
||||
const CaptureOptions &opts)
|
||||
const char *intentArgs, const CaptureOptions &opts)
|
||||
{
|
||||
int index = 0;
|
||||
std::string deviceID;
|
||||
@@ -244,8 +244,8 @@ ExecuteResult StartAndroidPackageForCapture(const char *host, const char *packag
|
||||
RDCLOG("Setting up to launch the application as a debugger to inject.");
|
||||
|
||||
// start the activity in this package with debugging enabled and force-stop after starting
|
||||
adbExecCommand(deviceID, StringFormat::Fmt("shell am start -S -D %s/%s", packageName.c_str(),
|
||||
activityName.c_str()));
|
||||
adbExecCommand(deviceID, StringFormat::Fmt("shell am start -S -D %s/%s %s", packageName.c_str(),
|
||||
activityName.c_str(), intentArgs));
|
||||
|
||||
// adb shell ps | grep $PACKAGE | awk '{print $2}')
|
||||
pid = GetCurrentPID(deviceID, packageName);
|
||||
@@ -255,8 +255,8 @@ ExecuteResult StartAndroidPackageForCapture(const char *host, const char *packag
|
||||
RDCLOG("Not doing any injection - assuming APK is pre-loaded with RenderDoc capture library.");
|
||||
|
||||
// start the activity in this package with debugging enabled and force-stop after starting
|
||||
adbExecCommand(deviceID, StringFormat::Fmt("shell am start %s/%s", packageName.c_str(),
|
||||
activityName.c_str()));
|
||||
adbExecCommand(deviceID, StringFormat::Fmt("shell am start %s/%s %s", packageName.c_str(),
|
||||
activityName.c_str(), intentArgs));
|
||||
|
||||
// don't connect JDWP
|
||||
jdwpPort = 0;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Android
|
||||
{
|
||||
bool IsHostADB(const char *hostname);
|
||||
ExecuteResult StartAndroidPackageForCapture(const char *host, const char *package,
|
||||
const CaptureOptions &opts);
|
||||
const char *intentArgs, const CaptureOptions &opts);
|
||||
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,
|
||||
|
||||
@@ -1250,7 +1250,8 @@ public:
|
||||
ok = Ping();
|
||||
});
|
||||
|
||||
ExecuteResult ret = Android::StartAndroidPackageForCapture(host, app.c_str(), opts);
|
||||
ExecuteResult ret =
|
||||
Android::StartAndroidPackageForCapture(host, app.c_str(), cmdline.c_str(), opts);
|
||||
|
||||
Atomic::Inc32(&done);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user