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

Function GetFriendlyName

renderdoc/android/android_utils.cpp:247–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247rdcstr GetFriendlyName(const rdcstr &deviceID)
248{
249 // run adb root now, so we hit any disconnection that we're going to before trying to connect.
250 // If we can't be root, this is cheap, if we're already root, this is cheap, if we can be root
251 // and this changes us it will block only the first time - and we expect this function to be
252 // slow-ish.
253 //
254 // We do this here so that we sneakily take advantage of the above caching - otherwise we spam adb
255 // root commands into the log
256 Android::adbExecCommand(deviceID, "root");
257
258 rdcstr manuf =
259 Android::adbExecCommand(deviceID, "shell getprop ro.product.manufacturer").strStdout.trimmed();
260 rdcstr model =
261 Android::adbExecCommand(deviceID, "shell getprop ro.product.model").strStdout.trimmed();
262
263 rdcstr combined;
264
265 if(manuf.empty() && model.empty())
266 combined = "";
267 else if(manuf.empty() && !model.empty())
268 combined = model;
269 else if(!manuf.empty() && model.empty())
270 combined = manuf + " device";
271 else if(!manuf.empty() && !model.empty())
272 combined = manuf + " " + model;
273
274 return combined;
275}
276
277bool HasRootAccess(const rdcstr &deviceID)
278{

Callers 4

IsSupportedFunction · 0.85
GetDevicesMethod · 0.85
StartRemoteServerMethod · 0.85
mfidl.hFile · 0.85

Calls 3

adbExecCommandFunction · 0.85
trimmedMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected