Skip to content

Commit

Permalink
parse adb command output on host
Browse files Browse the repository at this point in the history
Change-Id: I6b1a0c7612d5ecb0edc0a48ae91b1557b7d6c8e1
  • Loading branch information
tjr-arm committed Jan 10, 2024
1 parent 046d301 commit b05a1ea
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions renderdoc/android/android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,17 +367,14 @@ AndroidInstallPermissionCheckResult CheckAndroidServerInstallPermissions(const r
{
return AndroidInstallPermissionCheckResult::Correct;
}
// Command to check that the Android Server is queryable by other APKs (API>30)
// for RenderDoc layer discovery.
// Command to check that the Android Server is queryable by other APKs (API>=30)
Process::ProcessResult adbCheck =
adbExecCommand(deviceID,
"shell \"dumpsys package queries | sed -n '/forceQueryable/,/queries via "
"package name/p' | grep " +
packageName + "\"",
".", true);

// Check the output of 'grep' - no output means no match
if(adbCheck.strStdout.empty())
adbExecCommand(deviceID, "shell dumpsys package queries " + packageName, ".", true);
// parse command output
int32_t sectionStart = adbCheck.strStdout.find("forceQueryable");
int32_t sectionEnd = adbCheck.strStdout.find("queries via package name", sectionStart);
int32_t isPackageQueryable = adbCheck.strStdout.find(packageName, sectionStart, sectionEnd);
if(isPackageQueryable == -1)
{
RDCERR("Failed to install with 'force queryable' permissions.");
return AndroidInstallPermissionCheckResult::NotQueryable;
Expand Down

0 comments on commit b05a1ea

Please sign in to comment.