android: fix application name used in ./mach run (#32652)

This patch also switches the code to python format strings
so that the application name can be interpolated where
needed.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
Mukilan Thiyagarajan 2024-07-01 13:40:00 +05:30 committed by GitHub
parent e2e7476404
commit 0615428aa9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -33,6 +33,9 @@ from servo.command_base import (
) )
ANDROID_APP_NAME = "org.servo.servoshell"
def read_file(filename, if_exists=False): def read_file(filename, if_exists=False):
if if_exists and not path.exists(filename): if if_exists and not path.exists(filename):
return None return None
@ -104,7 +107,7 @@ class PostBuildCommands(CommandBase):
print("https://github.com/servo/servo/wiki/Building-for-Android#debugging-on-device") print("https://github.com/servo/servo/wiki/Building-for-Android#debugging-on-device")
return return
script = [ script = [
"am force-stop org.servo.servoshell", f"am force-stop {ANDROID_APP_NAME}",
] ]
json_params = shell_quote(json.dumps(params)) json_params = shell_quote(json.dumps(params))
extra = "-e servoargs " + json_params extra = "-e servoargs " + json_params
@ -115,10 +118,10 @@ class PostBuildCommands(CommandBase):
if gst_debug: if gst_debug:
extra += " -e gstdebug " + gst_debug extra += " -e gstdebug " + gst_debug
script += [ script += [
"am start " + extra + " org.servo.servoshell/org.servo.servoshell.MainActivity", f"am start {extra} {ANDROID_APP_NAME}/{ANDROID_APP_NAME}.MainActivity",
"sleep 0.5", "sleep 0.5",
"echo Servo PID: $(pidof org.servo.servoshell)", f"echo Servo PID: $(pidof {ANDROID_APP_NAME})",
"logcat --pid=$(pidof org.servo.sevoshell)", f"logcat --pid=$(pidof {ANDROID_APP_NAME})",
"exit" "exit"
] ]
args = [self.android_adb_path(env)] args = [self.android_adb_path(env)]