| Index: build/android/pylib/utils/emulator.py
|
| diff --git a/build/android/pylib/utils/emulator.py b/build/android/pylib/utils/emulator.py
|
| index e2bf1e05a3b008387301081051aac4c8212f32cc..462d569ff2b4c91555adf9f62e9bdae326778623 100644
|
| --- a/build/android/pylib/utils/emulator.py
|
| +++ b/build/android/pylib/utils/emulator.py
|
| @@ -12,18 +12,16 @@ Assumes system environment ANDROID_NDK_ROOT has been set.
|
|
|
| import logging
|
| import os
|
| -import shutil
|
| import signal
|
| import subprocess
|
| -import sys
|
| import time
|
|
|
| -import time_profile
|
| # TODO(craigdh): Move these pylib dependencies to pylib/utils/.
|
| from pylib import android_commands
|
| from pylib import cmd_helper
|
| from pylib import constants
|
| from pylib import pexpect
|
| +from pylib.utils import time_profile
|
|
|
| import errors
|
| import run_command
|
| @@ -98,7 +96,7 @@ def _KillAllEmulators():
|
| for emu_name in emulators:
|
| cmd_helper.RunCmd(['adb', '-s', emu_name, 'emu', 'kill'])
|
| logging.info('Emulator killing is async; give a few seconds for all to die.')
|
| - for i in range(5):
|
| + for _ in range(5):
|
| if not android_commands.GetAttachedDevices(hardware=False):
|
| return
|
| time.sleep(1)
|
| @@ -229,7 +227,8 @@ class Emulator(object):
|
| self.api_level = api_level
|
| self._CreateAVD()
|
|
|
| - def _DeviceName(self):
|
| + @staticmethod
|
| + def _DeviceName():
|
| """Return our device name."""
|
| port = _GetAvailablePort()
|
| return ('emulator-%d' % port, port)
|
| @@ -349,7 +348,8 @@ class Emulator(object):
|
| stderr=subprocess.STDOUT)
|
| self._InstallKillHandler()
|
|
|
| - def _AggressiveImageCleanup(self):
|
| + @staticmethod
|
| + def _AggressiveImageCleanup():
|
| """Aggressive cleanup of emulator images.
|
|
|
| Experimentally it looks like our current emulator use on the bot
|
| @@ -386,7 +386,7 @@ class Emulator(object):
|
| number_of_waits -= 1
|
| if not number_of_waits:
|
| break
|
| - except errors.WaitForResponseTimedOutError as e:
|
| + except errors.WaitForResponseTimedOutError:
|
| seconds_waited += self._WAITFORDEVICE_TIMEOUT
|
| adb_cmd = "adb -s %s %s" % (self.device, 'kill-server')
|
| run_command.RunCommand(adb_cmd)
|
| @@ -411,7 +411,7 @@ class Emulator(object):
|
| self.popen.kill()
|
| self.popen = None
|
|
|
| - def _ShutdownOnSignal(self, signum, frame):
|
| + def _ShutdownOnSignal(self, _signum, _frame):
|
| logging.critical('emulator _ShutdownOnSignal')
|
| for sig in self._SIGNALS:
|
| signal.signal(sig, signal.SIG_DFL)
|
|
|