Bug 1395718 - In devicemanager killProcess, only use force-stop when a signal is not specified; r=bc

dm.killProcess correctly tries to use 'am force-stop' in preference to kill()
to end a process. But some clients of killProcess specify a kill signal and
use killProcess for purposes other than endding the process, for example, to trigger
crash dumps. To allow for these cases, it is better to not use force-stop when a
signal is specified.
This commit is contained in:
Geoff Brown 2017-09-01 11:35:45 -06:00
Родитель 5b321f702f
Коммит 7a2a74a3fb
1 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -444,11 +444,12 @@ class DeviceManagerADB(DeviceManager):
return outputFile
def killProcess(self, appname, sig=None):
try:
self.shellCheckOutput(["am", "force-stop", appname], timeout=self.short_timeout)
except:
# no problem - will kill it instead
self._logger.info("killProcess failed force-stop of %s" % appname)
if not sig:
try:
self.shellCheckOutput(["am", "force-stop", appname], timeout=self.short_timeout)
except:
# no problem - will kill it instead
self._logger.info("killProcess failed force-stop of %s" % appname)
shell_args = ["shell"]
if self._sdk_version >= version_codes.N: