From 077402bf11e13c3ad42ccecccc690bec55da6667 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 26 Jan 2018 18:51:46 +0000 Subject: [PATCH] Add failsafe so we don't wait the whole timeout if an apk closes/crashes --- renderdoc/android/android.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/renderdoc/android/android.cpp b/renderdoc/android/android.cpp index dba4c116a..8fcb7f900 100644 --- a/renderdoc/android/android.cpp +++ b/renderdoc/android/android.cpp @@ -170,6 +170,16 @@ uint32_t StartAndroidPackageForCapture(const char *host, const char *package) break; } + // check to see if the PID is still there. If it was before and isn't now, the APK has exited + // without ever opening a connection. + int curpid = GetCurrentPID(deviceID, packageName); + + if(pid != 0 && curpid == 0) + { + RDCERR("APK has crashed or never opened target control connection before closing."); + break; + } + Threading::Sleep(1000); elapsed += 1000; }