Skip to content

Commit

Permalink
Android: Automaticaly add MANAGE_EXTERNAL_STORAGE permission to apps
Browse files Browse the repository at this point in the history
This prevents the user from needing to click through a permission
granting screen on their device before the agent is able to run on the
device, but only does so if the API level is >= 30 (where this
permission has effect at all [0]) and if a particular property is set on
the device (`debug.renderdoc.autograntpermissions`) so as to avoid
potential pitfalls on unusual Android devices.

[0] https://developer.android.com/reference/android/Manifest.permission#MANAGE_EXTERNAL_STORAGE
  • Loading branch information
sabae-valve committed Jan 7, 2025
1 parent 80e4d5e commit 1531009
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions renderdoc/android/android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,17 @@ struct AndroidController : public IDeviceProtocolHandler
for(Android::ABI abi : abis)
Android::adbExecCommand(deviceID, "shell am force-stop " + GetRenderDocPackageForABI(abi));

// Attempt to prevent the user needing to click through on permissions
rdcstr auto_grant_permissions =
Android::adbExecCommand(deviceID, "shell getprop debug.renderdoc.autograntpermissions")
.strStdout.trimmed();
if(apiVersion >= 30 && atoi(auto_grant_permissions.c_str()) == 1)
{
for(Android::ABI abi : abis)
Android::adbExecCommand(deviceID, "shell pm grant " + GetRenderDocPackageForABI(abi) +
" android.permission.MANAGE_EXTERNAL_STORAGE");
}

Android::adbForwardPorts(dev.portbase, deviceID, 0, 0, false);
Android::ResetCaptureSettings(deviceID);

Expand Down

0 comments on commit 1531009

Please sign in to comment.