Teach 'stop' command how to kill the running Android process

Also fixed --use-osmesa to be desktop only.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/849923002
This commit is contained in:
Eric Seidel 2015-01-13 13:16:30 -08:00
parent f1316f75db
commit 1142b76f60

View File

@ -36,6 +36,8 @@ SKY_SERVER_PORT = 9999
PID_FILE_PATH = "/tmp/skydb.pids"
DEFAULT_URL = "https://raw.githubusercontent.com/domokit/mojo/master/sky/examples/home.sky"
ANDROID_PACKAGE = "org.chromium.mojo.shell"
ANDROID_ACTIVITY = "%s/.MojoShellActivity" % ANDROID_PACKAGE
# FIXME: Move this into mopy.config
def gn_args_from_build_dir(build_dir):
@ -88,7 +90,7 @@ class SkyDebugger(object):
'-W',
'-S',
'-a', 'android.intent.action.VIEW',
'-n', 'org.chromium.mojo.shell/.MojoShellActivity',
'-n', ANDROID_ACTIVITY,
# FIXME: This quoting is very error-prone. Perhaps we should read
# our args from a file instead?
'--esa', 'parameters', ','.join(escaped_args),
@ -107,9 +109,6 @@ class SkyDebugger(object):
'--args-for=mojo:sky_debugger_prompt %d' % remote_command_port,
'mojo:window_manager',
]
# FIXME: This probably is wrong for android?
if args.use_osmesa:
shell_args.append('--args-for=mojo:native_viewport_service --use-osmesa')
if 'remote_sky_server_port' in self.pids:
shell_command = self._wrap_for_android(shell_args)
@ -179,8 +178,14 @@ class SkyDebugger(object):
shell_command = self._build_mojo_shell_command(args)
if not is_android:
# Desktop-only work-around for mojo crashing under chromoting.
if args.use_osmesa:
shell_args.append(
'--args-for=mojo:native_viewport_service --use-osmesa')
# On android we can't launch inside gdb, but rather have to attach.
if args.gdb and not is_android:
if args.gdb:
shell_command = ['gdbserver', ':%s' % GDB_PORT] + shell_command
print ' '.join(map(pipes.quote, shell_command))
@ -233,6 +238,9 @@ class SkyDebugger(object):
port_string = 'tcp:%s' % self.pids['sky_command_port']
subprocess.call(['adb', 'forward', '--remove', port_string])
subprocess.call([
'adb', 'shell', 'am', 'force-stop', ANDROID_PACKAGE])
if 'remote_gdbserver_port' in self.pids:
port_string = 'tcp:%s' % self.pids['remote_gdbserver_port']
subprocess.call(['adb', 'forward', '--remove', port_string])