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.  Presumably, if you have `adb` access to the device, we can
assume it's alright to add this permission automatically.  This is only
relevant on API >= 30, as the `MANAGE_EXTERNAL_STORAGE` permission is
not available on earlier Android versions [0].

[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 bcd63de
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions renderdoc/android/android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,14 @@ 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
if(apiVersion >= 30)
{
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 bcd63de

Please sign in to comment.