MCPcopy Create free account
hub / github.com/baldurk/renderdoc / HasRootAccess

Function HasRootAccess

renderdoc/android/android_utils.cpp:277–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275}
276
277bool HasRootAccess(const rdcstr &deviceID)
278{
279 RDCLOG("Checking for root access on %s", deviceID.c_str());
280
281 // Try switching adb to root and check a few indicators for success
282 // Nothing will fall over if we get a false positive here, it just enables
283 // additional methods of getting things set up.
284
285 Process::ProcessResult result = adbExecCommand(deviceID, "root");
286
287 rdcstr whoami = adbExecCommand(deviceID, "shell whoami").strStdout.trimmed();
288 if(whoami == "root")
289 return true;
290
291 rdcstr checksu =
292 adbExecCommand(deviceID, "shell test -e /system/xbin/su && echo found").strStdout.trimmed();
293 if(checksu == "found")
294 return true;
295
296 return false;
297}
298
299rdcstr GetFirstMatchingLine(const rdcstr &haystack, const rdcstr &needle)
300{

Callers 1

Calls 3

adbExecCommandFunction · 0.85
trimmedMethod · 0.80
c_strMethod · 0.45

Tested by

no test coverage detected