| 275 | } |
| 276 | |
| 277 | bool 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 | |
| 299 | rdcstr GetFirstMatchingLine(const rdcstr &haystack, const rdcstr &needle) |
| 300 | { |
no test coverage detected