Skip to content

Commit e6b4de8

Browse files
sabae-valvebaldurk
authored andcommitted
Android: Automaticaly add MANAGE_EXTERNAL_STORAGE permission to apps
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
1 parent 64c77e9 commit e6b4de8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

renderdoc/android/android.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,17 @@ struct AndroidController : public IDeviceProtocolHandler
12201220
for(Android::ABI abi : abis)
12211221
Android::adbExecCommand(deviceID, "shell am force-stop " + GetRenderDocPackageForABI(abi));
12221222

1223+
// Attempt to prevent the user needing to click through on permissions
1224+
rdcstr auto_grant_permissions =
1225+
Android::adbExecCommand(deviceID, "shell getprop debug.renderdoc.autograntpermissions")
1226+
.strStdout.trimmed();
1227+
if(apiVersion >= 30 && atoi(auto_grant_permissions.c_str()) == 1)
1228+
{
1229+
for(Android::ABI abi : abis)
1230+
Android::adbExecCommand(deviceID, "shell pm grant " + GetRenderDocPackageForABI(abi) +
1231+
" android.permission.MANAGE_EXTERNAL_STORAGE");
1232+
}
1233+
12231234
Android::adbForwardPorts(dev.portbase, deviceID, 0, 0, false);
12241235
Android::ResetCaptureSettings(deviceID);
12251236

0 commit comments

Comments
 (0)