mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-10-31 05:53:25 +00:00 
			
		
		
		
	Merge pull request #146 from derkling/adb_addons
Add a couple of ADB related utility functions
This commit is contained in:
		| @@ -909,8 +909,16 @@ class AndroidTarget(Target): | ||||
|             pass | ||||
|         self._connected_as_root = None | ||||
|  | ||||
|     def connect(self, timeout=10, check_boot_completed=True):  # pylint: disable=arguments-differ | ||||
|     def wait_boot_complete(self, timeout=10): | ||||
|         start = time.time() | ||||
|         boot_completed = boolean(self.getprop('sys.boot_completed')) | ||||
|         while not boot_completed and timeout >= time.time() - start: | ||||
|             time.sleep(5) | ||||
|             boot_completed = boolean(self.getprop('sys.boot_completed')) | ||||
|         if not boot_completed: | ||||
|             raise TargetError('Connected but Android did not fully boot.') | ||||
|  | ||||
|     def connect(self, timeout=10, check_boot_completed=True):  # pylint: disable=arguments-differ | ||||
|         device = self.connection_settings.get('device') | ||||
|         if device and ':' in device: | ||||
|             # ADB does not automatically remove a network device from it's | ||||
| @@ -922,12 +930,7 @@ class AndroidTarget(Target): | ||||
|         super(AndroidTarget, self).connect(timeout=timeout) | ||||
|  | ||||
|         if check_boot_completed: | ||||
|             boot_completed = boolean(self.getprop('sys.boot_completed')) | ||||
|             while not boot_completed and timeout >= time.time() - start: | ||||
|                 time.sleep(5) | ||||
|                 boot_completed = boolean(self.getprop('sys.boot_completed')) | ||||
|             if not boot_completed: | ||||
|                 raise TargetError('Connected but Android did not fully boot.') | ||||
|             self.wait_boot_complete(timeout) | ||||
|  | ||||
|     def setup(self, executables=None): | ||||
|         super(AndroidTarget, self).setup(executables) | ||||
| @@ -1120,6 +1123,12 @@ class AndroidTarget(Target): | ||||
|     def clear_logcat(self): | ||||
|         adb_command(self.adb_name, 'logcat -c', timeout=30) | ||||
|  | ||||
|     def adb_kill_server(self, timeout=30): | ||||
|         adb_command(self.adb_name, 'kill-server', timeout) | ||||
|  | ||||
|     def adb_wait_for_device(self, timeout=30): | ||||
|         adb_command(self.adb_name, 'wait-for-device', timeout) | ||||
|  | ||||
|     def adb_reboot_bootloader(self, timeout=30): | ||||
|         adb_command(self.adb_name, 'reboot-bootloader', timeout) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user