From 4488205505ae4895f60306b59831c843b18bf8c6 Mon Sep 17 00:00:00 2001 From: Erfan Abdi Date: Fri, 4 Feb 2022 20:10:07 +0330 Subject: [PATCH 01/16] config: Switch to https for OTA channels * Fix issue #297 --- tools/config/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/config/__init__.py b/tools/config/__init__.py index 2c5b919..b5274a3 100644 --- a/tools/config/__init__.py +++ b/tools/config/__init__.py @@ -71,8 +71,8 @@ if session_defaults["pulse_runtime_path"] == "None": channels_defaults = { "config_path": "/usr/share/waydroid-extra/channels.cfg", - "system_channel": "http://ota.waydro.id/system", - "vendor_channel": "http://ota.waydro.id/vendor", + "system_channel": "https://ota.waydro.id/system", + "vendor_channel": "https://ota.waydro.id/vendor", "rom_type": "lineage", "system_type": "VANILLA" } -- 2.47.3 From 9bee074239199570d70630281ff0053253675044 Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Tue, 8 Feb 2022 21:53:31 +0100 Subject: [PATCH 02/16] Set sys.use_memfd=true if ashmem is not present --- tools/helpers/lxc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/helpers/lxc.py b/tools/helpers/lxc.py index 2a9c841..958c6d9 100644 --- a/tools/helpers/lxc.py +++ b/tools/helpers/lxc.py @@ -166,6 +166,10 @@ def make_base_props(args): return "" props = [] + + if not os.path.exists("/dev/ashmem"): + props.append("sys.use_memfd=true") + egl = tools.helpers.props.host_get(args, "ro.hardware.egl") gralloc = find_hal("gralloc") -- 2.47.3 From 6e268a6b2831ddf5db8fa626d78fab5578d455db Mon Sep 17 00:00:00 2001 From: Erfan Abdi Date: Thu, 10 Feb 2022 09:53:17 +0330 Subject: [PATCH 03/16] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 37 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..ecb2d31 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,37 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**General information (please complete the following information):** + - Waydroid tools Version [e.g. 1.1.0] + - Waydroid Images Version [e.g. VANILLA 20211021] + +**Desktop (please complete the following information):** + - OS: [e.g. Ubuntu 20.04 x64] + - GPU: [e.g. AMD Radeon™ RX 5700] + - Kernel version: [e.g. Generic 5.4.x] + - Host mesa version: [e.g. mesa 2.2] + +**Smartphone (please complete the following information):** + - Device: [e.g. Pixel 3a] + - OS: [e.g. Ubuntu touch OTA19] + - Mainline or Halium [e.g. Halium 9] + - Kernel version: [e.g. 4.14.x] + +**Additional context** +Add any other context about the problem here. + +**Logs (please upload as file)** + - Output of `waydroid log` + - *Full* (not partially) Output of `waydroid logcat` from the beginning of starting waydroid services diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. -- 2.47.3 From f44ba88220d9d323d76b8ddead6012c94d66697b Mon Sep 17 00:00:00 2001 From: Erfan Abdi Date: Thu, 10 Feb 2022 10:02:02 +0330 Subject: [PATCH 04/16] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index ecb2d31..9760ed3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -22,6 +22,7 @@ If applicable, add screenshots to help explain your problem. - GPU: [e.g. AMD Radeon™ RX 5700] - Kernel version: [e.g. Generic 5.4.x] - Host mesa version: [e.g. mesa 2.2] + - Desktop: [e.g. Gnome 40.x.x] **Smartphone (please complete the following information):** - Device: [e.g. Pixel 3a] -- 2.47.3 From c2c1ccb39c313e3689735f7c725f28b9f22d0154 Mon Sep 17 00:00:00 2001 From: Erfan Abdi Date: Sun, 13 Feb 2022 21:20:01 +0330 Subject: [PATCH 05/16] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 9760ed3..42ac444 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -34,5 +34,6 @@ If applicable, add screenshots to help explain your problem. Add any other context about the problem here. **Logs (please upload as file)** + - Prop file, located on `/var/lib/waydroid/waydroid_base.prop` - Output of `waydroid log` - *Full* (not partially) Output of `waydroid logcat` from the beginning of starting waydroid services -- 2.47.3 From 4606d202ce1b4bcb503209d8330a9f72d8dab2ca Mon Sep 17 00:00:00 2001 From: Erfan Abdi Date: Sun, 17 Apr 2022 21:31:58 +0430 Subject: [PATCH 06/16] tools: Upver to 1.2.1 --- tools/config/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/config/__init__.py b/tools/config/__init__.py index b5274a3..97bba86 100644 --- a/tools/config/__init__.py +++ b/tools/config/__init__.py @@ -12,7 +12,7 @@ from tools.config.save import save, save_session # # Exported variables (internal configuration) # -version = "1.2.0" +version = "1.2.1" tools_src = os.path.normpath(os.path.realpath(__file__) + "/../../..") # Keys saved in the config file (mostly what we ask in 'waydroid init') -- 2.47.3 From 02d2b113c6031cc41f610ce338dfd6a7a4f2a316 Mon Sep 17 00:00:00 2001 From: Erfan Abdi Date: Sun, 17 Apr 2022 21:33:56 +0430 Subject: [PATCH 07/16] debian: Upver to 1.2.1 --- debian/changelog | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/debian/changelog b/debian/changelog index 4b52f10..ea6e535 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,18 @@ +waydroid (1.2.1) bullseye; urgency=medium + + * Set sys.use_memfd=true if ashmem is not present + * config: Switch to https for OTA channels + * add size units and speed in download progress bar + * Add an optional [properties] in waydroid.cfg + * scripts: make sure misc subfolder exists + * container: strip possible trailing newline from pid + * lxc: Fix bad eol of proc dt values + * Resume initialization if not complete + * Remove downloaded system images which failed checksum verification + * props: Use subprocess for host getprop + + -- Erfan Abdi Sun, 17 Apr 2022 21:33:26 +0430 + waydroid (1.2.0) bullseye; urgency=medium * config: Update waydroid ota channel urls -- 2.47.3 From eebdcec852186e21a4c44ab383380e3a0453464a Mon Sep 17 00:00:00 2001 From: Alfred Neumayer Date: Thu, 10 Mar 2022 10:46:41 +0100 Subject: [PATCH 08/16] tools: Fix device names with spaces in initializer Don't try to fetch from an URL with a space inside. --- tools/actions/initializer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/actions/initializer.py b/tools/actions/initializer.py index f8cce6e..4a80bb9 100644 --- a/tools/actions/initializer.py +++ b/tools/actions/initializer.py @@ -56,7 +56,7 @@ def setup_config(args): args.vendor_type = None for vendor in [device_codename, get_vendor_type(args)]: vendor_ota = args.vendor_channel + "/waydroid_" + \ - args.arch + "/" + vendor + ".json" + args.arch + "/" + vendor.replace(" ", "_") + ".json" vendor_request = helpers.http.retrieve(vendor_ota) if vendor_request[0] == 200: args.vendor_type = vendor -- 2.47.3 From d0f96e44cc60f7fee2d338e28a44961984f45c89 Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Sat, 14 May 2022 19:50:44 +0200 Subject: [PATCH 09/16] http: Handle malformed urls --- tools/helpers/http.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/helpers/http.py b/tools/helpers/http.py index 68031c3..ff81957 100644 --- a/tools/helpers/http.py +++ b/tools/helpers/http.py @@ -138,10 +138,13 @@ def retrieve(url, headers=None): if headers is None: headers = {} - req = urllib.request.Request(url, headers=headers) try: + req = urllib.request.Request(url, headers=headers) with urllib.request.urlopen(req) as response: return 200, response.read() + # Handle malformed URL + except ValueError as e: + return -1, "" # Handle 404 except urllib.error.HTTPError as e: return e.code, "" -- 2.47.3 From facf2b713da1038bbc960bb7e094bdb80213485e Mon Sep 17 00:00:00 2001 From: Kenny MacDermid Date: Wed, 11 May 2022 12:32:40 -0300 Subject: [PATCH 10/16] Mount TUN device for use by Android VPNs. Providing access to the hosts `/dev/net/tun` is required by at least some VPN clients, for example F5 Access. --- tools/helpers/lxc.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/helpers/lxc.py b/tools/helpers/lxc.py index 958c6d9..d26b184 100644 --- a/tools/helpers/lxc.py +++ b/tools/helpers/lxc.py @@ -74,6 +74,9 @@ def generate_nodes_lxc_config(args): make_entry("none", "dev/pts", "devpts", "defaults,mode=644,ptmxmode=666,create=dir 0 0", False) make_entry("/dev/uhid") + # TUN/TAP device node for VPN + make_entry("/dev/net/tun", "dev/tun") + # Low memory killer sys node make_entry("/sys/module/lowmemorykiller", options="bind,create=dir,optional 0 0") -- 2.47.3 From 5eb95c31a8eb6c13d27dcceb5510f2d9c6a04d71 Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Fri, 10 Jun 2022 00:35:33 +0200 Subject: [PATCH 11/16] Set aidl version based on the android version --- tools/actions/container_manager.py | 33 +++++++++++++++++++++++++++ tools/helpers/drivers.py | 2 ++ tools/helpers/props.py | 11 +++++++++ tools/interfaces/IClipboard.py | 5 +++- tools/interfaces/IHardware.py | 5 +++- tools/interfaces/IPlatform.py | 5 +++- tools/interfaces/IStatusBarService.py | 5 +++- tools/interfaces/IUserMonitor.py | 5 +++- 8 files changed, 66 insertions(+), 5 deletions(-) diff --git a/tools/actions/container_manager.py b/tools/actions/container_manager.py index ee91c52..0588939 100644 --- a/tools/actions/container_manager.py +++ b/tools/actions/container_manager.py @@ -7,6 +7,7 @@ import time import glob import signal import sys +import uuid import tools.config from tools import helpers from tools import services @@ -81,11 +82,43 @@ def start(args): for path in perm_list: chmod(path, mode) + def set_aidl_version(): + cfg = tools.config.load(args) + android_api = 0 + try: + mnt = "/tmp/waydroid-" + str(uuid.uuid1()) + helpers.mount.mount(args, cfg["waydroid"]["images_path"] + "/system.img", mnt) + android_api = int(helpers.props.file_get(args, mnt + "/system/build.prop", + "ro.build.version.sdk")) + except: + logging.error("Failed to parse android version from system.img") + finally: + helpers.mount.umount_all(args, mnt); + + if android_api < 28: + binder_protocol = "aidl" + sm_protocol = "aidl" + elif android_api < 30: + binder_protocol = "aidl2" + sm_protocol = "aidl2" + elif android_api < 31: + binder_protocol = "aidl3" + sm_protocol = "aidl3" + else: + binder_protocol = "aidl3" + sm_protocol = "aidl4" + + cfg["waydroid"]["binder_protocol"] = binder_protocol + cfg["waydroid"]["service_manager_protocol"] = sm_protocol + tools.config.save(args, cfg) + def signal_handler(sig, frame): services.hardware_manager.stop(args) stop(args) sys.exit(0) + set_aidl_version() + status = helpers.lxc.status(args) if status == "STOPPED": # Load binder and ashmem drivers diff --git a/tools/helpers/drivers.py b/tools/helpers/drivers.py index cf708f0..66744b3 100644 --- a/tools/helpers/drivers.py +++ b/tools/helpers/drivers.py @@ -176,3 +176,5 @@ def loadBinderNodes(args): args.BINDER_DRIVER = cfg["waydroid"]["binder"] args.VNDBINDER_DRIVER = cfg["waydroid"]["vndbinder"] args.HWBINDER_DRIVER = cfg["waydroid"]["hwbinder"] + args.BINDER_PROTOCOL = cfg["waydroid"]["binder_protocol"] + args.SERVICE_MANAGER_PROTOCOL = cfg["waydroid"]["service_manager_protocol"] diff --git a/tools/helpers/props.py b/tools/helpers/props.py index 46ab268..de3c3a8 100644 --- a/tools/helpers/props.py +++ b/tools/helpers/props.py @@ -49,3 +49,14 @@ def set(args, prop, value): session_cfg["session"]["state"])) else: logging.error("WayDroid session is stopped") + +def file_get(args, file, prop): + with open(file) as build_prop: + for line in build_prop: + line = line.strip() + if len(line) == 0 or line[0] == "#": + continue + k,v = line.partition("=")[::2] + if k == prop: + return v; + return "" diff --git a/tools/interfaces/IClipboard.py b/tools/interfaces/IClipboard.py index a123501..5bd00b6 100644 --- a/tools/interfaces/IClipboard.py +++ b/tools/interfaces/IClipboard.py @@ -12,7 +12,10 @@ TRANSACTION_getClipboardData = 2 def add_service(args, sendClipboardData, getClipboardData): helpers.drivers.loadBinderNodes(args) - serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER) + try: + serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER, args.SERVICE_MANAGER_PROTOCOL, args.BINDER_PROTOCOL) + except TypeError: + serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER) def response_handler(req, code, flags): logging.debug( diff --git a/tools/interfaces/IHardware.py b/tools/interfaces/IHardware.py index f7984db..9e1f2fe 100644 --- a/tools/interfaces/IHardware.py +++ b/tools/interfaces/IHardware.py @@ -15,7 +15,10 @@ TRANSACTION_upgrade = 5 def add_service(args, enableNFC, enableBluetooth, suspend, reboot, upgrade): helpers.drivers.loadBinderNodes(args) - serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER) + try: + serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER, args.SERVICE_MANAGER_PROTOCOL, args.BINDER_PROTOCOL) + except TypeError: + serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER) def response_handler(req, code, flags): logging.debug( diff --git a/tools/interfaces/IPlatform.py b/tools/interfaces/IPlatform.py index 9887d13..a8a5410 100644 --- a/tools/interfaces/IPlatform.py +++ b/tools/interfaces/IPlatform.py @@ -275,7 +275,10 @@ class IPlatform: def get_service(args): helpers.drivers.loadBinderNodes(args) - serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER) + try: + serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER, args.SERVICE_MANAGER_PROTOCOL, args.BINDER_PROTOCOL) + except TypeError: + serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER) tries = 1000 remote, status = serviceManager.get_service_sync(SERVICE_NAME) diff --git a/tools/interfaces/IStatusBarService.py b/tools/interfaces/IStatusBarService.py index 0fe30a7..fa5f6f5 100644 --- a/tools/interfaces/IStatusBarService.py +++ b/tools/interfaces/IStatusBarService.py @@ -42,7 +42,10 @@ class IStatusBarService: def get_service(args): helpers.drivers.loadBinderNodes(args) - serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER) + try: + serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER, args.SERVICE_MANAGER_PROTOCOL, args.BINDER_PROTOCOL) + except TypeError: + serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER) tries = 1000 remote, status = serviceManager.get_service_sync(SERVICE_NAME) diff --git a/tools/interfaces/IUserMonitor.py b/tools/interfaces/IUserMonitor.py index 0a16031..664fac6 100644 --- a/tools/interfaces/IUserMonitor.py +++ b/tools/interfaces/IUserMonitor.py @@ -12,7 +12,10 @@ TRANSACTION_packageStateChanged = 2 def add_service(args, userUnlocked, packageStateChanged): helpers.drivers.loadBinderNodes(args) - serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER) + try: + serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER, args.SERVICE_MANAGER_PROTOCOL, args.BINDER_PROTOCOL) + except TypeError: + serviceManager = gbinder.ServiceManager("/dev/" + args.BINDER_DRIVER) def response_handler(req, code, flags): logging.debug( -- 2.47.3 From 8a9fdcac1ccddf56147f9cc34f42514b2384a5bd Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Fri, 6 May 2022 19:33:08 +0200 Subject: [PATCH 12/16] Add -w flag for waiting for init This allows for example to start the container manager before init --- tools/__init__.py | 12 +++++++++--- tools/actions/initializer.py | 6 +++++- tools/helpers/__init__.py | 1 + tools/helpers/arguments.py | 2 ++ tools/helpers/ipc.py | 26 ++++++++++++++++++++++++++ 5 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 tools/helpers/ipc.py diff --git a/tools/__init__.py b/tools/__init__.py index 2afdf42..ac67a03 100644 --- a/tools/__init__.py +++ b/tools/__init__.py @@ -31,10 +31,16 @@ def main(): args.sudo_timer = True args.timeout = 1800 - if not os.path.isfile(args.config): + if not actions.initializer.is_initialized(args): if args.action and (args.action != "init" and args.action != "log"): - print('ERROR: WayDroid is not initialized, run "waydroid init"') - return 0 + if not args.wait_for_init: + print('ERROR: WayDroid is not initialized, run "waydroid init"') + return 0 + + print('WayDroid waiting for initialization...') + while helpers.ipc.listen(channel="init") != "done": + pass + elif os.geteuid() == 0 and args.action == "init": if not os.path.exists(args.work): os.mkdir(args.work) diff --git a/tools/actions/initializer.py b/tools/actions/initializer.py index 4a80bb9..b7124d4 100644 --- a/tools/actions/initializer.py +++ b/tools/actions/initializer.py @@ -5,6 +5,8 @@ import os from tools import helpers import tools.config +def is_initialized(args): + return os.path.isfile(args.config) and os.path.isdir(tools.config.defaults["rootfs"]) def get_vendor_type(args): vndk_str = helpers.props.host_get(args, "ro.vndk.version") @@ -81,7 +83,7 @@ def setup_config(args): tools.config.save(args, cfg) def init(args): - if not os.path.isfile(args.config) or not os.path.isdir(tools.config.defaults["rootfs"]) or args.force: + if not is_initialized(args) or args.force: setup_config(args) status = "STOPPED" if os.path.exists(tools.config.defaults["lxc"] + "/waydroid"): @@ -101,5 +103,7 @@ def init(args): logging.info("Starting container") helpers.images.mount_rootfs(args, args.images_path) helpers.lxc.start(args) + + helpers.ipc.notify(channel="init", msg="done") else: logging.info("Already initialized") diff --git a/tools/helpers/__init__.py b/tools/helpers/__init__.py index 21357cf..20d4d62 100644 --- a/tools/helpers/__init__.py +++ b/tools/helpers/__init__.py @@ -8,3 +8,4 @@ import tools.helpers.images import tools.helpers.drivers import tools.helpers.mount import tools.helpers.http +import tools.helpers.ipc diff --git a/tools/helpers/arguments.py b/tools/helpers/arguments.py index 9243eb7..f686032 100644 --- a/tools/helpers/arguments.py +++ b/tools/helpers/arguments.py @@ -129,6 +129,8 @@ def arguments(): " logfiles (this may reduce performance)") parser.add_argument("-q", "--quiet", dest="quiet", action="store_true", help="do not output any log messages") + parser.add_argument("-w", "--wait", dest="wait_for_init", action="store_true", + help="wait for init before running") # Actions sub = parser.add_subparsers(title="action", dest="action") diff --git a/tools/helpers/ipc.py b/tools/helpers/ipc.py new file mode 100644 index 0000000..fbf522f --- /dev/null +++ b/tools/helpers/ipc.py @@ -0,0 +1,26 @@ +# Copyright 2022 Alessandro Astone +# SPDX-License-Identifier: GPL-3.0-or-later + +# Currently implemented as FIFO +import os + +BASE_DIR = "/var/run/" + +def listen(channel): + pipe = BASE_DIR + "waydroid-" + channel + if not os.path.exists(pipe): + os.mkfifo(pipe) + with open(pipe) as fifo: + while True: + data = fifo.read() + if len(data) != 0: + return data + +def notify(channel, msg): + pipe = BASE_DIR + "waydroid-" + channel + try: + fd = os.open(pipe, os.O_WRONLY | os.O_NONBLOCK) + with os.fdopen(fd, "w") as fifo: + fifo.write(msg) + except Exception: + pass -- 2.47.3 From 862daf8011362006d98182d84475555fbcddaf96 Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Fri, 6 May 2022 19:41:43 +0200 Subject: [PATCH 13/16] debian: Start container waiting for init if not already So that the service can be started before running `waydroid init` --- debian/waydroid-container.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/waydroid-container.service b/debian/waydroid-container.service index 256054d..a4fd020 100644 --- a/debian/waydroid-container.service +++ b/debian/waydroid-container.service @@ -2,7 +2,7 @@ Description=Waydroid Container [Service] -ExecStart=/usr/bin/waydroid container start +ExecStart=/usr/bin/waydroid -w container start ExecStop=/usr/bin/waydroid container stop ExecStopPost=/usr/bin/waydroid session stop -- 2.47.3 From 5111dc987b7fc3298934b6c4c3d6b97055583a86 Mon Sep 17 00:00:00 2001 From: Mitchel Stewart <74831516+Quackdoc@users.noreply.github.com> Date: Wed, 6 Jul 2022 12:22:53 -0400 Subject: [PATCH 14/16] Allows waydroid to create PTY (#349) --- data/configs/config_1 | 1 + data/configs/config_2 | 1 + 2 files changed, 2 insertions(+) diff --git a/data/configs/config_1 b/data/configs/config_1 index 97ef00e..9cc28f9 100644 --- a/data/configs/config_1 +++ b/data/configs/config_1 @@ -19,6 +19,7 @@ lxc.network.hwaddr = 00:16:3e:f9:d3:03 lxc.network.mtu = 1500 lxc.console.path = none +lxc.pty.max = 10 lxc.include = /var/lib/waydroid/lxc/waydroid/config_nodes diff --git a/data/configs/config_2 b/data/configs/config_2 index b397c02..67cade1 100644 --- a/data/configs/config_2 +++ b/data/configs/config_2 @@ -19,6 +19,7 @@ lxc.net.0.hwaddr = 00:16:3e:f9:d3:03 lxc.net.0.mtu = 1500 lxc.console.path = none +lxc.pty.max = 10 lxc.include = /var/lib/waydroid/lxc/waydroid/config_nodes -- 2.47.3 From e589328e4992ab83a538986af59fe7fd00a55c79 Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Sun, 26 Jun 2022 17:15:22 +0200 Subject: [PATCH 15/16] Downgrade x86_64 to x86 if no SSE4.2 --- tools/helpers/arch.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/helpers/arch.py b/tools/helpers/arch.py index 35e8516..af18e66 100644 --- a/tools/helpers/arch.py +++ b/tools/helpers/arch.py @@ -1,6 +1,7 @@ # Copyright 2021 Oliver Smith # SPDX-License-Identifier: GPL-3.0-or-later import platform +import logging def host(): machine = platform.machine() @@ -13,6 +14,15 @@ def host(): "armv8l": "arm" } if machine in mapping: - return mapping[machine] + return maybe_remap(mapping[machine]) raise ValueError("platform.machine '" + machine + "'" " architecture is not supported") + +def maybe_remap(target): + if target == "x86_64": + with open("/proc/cpuinfo") as f: + if "sse4_2" not in f.read(): + logging.info("x86_64 CPU does not support SSE4.2, falling back to x86...") + return "x86" + + return target -- 2.47.3 From f11e373fdf34b810fc99c0f1abcb6bb093b119e6 Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Fri, 1 Jul 2022 15:41:23 +0200 Subject: [PATCH 16/16] app_manager: Factor out common function to start session then launch --- tools/actions/app_manager.py | 57 +++++++++++++----------------------- 1 file changed, 21 insertions(+), 36 deletions(-) diff --git a/tools/actions/app_manager.py b/tools/actions/app_manager.py index 46d0818..cd66ab5 100644 --- a/tools/actions/app_manager.py +++ b/tools/actions/app_manager.py @@ -45,6 +45,25 @@ def remove(args): else: logging.error("WayDroid session is stopped") +def maybeLaunchLater(args, retry, launchNow): + if os.path.exists(tools.config.session_defaults["config_path"]): + session_cfg = tools.config.load_session() + + if session_cfg["session"]["state"] == "RUNNING": + launchNow() + elif session_cfg["session"]["state"] == "FROZEN" or session_cfg["session"]["state"] == "UNFREEZE": + session_cfg["session"]["state"] = "UNFREEZE" + tools.config.save_session(session_cfg) + while session_cfg["session"]["state"] != "RUNNING": + session_cfg = tools.config.load_session() + launchNow() + else: + logging.error("WayDroid container is {}".format( + session_cfg["session"]["state"])) + else: + logging.error("Starting waydroid session") + tools.actions.session_manager.start(args, retry) + def launch(args): def justLaunch(): platformService = IPlatform.get_service(args) @@ -61,24 +80,7 @@ def launch(args): 2, "policy_control", "immersive.full=*") else: logging.error("Failed to access IPlatform service") - - if os.path.exists(tools.config.session_defaults["config_path"]): - session_cfg = tools.config.load_session() - - if session_cfg["session"]["state"] == "RUNNING": - justLaunch() - elif session_cfg["session"]["state"] == "FROZEN" or session_cfg["session"]["state"] == "UNFREEZE": - session_cfg["session"]["state"] = "UNFREEZE" - tools.config.save_session(session_cfg) - while session_cfg["session"]["state"] != "RUNNING": - session_cfg = tools.config.load_session() - justLaunch() - else: - logging.error("WayDroid container is {}".format( - session_cfg["session"]["state"])) - else: - logging.error("Starting waydroid session") - tools.actions.session_manager.start(args, launch) + maybeLaunchLater(args, launch, justLaunch) def list(args): if os.path.exists(tools.config.session_defaults["config_path"]): @@ -113,21 +115,4 @@ def showFullUI(args): statusBarService.expand() time.sleep(0.5) statusBarService.collapse() - - if os.path.exists(tools.config.session_defaults["config_path"]): - session_cfg = tools.config.load_session() - - if session_cfg["session"]["state"] == "RUNNING": - justShow() - elif session_cfg["session"]["state"] == "FROZEN" or session_cfg["session"]["state"] == "UNFREEZE": - session_cfg["session"]["state"] = "UNFREEZE" - tools.config.save_session(session_cfg) - while session_cfg["session"]["state"] != "RUNNING": - session_cfg = tools.config.load_session() - justShow() - else: - logging.error("WayDroid container is {}".format( - session_cfg["session"]["state"])) - else: - logging.error("Starting waydroid session") - tools.actions.session_manager.start(args, showFullUI) + maybeLaunchLater(args, showFullUI, justShow) -- 2.47.3