MCPcopy Create free account
hub / github.com/baldurk/renderdoc / ExecuteAndInject

Method ExecuteAndInject

renderdoc/android/android.cpp:1340–1673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1338}
1339
1340ExecuteResult AndroidRemoteServer::ExecuteAndInject(const rdcstr &packageAndActivity,
1341 const rdcstr &, const rdcstr &intentArgs,
1342 const rdcarray<EnvironmentModification> &env,
1343 const CaptureOptions &opts)
1344{
1345 LazilyStartLogcatThread();
1346
1347 // we spin up a thread to Ping() every second, since starting a package can block for a long time.
1348 int32_t done = 0;
1349 Threading::ThreadHandle pingThread = Threading::CreateThread([&done, this]() {
1350 Threading::SetCurrentThreadName("Android Ping");
1351
1352 ResultDetails ok;
1353 ok.code = ResultCode::Succeeded;
1354 while(ok.OK() && Atomic::CmpExch32(&done, 0, 0) == 0)
1355 ok = Ping();
1356 });
1357
1358 RDResult result;
1359 uint32_t ident = RenderDoc_FirstTargetControlPort;
1360
1361 AndroidController::m_Inst.Invoke([this, &result, &ident, packageAndActivity, intentArgs, opts]() {
1362 rdcstr packageName = Android::GetPackageName(packageAndActivity); // Remove leading '/' if any
1363
1364 // adb shell cmd package resolve-activity -c android.intent.category.LAUNCHER com.jake.cube1
1365 rdcstr activityName = Android::GetActivityName(packageAndActivity);
1366
1367 // if the activity name isn't specified, get the default one
1368 if(activityName.empty() || activityName == "#DefaultActivity")
1369 activityName = Android::GetDefaultActivityForPackage(m_deviceID, packageName);
1370
1371 rdcstr processName = Android::GetProcessNameForActivity(m_deviceID, packageName, activityName);
1372
1373 if(Android_Debug_ProcessLaunch())
1374 {
1375 RDCLOG("Launching package '%s' with activity '%s' and process name '%s'", packageName.c_str(),
1376 activityName.c_str(), processName.c_str());
1377 }
1378
1379 uint16_t jdwpPort = Android::GetJdwpPort();
1380
1381 // remove any previous jdwp port forward on this port
1382 Android::adbExecCommand(m_deviceID, StringFormat::Fmt("forward --remove tcp:%i", jdwpPort));
1383 // force stop the package if it was running before
1384 Android::adbExecCommand(m_deviceID, "shell am force-stop " + processName);
1385 Android::adbExecCommand(m_deviceID, "shell setprop debug.vulkan.layers :", ".", true);
1386
1387 bool hookWithJDWP = true;
1388
1389 rdcstr info;
1390
1391 if(Android::SupportsNativeLayers(m_deviceID))
1392 {
1393 RDCLOG("Using Android 10 native GPU layering");
1394
1395 // if we have Android 10 native layering, don't use JDWP hooking
1396 hookWithJDWP = false;
1397

Callers 1

remote_capture.pyFile · 0.45

Calls 15

SetCurrentThreadNameFunction · 0.85
GetPackageNameFunction · 0.85
GetActivityNameFunction · 0.85
GetJdwpPortFunction · 0.85
adbExecCommandFunction · 0.85
FmtFunction · 0.85
SupportsNativeLayersFunction · 0.85
DetermineInstalledABIFunction · 0.85
GetSupportedABIsFunction · 0.85
GetABIFunction · 0.85

Tested by

no test coverage detected