| 300 | |
| 301 | |
| 302 | def waitForAppToFinish(self, appIdToRun): |
| 303 | self.logger.info("Waiting for app inside emulator to exit...") |
| 304 | |
| 305 | while True: |
| 306 | getProcessListCommand = '"%s" shell ps' % ( self.adbPath ) |
| 307 | procListOutput = subprocess.check_output(getProcessListCommand, shell=True, env=self.androidEnvironment, universal_newlines=True ) |
| 308 | |
| 309 | found_process = False |
| 310 | for line in procListOutput.splitlines(): |
| 311 | line_words = line.split() |
| 312 | |
| 313 | if appIdToRun in str(line_words): |
| 314 | found_process = True |
| 315 | break |
| 316 | |
| 317 | if not found_process: |
| 318 | break |
| 319 | time.sleep(2) |
| 320 | |
| 321 | self.logger.info("Process inside emulator has exited.") |
| 322 | |
| 323 | def fetchOutput(self, args, appIdToRun): |
| 324 | appDataDirInEmulator = "/data/user/0/%s" % (appIdToRun) |