Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make app auto-start optional in Android install script #57

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions lgl_android_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
specify the device (--device/-D) and the package to use (--package/-P) on the
command line.

By default the application package will not automatically start, letting the
script be used in existing workflows that may want to manage the application
lifecycle externally. If you run the script with --auto-start, the script will
start and stop the package automatically.

You must specify one or more layer directories in the repository using the
--layer option, e.g. "--layer layer_example". This option can be used multiple
times to specify the installation of multiple stacked layers.
Expand Down Expand Up @@ -696,6 +701,10 @@ def parse_cli() -> argparse.Namespace:
'--layer', '-L', action='append', required=True,
help='layer directory of a layer to install (required, repeatable)')

parser.add_argument(
'--auto-start', '-A', action='store_true', default=False,
help='auto-start and stop the package (default=false)')

parser.add_argument(
'--config', '-C', action='append', default=[],
help='layer config to install (repeatable)')
Expand Down Expand Up @@ -792,13 +801,15 @@ def main() -> int:
perfetto_conf = configure_perfetto(conn, args.perfetto)

# Restart the package so it actually loads the layer ...
AndroidUtils.stop_package(conn)
AndroidUtils.start_package(conn, activity)
if args.auto_start:
AndroidUtils.stop_package(conn)
AndroidUtils.start_package(conn, activity)

input('Press any key when finished to uninstall all layers')

# Kill the package so we can cleanup
AndroidUtils.stop_package(conn)
if args.auto_start:
AndroidUtils.stop_package(conn)

# Disable Perfetto trace
if args.perfetto and perfetto_conf:
Expand Down