From f49dfadc9a02640879e179165b0aeb482be0fd43 Mon Sep 17 00:00:00 2001 From: Baldur Karlsson Date: Tue, 13 Mar 2018 17:31:32 +0000 Subject: [PATCH] Try alternative ps for some android devices that don't support ps -A --- renderdoc/android/android.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/renderdoc/android/android.cpp b/renderdoc/android/android.cpp index 091213735..db4541d1a 100644 --- a/renderdoc/android/android.cpp +++ b/renderdoc/android/android.cpp @@ -100,6 +100,18 @@ int GetCurrentPID(const std::string &deviceID, const std::string &packageName) std::string output = trim(pidOutput.strStdout); size_t space = output.find_first_of("\t "); + // if we didn't get a response, try without the -A as some android devices don't support that + // parameter + if(output.empty() || output.find(packageName) == std::string::npos || space == std::string::npos) + { + pidOutput = + adbExecCommand(deviceID, StringFormat::Fmt("shell ps | grep %s", packageName.c_str())); + + output = trim(pidOutput.strStdout); + space = output.find_first_of("\t "); + } + + // if we still didn't get a response, sleep and try again next time if(output.empty() || output.find(packageName) == std::string::npos || space == std::string::npos) { Threading::Sleep(200);