OLD | NEW |
1 # coding=utf-8 | 1 # coding=utf-8 |
2 # Copyright 2015 Google Inc. All rights reserved. | 2 # Copyright 2015 Google Inc. All rights reserved. |
3 # | 3 # |
4 # Licensed under the Apache License, Version 2.0 (the "License"); | 4 # Licensed under the Apache License, Version 2.0 (the "License"); |
5 # you may not use this file except in compliance with the License. | 5 # you may not use this file except in compliance with the License. |
6 # You may obtain a copy of the License at | 6 # You may obtain a copy of the License at |
7 # | 7 # |
8 # http://www.apache.org/licenses/LICENSE-2.0 | 8 # http://www.apache.org/licenses/LICENSE-2.0 |
9 # | 9 # |
10 # Unless required by applicable law or agreed to in writing, software | 10 # Unless required by applicable law or agreed to in writing, software |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 425 |
426 def PullContent(self, *args, **kwargs): | 426 def PullContent(self, *args, **kwargs): |
427 return self._device.PullContent(*args, **kwargs) | 427 return self._device.PullContent(*args, **kwargs) |
428 | 428 |
429 def Push(self, *args, **kwargs): | 429 def Push(self, *args, **kwargs): |
430 return self._device.Push(*args, **kwargs) | 430 return self._device.Push(*args, **kwargs) |
431 | 431 |
432 def PushContent(self, *args, **kwargs): | 432 def PushContent(self, *args, **kwargs): |
433 return self._device.PushContent(*args, **kwargs) | 433 return self._device.PushContent(*args, **kwargs) |
434 | 434 |
435 def Reboot(self): | 435 def Reboot(self, wait=True): |
436 """Reboots the phone then Waits for the device to come back. | 436 """Reboots the phone then Waits for the device to come back. |
437 | 437 |
438 adbd running on the phone will likely not be in Root(), so the caller should | 438 adbd running on the phone will likely not be in Root(), so the caller should |
439 call Root() right afterward if desired. | 439 call Root() right afterward if desired. |
440 """ | 440 """ |
441 if not self._device.Reboot(): | 441 if not self._device.Reboot(wait=wait): |
442 return False | 442 return False |
443 return self.WaitUntilFullyBooted() | 443 return self.WaitUntilFullyBooted() if wait else True |
| 444 |
| 445 def Reset(self, new_endpoint=None): |
| 446 self._device.ResetHandle(new_endpoint=new_endpoint) |
444 | 447 |
445 def Remount(self): | 448 def Remount(self): |
446 return self._device.Remount() | 449 return self._device.Remount() |
447 | 450 |
448 def Root(self): | 451 def Root(self): |
449 return self._device.Root() | 452 return self._device.Root() |
450 | 453 |
451 def Shell(self, cmd, timeout_ms=None): | 454 def Shell(self, cmd, timeout_ms=None): |
452 """Automatically uses WrappedShell() when necessary.""" | 455 """Automatically uses WrappedShell() when necessary.""" |
453 if self._device.IsShellOk(cmd): | 456 if self._device.IsShellOk(cmd): |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 return out | 978 return out |
976 | 979 |
977 @classmethod | 980 @classmethod |
978 def _Connect(cls, constructor, **kwargs): | 981 def _Connect(cls, constructor, **kwargs): |
979 """Called by either ConnectDevice or Connect.""" | 982 """Called by either ConnectDevice or Connect.""" |
980 if not kwargs.get('rsa_keys'): | 983 if not kwargs.get('rsa_keys'): |
981 with _ADB_KEYS_LOCK: | 984 with _ADB_KEYS_LOCK: |
982 kwargs['rsa_keys'] = _ADB_KEYS[:] | 985 kwargs['rsa_keys'] = _ADB_KEYS[:] |
983 device = constructor(**kwargs) | 986 device = constructor(**kwargs) |
984 return HighDevice(device, _InitCache(device)) | 987 return HighDevice(device, _InitCache(device)) |
OLD | NEW |