[-]
[+]
|
Changed |
_service:tar_git:waydroid.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/sailfishos-open/waydroid.git</param>
<param name="branch">main</param>
- <param name="revision">1.2.0+git6</param>
+ <param name="revision">1.3.3+git2</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Deleted |
_service:tar_git:waydroid-1.2.0+git6.tar.gz/upstream/debian/waydroid-container.service
^
|
@@ -1,10 +0,0 @@
-[Unit]
-Description=Waydroid Container
-
-[Service]
-ExecStart=/usr/bin/waydroid container start
-ExecStop=/usr/bin/waydroid container stop
-ExecStopPost=/usr/bin/waydroid session stop
-
-[Install]
-WantedBy=multi-user.target
|
[-]
[+]
|
Deleted |
_service:tar_git:waydroid-1.2.0+git6.tar.gz/upstream/debian/waydroid.dirs
^
|
@@ -1,3 +0,0 @@
-/usr/bin
-/usr/lib/waydroid
-/etc/gbinder.d
|
[-]
[+]
|
Deleted |
_service:tar_git:waydroid-1.2.0+git6.tar.gz/upstream/debian/waydroid.install
^
|
@@ -1,4 +0,0 @@
-waydroid.py /usr/lib/waydroid
-tools /usr/lib/waydroid
-data /usr/lib/waydroid
-gbinder/anbox.conf /etc/gbinder.d
|
[-]
[+]
|
Deleted |
_service:tar_git:waydroid-1.2.0+git6.tar.gz/upstream/debian/waydroid.links
^
|
@@ -1,2 +0,0 @@
-/usr/lib/waydroid/waydroid.py /usr/bin/waydroid
-/usr/lib/waydroid/data/Waydroid.desktop /usr/share/applications/Waydroid.desktop
|
[-]
[+]
|
Deleted |
_service:tar_git:waydroid-1.2.0+git6.tar.gz/upstream/gbinder/anbox.conf
^
|
@@ -1,9 +0,0 @@
-[Protocol]
-/dev/anbox-binder = aidl2
-/dev/anbox-vndbinder = aidl2
-/dev/anbox-hwbinder = hidl
-
-[ServiceManager]
-/dev/anbox-binder = aidl2
-/dev/anbox-vndbinder = aidl2
-/dev/anbox-hwbinder = hidl
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/config/waydroid.desktop
^
|
@@ -3,3 +3,6 @@
Name=Waydroid
Exec=waydroid show-full-ui
Icon=/opt/waydroid/data/AppIcon.png
+
+[X-Sailjail]
+Sandboxing=Disabled
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/.abstruse.yml
^
|
@@ -1,13 +1,17 @@
-image: mrcyjanek/waydroid:ubuntu.20-04
+image: mrcyjanek/waydroid:ubuntu-devel
matrix:
- - env: DISTRO=focal
- image: mrcyjanek/waydroid:ubuntu.20-04
- - env: DISTRO=bullseye
- image: mrcyjanek/waydroid:debian.11
+ - env: DISTRO=ubuntu-devel
+ image: mrcyjanek/waydroid:ubuntu-devel
+ - env: DISTRO=sid
+ image: mrcyjanek/waydroid:sid
- env: DISTRO=bookworm
- image: mrcyjanek/waydroid:debian.12
- - env: DISTRO=hirsute
- image: mrcyjanek/waydroid:ubuntu.21-04
+ image: mrcyjanek/waydroid:bookworm
+ - env: DISTRO=bullseye
+ image: mrcyjanek/waydroid:bullseye
+ - env: DISTRO=jammy
+ image: mrcyjanek/waydroid:jammy
+ - env: DISTRO=focal
+ image: mrcyjanek/waydroid:focal
script:
- apt update
- build_changelog
|
[-]
[+]
|
Added |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/.github/ISSUE_TEMPLATE/bug_report.md
^
|
@@ -0,0 +1,39 @@
+---
+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]
+ - Desktop: [e.g. Gnome 40.x.x]
+
+**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)**
+ - 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
|
[-]
[+]
|
Added |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/.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.
|
[-]
[+]
|
Added |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/FUNDING.yml
^
|
@@ -0,0 +1 @@
+open_collective: waydroid
|
[-]
[+]
|
Added |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/Makefile
^
|
@@ -0,0 +1,33 @@
+PREFIX := /usr
+
+USE_SYSTEMD ?= 1
+USE_NFTABLES ?= 0
+
+WAYDROID_DIR := $(PREFIX)/lib/waydroid
+BIN_DIR := $(PREFIX)/bin
+APPS_DIR := $(PREFIX)/share/applications
+METAINFO_DIR := $(PREFIX)/share/metainfo
+SYSD_DIR := $(PREFIX)/lib/systemd/system
+
+INSTALL_WAYDROID_DIR := $(DESTDIR)$(WAYDROID_DIR)
+INSTALL_BIN_DIR := $(DESTDIR)$(BIN_DIR)
+INSTALL_APPS_DIR := $(DESTDIR)$(APPS_DIR)
+INSTALL_METAINFO_DIR := $(DESTDIR)$(METAINFO_DIR)
+INSTALL_SYSD_DIR := $(DESTDIR)$(SYSD_DIR)
+
+build:
+ @echo "Nothing to build, run 'make install' to copy the files!"
+
+install:
+ install -d $(INSTALL_WAYDROID_DIR) $(INSTALL_BIN_DIR) $(INSTALL_APPS_DIR) $(INSTALL_METAINFO_DIR)
+ cp -a data tools waydroid.py $(INSTALL_WAYDROID_DIR)
+ ln -sf $(WAYDROID_DIR)/waydroid.py $(INSTALL_BIN_DIR)/waydroid
+ mv $(INSTALL_WAYDROID_DIR)/data/*.desktop $(INSTALL_APPS_DIR)
+ mv $(INSTALL_WAYDROID_DIR)/data/*.metainfo.xml $(INSTALL_METAINFO_DIR)
+ if [ $(USE_SYSTEMD) = 1 ]; then \
+ install -d $(INSTALL_SYSD_DIR); \
+ cp systemd/waydroid-container.service $(INSTALL_SYSD_DIR); \
+ fi
+ if [ $(USE_NFTABLES) = 1 ]; then \
+ sed '/LXC_USE_NFT=/ s/false/true/' -i $(INSTALL_WAYDROID_DIR)/data/scripts/waydroid-net.sh; \
+ fi
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/README.md
^
|
@@ -26,4 +26,4 @@
## Get in Touch
If you want to get in contact with the developers please feel free to join the
-*Waydroid* groups in [Matrix](https://matrix.to/#/#waydroid:connolly.tech) or [Telegram](https://t.me/WayDroid).
+*Waydroid* groups in [Matrix](https://matrix.to/#/#waydroid:mrcyjanek.net) or [Telegram](https://t.me/WayDroid).
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/data/Waydroid.desktop
^
|
@@ -1,5 +1,5 @@
[Desktop Entry]
Type=Application
Name=Waydroid
-Exec=waydroid show-full-ui
+Exec=waydroid first-launch
Icon=/usr/lib/waydroid/data/AppIcon.png
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/data/configs/config_1
^
|
@@ -1,15 +1,9 @@
-# Waydroid LXC Config
-
-lxc.rootfs.path = /var/lib/waydroid/rootfs
lxc.utsname = waydroid
-lxc.arch = LXCARCH
-lxc.autodev = 0
-# lxc.autodev.tmpfs.size = 25000000
-lxc.aa_profile = unconfined
lxc.init_cmd = /init
-lxc.mount.auto = cgroup:ro sys:ro proc
+lxc.aa_profile = unconfined
+lxc.seccomp = /var/lib/waydroid/lxc/waydroid/waydroid.seccomp
lxc.network.type = veth
lxc.network.flags = up
@@ -18,8 +12,3 @@
lxc.network.hwaddr = 00:16:3e:f9:d3:03
lxc.network.mtu = 1500
-lxc.console.path = none
-
-lxc.include = /var/lib/waydroid/lxc/waydroid/config_nodes
-
-lxc.hook.post-stop = /dev/null
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/data/configs/config_2
^
|
@@ -1,15 +1,11 @@
-# Waydroid LXC Config
-
-lxc.rootfs.path = /var/lib/waydroid/rootfs
lxc.uts.name = waydroid
-lxc.arch = LXCARCH
-lxc.autodev = 0
-# lxc.autodev.tmpfs.size = 25000000
+
lxc.apparmor.profile = unconfined
+lxc.seccomp.profile = /var/lib/waydroid/lxc/waydroid/waydroid.seccomp
-lxc.init.cmd = /init
+lxc.no_new_privs = 1
-lxc.mount.auto = cgroup:ro sys:ro proc
+lxc.init.cmd = /init
lxc.net.0.type = veth
lxc.net.0.flags = up
@@ -18,8 +14,3 @@
lxc.net.0.hwaddr = 00:16:3e:f9:d3:03
lxc.net.0.mtu = 1500
-lxc.console.path = none
-
-lxc.include = /var/lib/waydroid/lxc/waydroid/config_nodes
-
-lxc.hook.post-stop = /dev/null
|
[-]
[+]
|
Added |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/data/configs/config_4
^
|
@@ -0,0 +1,2 @@
+lxc.seccomp.allow_nesting = 1
+
|
[-]
[+]
|
Added |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/data/configs/config_base
^
|
@@ -0,0 +1,18 @@
+# Waydroid LXC Config
+
+lxc.rootfs.path = /var/lib/waydroid/rootfs
+lxc.arch = LXCARCH
+lxc.autodev = 0
+# lxc.autodev.tmpfs.size = 25000000
+
+lxc.cap.keep = audit_control sys_nice wake_alarm setpcap setgid setuid sys_ptrace sys_admin wake_alarm block_suspend sys_time net_admin net_raw net_bind_service kill dac_override dac_read_search fsetid mknod syslog chown sys_resource fowner sys_module ipc_lock sys_chroot
+
+lxc.mount.auto = cgroup:ro sys:ro proc
+
+lxc.console.path = none
+lxc.pty.max = 10
+
+lxc.include = /var/lib/waydroid/lxc/waydroid/config_nodes
+
+lxc.hook.post-stop = /dev/null
+
|
[-]
[+]
|
Added |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/data/configs/waydroid.seccomp
^
|
@@ -0,0 +1,21 @@
+2
+blacklist
+init_module
+finit_module
+delete_module
+_sysctl
+kexec_file_load
+kexec_load
+reboot
+adjtimex errno 0
+clock_adjtime errno 0
+clock_adjtime64 errno 0
+clock_settime errno 0
+clock_settime64 errno 0
+settimeofday errno 0
+stime errno 0
+add_key errno 0
+keyctl errno 0
+request_key errno 0
+swapoff errno 0
+swapon errno 0
|
[-]
[+]
|
Added |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/data/id.waydro.waydroid.metainfo.xml
^
|
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component type="desktop-application">
+ <id>id.waydro.waydroid</id>
+
+ <name>Waydroid</name>
+ <summary>Run Android apps natively alongside desktop programs</summary>
+
+ <metadata_license>CC0-1.0</metadata_license>
+ <project_license>GPL-3.0-only</project_license>
+
+ <supports>
+ <control>pointing</control>
+ <control>keyboard</control>
+ <control>touch</control>
+ <control>tablet</control>
+ </supports>
+
+ <description>
+ <p>
+ Waydroid is a container-based approach to boot a full Android system on a regular GNU/Linux system. The Android system inside the container has direct access to needed hardware through LXC and the binder interface.
+ </p>
+ </description>
+
+ <launchable type="desktop-id">Waydroid.desktop</launchable>
+ <screenshots>
+ <screenshot type="default">
+ <image>https://waydro.id/assets/images/hero/main_landing.jpeg</image>
+ </screenshot>
+ <screenshot>
+ <image>https://waydro.id/assets/images/hero/Group%201.png</image>
+ </screenshot>
+ <screenshot>
+ <image>https://waydro.id/assets/images/hero/clean_desktop.jpeg</image>
+ </screenshot>
+ </screenshots>
+</component>
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/data/scripts/waydroid-net.sh
^
|
@@ -2,14 +2,22 @@
varrun="/run/waydroid-lxc"
varlib="/var/lib"
+vnic=$(awk '$1 == "lxc.net.0.link" {print $3}' /var/lib/waydroid/lxc/waydroid/config || echo "waydroid0")
+
+if [ "$vnic" != "waydroid0" ]; then
+ echo "vnic is $vnic, bailing out"
+ exit 0
+else
+ echo "vnic is waydroid0"
+fi
USE_LXC_BRIDGE="true"
-LXC_BRIDGE="waydroid0"
+LXC_BRIDGE="${vnic}"
LXC_BRIDGE_MAC="00:16:3e:00:00:01"
-LXC_ADDR="192.168.250.1"
+LXC_ADDR="192.168.240.1"
LXC_NETMASK="255.255.255.0"
-LXC_NETWORK="192.168.250.0/24"
-LXC_DHCP_RANGE="192.168.250.2,192.168.250.254"
+LXC_NETWORK="192.168.240.0/24"
+LXC_DHCP_RANGE="192.168.240.2,192.168.240.254"
LXC_DHCP_MAX="253"
LXC_DHCP_CONFILE=""
LXC_DHCP_PING="true"
@@ -182,6 +190,10 @@
LXC_DHCP_PING_ARG="--no-ping"
fi
+ if [ ! -d "${varlib}"/misc ]; then
+ mkdir "${varlib}"/misc
+ fi
+
dnsmasq $LXC_DHCP_CONFILE_ARG $LXC_DOMAIN_ARG $LXC_DHCP_PING_ARG -u ${DNSMASQ_USER} \
--strict-order --bind-interfaces --pid-file="${varrun}"/dnsmasq.pid \
--listen-address ${LXC_ADDR} --dhcp-range ${LXC_DHCP_RANGE} \
|
[-]
[+]
|
Added |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/data/waydroid.market.desktop
^
|
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Name=Waydroid Market
+Comment=Android Market Protocol Handler
+Exec=waydroid app intent android.intent.action.VIEW %u
+Icon=/usr/lib/waydroid/data/AppIcon.png
+Type=Application
+Encoding=UTF-8
+Terminal=false
+NoDisplay=true
+Categories=Utility;
+MimeType=x-scheme-handler/market;
+X-KDE-Protocols=market;
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/debian/changelog
^
|
@@ -1,3 +1,93 @@
+waydroid (1.3.3) bullseye; urgency=medium
+
+ * Makefile: Install waydroid binary without relative symlink
+ * lxc: Finer-grained config control
+ * Configure multiple preinstalled images paths
+ * tools: Upver to 1.3.3
+
+ -- Alessandro Astone <ales.astone@gmail.com> Sat, 24 Sep 2022 10:43:18 +0000
+
+waydroid (1.3.2) bullseye; urgency=medium
+
+ * app_manager: Don't rmdir /data/waydroid_tmp after install
+ * gpu: Disable nouveau support
+ * A "No New Privileges" has been enabled for the container.
+ * Container capabilities have been restricted.
+ * A seccomp profile for the entire container has been added.
+ * Rebuild waydroid.prop after live upgrade
+ * Quiet ashmem modprobe errors
+ * tools: Upver to 1.3.2
+
+ -- Alessandro Astone <ales.astone@gmail.com> Sun, 11 Sep 2022 17:51:38 +0000
+
+waydroid (1.3.1) bullseye; urgency=medium
+
+ * CI: add support for rolling releases
+ * Makefile: Allow installing over an existing installation
+ * Makefile: Allow overriding directories without having to know the DESTDIR
+ * debian: Use /lib/systemd/system for units
+ * CI: Restore versioned debian
+ * Add mainline vulkan support
+ * Detect HIDL gralloc4
+ * tools: Upver to 1.3.1
+
+ -- Alessandro Astone <ales.astone@gmail.com> Fri, 02 Sep 2022 12:23:28 +0000
+
+waydroid (1.3.0) bullseye; urgency=medium
+
+ * tools: Fix device names with spaces in initializer
+ * http: Handle malformed urls
+ * Mount TUN device for use by Android VPNs.
+ * Set aidl version based on the android version
+ * Add -w flag for waiting for init
+ * debian: Start container waiting for init if not already
+ * Allows waydroid to create PTY (#349)
+ * Downgrade x86_64 to x86 if no SSE4.2
+ * app_manager: Factor out common function to start session then launch
+ * app_manager: Add launch intent
+ * Add Android Market Protocol Handler
+ * waydroid.market.desktop: update some properties
+ * waydroid.market.desktop: use `waydroid app intent`
+ * Fixup market:// handler
+ * lxc: Optionally bind-mount NFC config
+ * Improve robustness of the dynamic aidl version picker
+ * init: Always redownload the image when changing parameters
+ * Default nvidia to swiftshader
+ * ci: update to jammy
+ * Update Matrix link
+ * container: Only umount /sys/fs/cgroup/schedtune if needed
+ * make waydroid-net more flexible (#267)
+ * Disable OTA updater when using preinstalled images
+ * Add first-launch command
+ * Revert "Add first-launch command"
+ * debian: Move waydroid-container.service under new toplevel systemd dir
+ * gbinder: Remove unnecessary configs
+ * Makefile: Add distro-agnostic buildsystem
+ * debian: Adapt to new Makefile buildsystem
+ * Support upgrading major android versions
+ * Add first-launch command [v2]
+ * Show first-launch icon on wayland gtk
+ * Makefile: Add prefix for systemd directory
+ * fix typo in arguments.py
+ * Add appstream metadata
+
+ -- Alessandro Astone <ales.astone@gmail.com> Sun, 07 Aug 2022 21:37:46 +0000
+
+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 <erfangplus@gmail.com> Sun, 17 Apr 2022 21:33:26 +0430
+
waydroid (1.2.0) bullseye; urgency=medium
* config: Update waydroid ota channel urls
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/debian/control
^
|
@@ -15,7 +15,8 @@
${python3:Depends},
lxc,
python3-gbinder,
- python3-gi
+ python3-gi,
+ gir1.2-gtk-3.0
Description: Android™ application support
waydroid allows running a separate Android™ environment
confined to a LXC container.
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/debian/rules
^
|
@@ -3,5 +3,5 @@
%:
dh $@ --with=python3
-override_dh_installsystemd:
- dh_installsystemd --name=waydroid-container
+override_dh_auto_install:
+ dh_auto_install -- SYSD_DIR=/lib/systemd/system
|
[-]
[+]
|
Added |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/systemd/waydroid-container.service
^
|
@@ -0,0 +1,10 @@
+[Unit]
+Description=Waydroid Container
+
+[Service]
+ExecStart=/usr/bin/waydroid -w container start
+ExecStop=/usr/bin/waydroid container stop
+ExecStopPost=/usr/bin/waydroid session stop
+
+[Install]
+WantedBy=multi-user.target
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/__init__.py
^
|
@@ -31,23 +31,22 @@
args.sudo_timer = True
args.timeout = 1800
- if not os.path.isfile(args.config):
- if args.action and (args.action != "init" and args.action != "log"):
- print('ERROR: WayDroid is not initialized, run "waydroid init"')
- return 0
- elif os.geteuid() == 0 and args.action == "init":
- if not os.path.exists(args.work):
- os.mkdir(args.work)
- else:
- # This branch is taken if:
- # - waydroid is not yet initialized
- # - waydroid is invoked with no command or with log
- if not os.path.exists(args.log):
- # The log could have been already created if init was used and failed, if its not the case we use a temporary one
- args.log = "/tmp/tools.log"
+ if os.geteuid() == 0:
+ if not os.path.exists(args.work):
+ os.mkdir(args.work)
+ elif not os.path.exists(args.log):
+ args.log = "/tmp/tools.log"
tools_logging.init(args)
+ if not actions.initializer.is_initialized(args) and \
+ args.action and args.action not in ("init", "first-launch", "log"):
+ if args.wait_for_init:
+ actions.wait_for_init(args)
+ else:
+ print('ERROR: WayDroid is not initialized, run "waydroid init"')
+ return 0
+
# Initialize or require config
if args.action == "init":
actionNeedRoot(args.action)
@@ -85,6 +84,8 @@
actions.app_manager.remove(args)
elif args.subaction == "launch":
actions.app_manager.launch(args)
+ elif args.subaction == "intent":
+ actions.app_manager.intent(args)
elif args.subaction == "list":
actions.app_manager.list(args)
else:
@@ -108,6 +109,10 @@
helpers.lxc.logcat(args)
elif args.action == "show-full-ui":
actions.app_manager.showFullUI(args)
+ elif args.action == "first-launch":
+ actions.remote_init_client(args)
+ if actions.initializer.is_initialized(args):
+ actions.app_manager.showFullUI(args)
elif args.action == "status":
actions.status.print_status(args)
elif args.action == "log":
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/actions/__init__.py
^
|
@@ -1,6 +1,6 @@
# Copyright 2021 Erfan Abdi
# SPDX-License-Identifier: GPL-3.0-or-later
-from tools.actions.initializer import init
+from tools.actions.initializer import init, wait_for_init, remote_init_client
from tools.actions.upgrader import upgrade
from tools.actions.session_manager import start, stop
from tools.actions.container_manager import start, stop, freeze, unfreeze
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/actions/app_manager.py
^
|
@@ -21,7 +21,7 @@
platformService = IPlatform.get_service(args)
if platformService:
platformService.installApp("/data/waydroid_tmp/base.apk")
- shutil.rmtree(tmp_dir)
+ os.remove(tmp_dir + "/base.apk")
else:
logging.error("WayDroid container is {}".format(
session_cfg["session"]["state"]))
@@ -45,6 +45,25 @@
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 @@
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,25 @@
statusBarService.expand()
time.sleep(0.5)
statusBarService.collapse()
+ maybeLaunchLater(args, showFullUI, justShow)
- 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()
+def intent(args):
+ def justLaunch():
+ platformService = IPlatform.get_service(args)
+ if platformService:
+ ret = platformService.launchIntent(args.ACTION, args.URI)
+ if ret == "":
+ return
+ pkg = ret if ret != "android" else "Waydroid"
+ platformService.setprop("waydroid.active_apps", pkg)
+ multiwin = platformService.getprop(
+ "persist.waydroid.multi_windows", "false")
+ if multiwin == "false":
+ platformService.settingsPutString(
+ 2, "policy_control", "immersive.status=*")
+ else:
+ platformService.settingsPutString(
+ 2, "policy_control", "immersive.full=*")
else:
- logging.error("WayDroid container is {}".format(
- session_cfg["session"]["state"]))
- else:
- logging.error("Starting waydroid session")
- tools.actions.session_manager.start(args, showFullUI)
+ logging.error("Failed to access IPlatform service")
+ maybeLaunchLater(args, intent, justLaunch)
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/actions/container_manager.py
^
|
@@ -7,44 +7,13 @@
import glob
import signal
import sys
+import uuid
import tools.config
from tools import helpers
from tools import services
def start(args):
- def make_prop(full_props_path):
- def add_prop(key, cfg_key):
- value = session_cfg["session"][cfg_key]
- if value != "None":
- value = value.replace("/mnt/", "/mnt_extra/")
- props.append(key + "=" + value)
-
- if not os.path.isfile(args.work + "/waydroid_base.prop"):
- raise RuntimeError("waydroid_base.prop Not found")
- with open(args.work + "/waydroid_base.prop") as f:
- props = f.read().splitlines()
- if not props:
- raise RuntimeError("waydroid_base.prop is broken!!?")
-
- add_prop("waydroid.host.user", "user_name")
- add_prop("waydroid.host.uid", "user_id")
- add_prop("waydroid.host.gid", "group_id")
- add_prop("waydroid.xdg_runtime_dir", "xdg_runtime_dir")
- add_prop("waydroid.pulse_runtime_path", "pulse_runtime_path")
- add_prop("waydroid.wayland_display", "wayland_display")
- if which("waydroid-sensord") is None:
- props.append("waydroid.stub_sensors_hal=1")
- dpi = session_cfg["session"]["lcd_density"]
- if dpi != "0":
- props.append("ro.sf.lcd_density=" + dpi)
-
- final_props = open(full_props_path, "w")
- for prop in props:
- final_props.write(prop + "\n")
- final_props.close()
- os.chmod(full_props_path, 0o644)
-
def set_permissions(perm_list=None, mode="777"):
def chmod(path, mode):
if os.path.exists(path):
@@ -93,8 +62,7 @@
if cfg["waydroid"]["vendor_type"] == "MAINLINE":
if helpers.drivers.probeBinderDriver(args) != 0:
logging.error("Failed to load Binder driver")
- if helpers.drivers.probeAshmemDriver(args) != 0:
- logging.error("Failed to load Ashmem driver")
+ helpers.drivers.probeAshmemDriver(args)
helpers.drivers.loadBinderNodes(args)
set_permissions([
"/dev/" + args.BINDER_DRIVER,
@@ -114,9 +82,6 @@
# Load session configs
session_cfg = tools.config.load_session()
-
- # Generate props
- make_prop(args.work + "/waydroid.prop")
# Networking
command = [tools.config.tools_src +
@@ -131,6 +96,8 @@
# Mount rootfs
helpers.images.mount_rootfs(args, cfg["waydroid"]["images_path"])
+ helpers.protocol.set_aidl_version(args)
+
# Mount data
helpers.mount.bind(args, session_cfg["session"]["waydroid_data"],
tools.config.defaults["data"])
@@ -139,8 +106,9 @@
if which("start"):
command = ["start", "cgroup-lite"]
tools.helpers.run.user(args, command, check=False)
- command = ["umount", "-l", "/sys/fs/cgroup/schedtune"]
- tools.helpers.run.user(args, command, check=False)
+ if os.path.ismount("/sys/fs/cgroup/schedtune"):
+ command = ["umount", "-l", "/sys/fs/cgroup/schedtune"]
+ tools.helpers.run.user(args, command, check=False)
#TODO: remove NFC hacks
if which("stop"):
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/actions/initializer.py
^
|
@@ -5,6 +5,14 @@
from tools import helpers
import tools.config
+import sys
+import threading
+import multiprocessing
+import select
+import queue
+
+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")
@@ -21,13 +29,16 @@
args.arch = helpers.arch.host()
cfg["waydroid"]["arch"] = args.arch
- preinstalled_images = tools.config.defaults["preinstalled_images_path"]
+ preinstalled_images_paths = tools.config.defaults["preinstalled_images_paths"]
if not args.images_path:
- if os.path.isdir(preinstalled_images):
- if os.path.isfile(preinstalled_images + "/system.img") and os.path.isfile(preinstalled_images + "/vendor.img"):
- args.images_path = preinstalled_images
- else:
- logging.error("Missing system or vendor on preinstalled images dir, fallback to default")
+ for preinstalled_images in preinstalled_images_paths:
+ if os.path.isdir(preinstalled_images):
+ if os.path.isfile(preinstalled_images + "/system.img") and os.path.isfile(preinstalled_images + "/vendor.img"):
+ args.images_path = preinstalled_images
+ break
+ else:
+ logging.warning("Found directory {} but missing system or vendor image, ignoring...".format(preinstalled_images))
+
if not args.images_path:
args.images_path = tools.config.defaults["images_path"]
cfg["waydroid"]["images_path"] = args.images_path
@@ -46,7 +57,7 @@
"/waydroid_" + args.arch + "/" + args.system_type + ".json"
system_request = helpers.http.retrieve(args.system_ota)
if system_request[0] != 200:
- if args.images_path != preinstalled_images:
+ if args.images_path not in preinstalled_images_paths:
raise ValueError(
"Failed to get system OTA channel: {}, error: {}".format(args.system_ota, system_request[0]))
else:
@@ -56,7 +67,7 @@
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
@@ -64,13 +75,18 @@
break
if not args.vendor_type:
- if args.images_path != preinstalled_images:
+ if args.images_path not in preinstalled_images_paths:
raise ValueError(
"Failed to get vendor OTA channel: {}".format(vendor_ota))
else:
args.vendor_ota = "None"
args.vendor_type = get_vendor_type(args)
+ if args.system_ota != cfg["waydroid"].get("system_ota"):
+ cfg["waydroid"]["system_datetime"] = tools.config.defaults["system_datetime"]
+ if args.vendor_ota != cfg["waydroid"].get("vendor_ota"):
+ cfg["waydroid"]["vendor_datetime"] = tools.config.defaults["vendor_datetime"]
+
cfg["waydroid"]["vendor_type"] = args.vendor_type
cfg["waydroid"]["system_ota"] = args.system_ota
cfg["waydroid"]["vendor_ota"] = args.vendor_ota
@@ -81,7 +97,7 @@
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"):
@@ -90,7 +106,7 @@
logging.info("Stopping container")
helpers.lxc.stop(args)
helpers.images.umount_rootfs(args)
- if args.images_path != tools.config.defaults["preinstalled_images_path"]:
+ if args.images_path not in tools.config.defaults["preinstalled_images_paths"]:
helpers.images.get(args)
if not os.path.isdir(tools.config.defaults["rootfs"]):
os.mkdir(tools.config.defaults["rootfs"])
@@ -101,5 +117,235 @@
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")
+
+def wait_for_init(args):
+ helpers.ipc.create_channel("init")
+ helpers.ipc.create_channel("remote_init_output")
+ while True:
+ print('WayDroid waiting for initialization...')
+ msg = helpers.ipc.read_one(channel="init")
+ if msg == "done":
+ if is_initialized(args):
+ break
+ else:
+ continue
+ if msg.startswith("cmd"):
+ remote_init_server(args, msg)
+ continue
+
+def background_remote_init_process(args):
+ with helpers.ipc.open_channel("remote_init_output", "wb") as channel_out:
+ class StdoutRedirect(logging.StreamHandler):
+ def write(self, s):
+ channel_out.write(str.encode(s))
+ def flush(self):
+ pass
+ def emit(self, record):
+ if record.levelno >= logging.INFO:
+ self.write(self.format(record) + self.terminator)
+
+ out = StdoutRedirect()
+ sys.stdout = sys.stderr = out
+ logging.getLogger().addHandler(out)
+
+ ctl_queue = queue.Queue()
+ def try_init(args):
+ try:
+ init(args)
+ except Exception as e:
+ print(str(e))
+ finally:
+ ctl_queue.put(0)
+
+ def poll_pipe():
+ poller = select.poll()
+ poller.register(channel_out, select.POLLERR)
+ poller.poll()
+ # When reaching here the client was terminated
+ ctl_queue.put(0)
+
+ init_thread = threading.Thread(target=try_init, args=(args,))
+ init_thread.daemon = True
+ init_thread.start()
+
+ poll_thread = threading.Thread(target=poll_pipe)
+ poll_thread.daemon = True
+ poll_thread.start()
+
+ # Join any one of the two threads
+ # Then exit the subprocess to kill the remaining thread.
+ # Can you believe this is the only way to kill a thread in python???
+ ctl_queue.get()
+
+ sys.stdout = sys.__stdout__
+ sys.stderr = sys.__stderr__
+ logging.getLogger().removeHandler(out)
+
+def remote_init_server(args, cmd):
+ params = cmd.split('\f')[1:]
+ args.force = True
+ args.images_path = ""
+ args.rom_type = ""
+ args.system_channel = params[0]
+ args.vendor_channel = params[1]
+ args.system_type = params[2]
+
+ p = multiprocessing.Process(target=background_remote_init_process, args=(args,))
+ p.daemon = True
+ p.start()
+ p.join()
+
+def remote_init_client(args):
+ # Local imports cause Gtk is intrusive
+ import gi
+ gi.require_version("Gtk", "3.0")
+ from gi.repository import Gtk, GLib
+
+ if is_initialized(args):
+ helpers.ipc.notify(channel="init", msg="done")
+ return
+
+ def notify_and_quit(caller):
+ if is_initialized(args):
+ helpers.ipc.notify(channel="init", msg="done")
+ GLib.idle_add(Gtk.main_quit)
+
+ class WaydroidInitWindow(Gtk.Window):
+ def __init__(self):
+ super().__init__(title="Initialize Waydroid")
+ self.set_default_size(600, 250)
+ self.set_icon_from_file(tools.config.tools_src + "/data/AppIcon.png")
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/actions/upgrader.py
^
|
@@ -25,15 +25,15 @@
helpers.images.umount_rootfs(args)
helpers.drivers.loadBinderNodes(args)
if not args.offline:
- preinstalled_images_path = tools.config.defaults["preinstalled_images_path"]
- if args.images_path != preinstalled_images_path:
+ if args.images_path not in tools.config.defaults["preinstalled_images_paths"]:
helpers.images.get(args)
else:
- logging.info("Upgrade refused because a pre-installed image is detected at {}.".format(preinstalled_images_path))
+ logging.info("Upgrade refused because a pre-installed image is detected at {}.".format(args.images_path))
helpers.lxc.setup_host_perms(args)
helpers.lxc.set_lxc_config(args)
helpers.lxc.make_base_props(args)
if status != "STOPPED":
logging.info("Starting container")
helpers.images.mount_rootfs(args, args.images_path)
+ helpers.protocol.set_aidl_version(args)
helpers.lxc.start(args)
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/config/__init__.py
^
|
@@ -12,7 +12,7 @@
#
# Exported variables (internal configuration)
#
-version = "1.2.0"
+version = "1.3.3"
tools_src = os.path.normpath(os.path.realpath(__file__) + "/../../..")
# Keys saved in the config file (mostly what we ask in 'waydroid init')
@@ -43,7 +43,10 @@
"vendor_type": "MAINLINE",
"system_datetime": "0",
"vendor_datetime": "0",
- "preinstalled_images_path": "/usr/share/waydroid-extra/images"
+ "preinstalled_images_paths": [
+ "/etc/waydroid-extra/images",
+ "/usr/share/waydroid-extra/images",
+ ]
}
defaults["images_path"] = defaults["work"] + "/images"
defaults["rootfs"] = defaults["work"] + "/rootfs"
@@ -71,8 +74,8 @@
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"
}
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/config/load.py
^
|
@@ -26,6 +26,10 @@
" default value from config: {}".format(cfg['waydroid'][key]))
del cfg["waydroid"][key]
+ if "properties" not in cfg:
+ cfg["properties"] = {}
+ # no default values for property override
+
return cfg
def load_session():
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/helpers/__init__.py
^
|
@@ -8,3 +8,6 @@
import tools.helpers.drivers
import tools.helpers.mount
import tools.helpers.http
+import tools.helpers.ipc
+import tools.helpers.gpu
+import tools.helpers.protocol
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/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 @@
"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
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/helpers/arguments.py
^
|
@@ -58,7 +58,7 @@
ret = subparser.add_parser("session", help="session controller")
sub = ret.add_subparsers(title="subaction", dest="subaction")
sub.add_parser("start", help="start session")
- sub.add_parser("stop", help="start session")
+ sub.add_parser("stop", help="stop session")
return ret
def arguments_container(subparser):
@@ -82,6 +82,9 @@
remove.add_argument('PACKAGE', help="package name of app to remove")
launch = sub.add_parser("launch", help="start single application")
launch.add_argument('PACKAGE', help="package name of app to launch")
+ intent = sub.add_parser("intent", help="start single application")
+ intent.add_argument('ACTION', help="action name")
+ intent.add_argument('URI', help="data uri")
sub.add_parser("list", help="list installed applications")
return ret
@@ -101,6 +104,10 @@
ret = subparser.add_parser("show-full-ui", help="show android full screen in window")
return ret
+def arguments_firstLaunch(subparser):
+ ret = subparser.add_parser("first-launch", help="initialize waydroid and start it")
+ return ret
+
def arguments_shell(subparser):
ret = subparser.add_parser("shell", help="run remote shell command")
ret.add_argument('COMMAND', nargs='?', help="command to run")
@@ -129,6 +136,8 @@
" 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")
@@ -142,6 +151,7 @@
arguments_app(sub)
arguments_prop(sub)
arguments_fullUI(sub)
+ arguments_firstLaunch(sub)
arguments_shell(sub)
arguments_logcat(sub)
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/helpers/drivers.py
^
|
@@ -112,11 +112,8 @@
def probeAshmemDriver(args):
if not os.path.exists("/dev/ashmem"):
- command = ["modprobe", "ashmem_linux"]
- output = tools.helpers.run.user(args, command, check=False, output_return=True)
- if output:
- logging.error("Failed to load ashmem driver")
- logging.error(output.strip())
+ command = ["modprobe", "-q", "ashmem_linux"]
+ tools.helpers.run.user(args, command, check=False)
if not os.path.exists("/dev/ashmem"):
return -1
@@ -176,3 +173,6 @@
args.BINDER_DRIVER = cfg["waydroid"]["binder"]
args.VNDBINDER_DRIVER = cfg["waydroid"]["vndbinder"]
args.HWBINDER_DRIVER = cfg["waydroid"]["hwbinder"]
+ # These might not be in cfg on package upgrade
+ args.BINDER_PROTOCOL = cfg["waydroid"].get("binder_protocol")
+ args.SERVICE_MANAGER_PROTOCOL = cfg["waydroid"].get("service_manager_protocol")
|
[-]
[+]
|
Added |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/helpers/gpu.py
^
|
@@ -0,0 +1,29 @@
+import glob
+import os
+import tools.helpers.props
+
+unsupported = ["nvidia", "nouveau"]
+
+def getKernelDriver(args, dev):
+ return tools.helpers.props.file_get(args, "/sys/class/drm/{}/device/uevent".format(dev), "DRIVER")
+
+def getDriNode(args):
+ for node in glob.glob("/dev/dri/renderD*"):
+ dev = os.path.basename(node)
+ if getKernelDriver(args, dev) not in unsupported:
+ return node
+ return ""
+
+def getVulkanDriver(args, dev):
+ mapping = {
+ "i915": "intel",
+ "amdgpu": "radeon",
+ "radeon": "radeon",
+ "panfrost": "panfrost",
+ "msm": "freedreno",
+ "vc4": "broadcom",
+ }
+ kernel_driver = getKernelDriver(args, dev)
+ if kernel_driver in mapping:
+ return mapping[kernel_driver]
+ return ""
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/helpers/http.py
^
|
@@ -27,12 +27,68 @@
with a 404 Not Found error. Only display a warning on
stdout (no matter if loglevel is changed).
:returns: path to the downloaded file in the cache or None on 404 """
+
+ # helper functions for progress
+ def fromBytesToMB(numBytes, decimalPlaces=2):
+ return round(int(numBytes)/1000000, decimalPlaces)
+
+ def getDownloadSpeed(lastSize, currentSize, timeTaken, decimalPlaces=2):
+ # sizes are in mb and timeTaken in seconds
+ speedUnit = "mbps"
+ sizeDifference = currentSize-lastSize
+
+ if sizeDifference < 1:
+ # sizeDifference is less than 1 mb
+ # convert sizeDifference to kb and speedUnit to kbps,
+ # for better readability
+ sizeDifference*=1000
+ speedUnit = "kbps"
+
+ # sizeDifference mb(or kb) was downloaded in timeTaken seconds
+ # so downloadSpeed = sizeDifference/timeTaken mbps(or kbps)
+ return (round(sizeDifference/timeTaken, decimalPlaces), speedUnit)
# Show progress while downloading
downloadEnded = False
def progress(totalSize, destinationPath):
+ # convert totalSize to mb before hand,
+ # it's value won't change inside while loop and
+ # will be unnecessarily calculated every .01 seconds
+ totalSize = fromBytesToMB(totalSize)
+
+ # this value will be used to figure out maximum chars
+ # required to denote downloaded size later on
+ totalSizeStrLen = len(str(totalSize))
+
+ # lastSize and lastSizeChangeAt is used to calculate speed
+ lastSize = 0
+ lastSizeChangeAt = time.time()
+
+ downloadSpeed = 0, "mbps"
+
while not downloadEnded:
- print("[Downloading] {}/{}".format(os.path.getsize(destinationPath), totalSize), end='\r')
+ currentSize = fromBytesToMB(os.path.getsize(destinationPath))
+
+ if currentSize != lastSize:
+ sizeChangeAt = time.time()
+ downloadSpeed = getDownloadSpeed(
+ lastSize, currentSize,
+ timeTaken=sizeChangeAt-lastSizeChangeAt
+ )
+
+ lastSize = currentSize
+ lastSizeChangeAt = sizeChangeAt
+
+ # make currentSize and downloadSpeed of a fix max len,
+ # to avoid previously printed chars to appear while \
+ # printing recursively
+ # currentSize is not going to exceed totalSize
+ currentSize = str(currentSize).rjust(totalSizeStrLen)
+ # assuming max downloadSpeed to be 9999.99 mbps
+ downloadSpeed = f"{str(downloadSpeed[0]).rjust(7)} {downloadSpeed[1]}"
+
+ # print progress bar
+ print(f"\r[Downloading] {currentSize} MB/{totalSize} MB {downloadSpeed}(approx.)", end=" ")
time.sleep(.01)
# Create cache folder
@@ -49,11 +105,13 @@
tools.helpers.run.user(args, ["rm", path])
# Download the file
- logging.log(loglevel, "Download " + url)
+ logging.log(loglevel, "Downloading " + url)
try:
with urllib.request.urlopen(url) as response:
with open(path, "wb") as handle:
- threading.Thread(target=progress, args=(response.headers.get('content-length'), path)).start()
+ # adding daemon=True will kill this thread if main thread is killed
+ # else progress_bar will continue to show even if user cancels download by ctrl+c
+ threading.Thread(target=progress, args=(response.headers.get('content-length'), path), daemon=True).start()
shutil.copyfileobj(response, handle)
# Handle 404
except urllib.error.HTTPError as e:
@@ -80,10 +138,13 @@
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, ""
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/helpers/images.py
^
|
@@ -7,7 +7,7 @@
import os
import tools.config
from tools import helpers
-
+from shutil import which
def sha256sum(filename):
h = hashlib.sha256()
@@ -93,6 +93,39 @@
cfg["waydroid"]["vendor_datetime"] = str(vendor_time)
tools.config.save(args, cfg)
+def make_prop(args, full_props_path):
+ if not os.path.isfile(args.work + "/waydroid_base.prop"):
+ raise RuntimeError("waydroid_base.prop Not found")
+ with open(args.work + "/waydroid_base.prop") as f:
+ props = f.read().splitlines()
+ if not props:
+ raise RuntimeError("waydroid_base.prop is broken!!?")
+
+ session_cfg = tools.config.load_session()
+
+ def add_prop(key, cfg_key):
+ value = session_cfg["session"][cfg_key]
+ if value != "None":
+ value = value.replace("/mnt/", "/mnt_extra/")
+ props.append(key + "=" + value)
+
+ add_prop("waydroid.host.user", "user_name")
+ add_prop("waydroid.host.uid", "user_id")
+ add_prop("waydroid.host.gid", "group_id")
+ add_prop("waydroid.xdg_runtime_dir", "xdg_runtime_dir")
+ add_prop("waydroid.pulse_runtime_path", "pulse_runtime_path")
+ add_prop("waydroid.wayland_display", "wayland_display")
+ if which("waydroid-sensord") is None:
+ props.append("waydroid.stub_sensors_hal=1")
+ dpi = session_cfg["session"]["lcd_density"]
+ if dpi != "0":
+ props.append("ro.sf.lcd_density=" + dpi)
+
+ final_props = open(full_props_path, "w")
+ for prop in props:
+ final_props.write(prop + "\n")
+ final_props.close()
+ os.chmod(full_props_path, 0o644)
def mount_rootfs(args, images_dir):
helpers.mount.mount(args, images_dir + "/system.img",
@@ -110,6 +143,8 @@
if os.path.isdir("/vendor/odm"):
helpers.mount.bind(
args, "/vendor/odm", tools.config.defaults["rootfs"] + "/odm_extra")
+
+ make_prop(args, args.work + "/waydroid.prop")
helpers.mount.bind_file(args, args.work + "/waydroid.prop",
tools.config.defaults["rootfs"] + "/vendor/waydroid.prop")
|
[-]
[+]
|
Added |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/helpers/ipc.py
^
|
@@ -0,0 +1,37 @@
+# Copyright 2022 Alessandro Astone
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+# Currently implemented as FIFO
+import os
+
+BASE_DIR = "/var/run/"
+
+def pipe_for(channel):
+ return BASE_DIR + "waydroid-" + channel
+
+def read_one(channel):
+ with open_channel(channel, "r", 1) as fifo:
+ while True:
+ data = fifo.read()
+ if len(data) != 0:
+ return data
+
+def create_channel(channel):
+ pipe = pipe_for(channel)
+ if not os.path.exists(pipe):
+ os.mkfifo(pipe)
+
+def open_channel(channel, mode, buffering=0):
+ return open(pipe_for(channel), mode, buffering)
+
+def notify(channel, msg):
+ try:
+ fd = os.open(pipe_for(channel), os.O_WRONLY | os.O_NONBLOCK)
+ with os.fdopen(fd, "w") as fifo:
+ fifo.write(msg)
+ except Exception:
+ pass
+
+def notify_blocking(channel, msg):
+ with open_channel(channel, "w", 1) as channel:
+ channel.write(msg)
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/helpers/lxc.py
^
|
@@ -7,6 +7,7 @@
import glob
import shutil
import platform
+import gbinder
import tools.config
import tools.helpers.run
@@ -51,7 +52,7 @@
make_entry("/dev/pvr_sync")
make_entry("/dev/pmsg0")
make_entry("/dev/dxg")
- make_entry("/dev/dri", options="bind,create=dir,optional 0 0")
+ make_entry(tools.helpers.gpu.getDriNode(args), "dev/dri/renderD128")
for n in glob.glob("/dev/fb*"):
make_entry(n)
@@ -74,6 +75,9 @@
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")
@@ -118,25 +122,38 @@
for n in glob.glob("/tmp/run-*"):
make_entry(n, options="rbind,create=dir,optional 0 0")
+ # NFC config
+ make_entry("/system/etc/libnfc-nci.conf", options="bind,optional 0 0")
+
return nodes
def set_lxc_config(args):
lxc_path = tools.config.defaults["lxc"] + "/waydroid"
- config_file = "config_2"
lxc_ver = get_lxc_version(args)
if lxc_ver == 0:
raise OSError("LXC is not installed")
- elif lxc_ver <= 2:
- config_file = "config_1"
- config_path = tools.config.tools_src + "/data/configs/" + config_file
+ config_paths = tools.config.tools_src + "/data/configs/config_"
+ seccomp_profile = tools.config.tools_src + "/data/configs/waydroid.seccomp"
+
+ config_snippets = [ config_paths + "base" ]
+ # lxc v1 is a bit special because some options got renamed later
+ if lxc_ver == 1:
+ config_snippets.append(config_paths + "1")
+ else:
+ for ver in range(2, 5):
+ snippet = config_paths + str(ver)
+ if lxc_ver >= ver and os.path.exists(snippet):
+ config_snippets.append(snippet)
command = ["mkdir", "-p", lxc_path]
tools.helpers.run.user(args, command)
- command = ["cp", "-fpr", config_path, lxc_path + "/config"]
+ command = ["sh", "-c", "cat {} > \"{}\"".format(' '.join('"{0}"'.format(w) for w in config_snippets), lxc_path + "/config")]
tools.helpers.run.user(args, command)
command = ["sed", "-i", "s/LXCARCH/{}/".format(platform.machine()), lxc_path + "/config"]
tools.helpers.run.user(args, command)
+ command = ["cp", "-fpr", seccomp_profile, lxc_path + "/waydroid.seccomp"]
+ tools.helpers.run.user(args, command)
nodes = generate_nodes_lxc_config(args)
config_nodes_tmp_path = args.work + "/config_nodes"
@@ -165,12 +182,30 @@
return prop
return ""
+ def find_hidl(intf):
+ if args.vendor_type == "MAINLINE":
+ return False
+
+ try:
+ sm = gbinder.ServiceManager("/dev/hwbinder")
+ return intf in sm.list_sync()
+ except:
+ return False
+
props = []
+
+ if not os.path.exists("/dev/ashmem"):
+ props.append("sys.use_memfd=true")
+
egl = tools.helpers.props.host_get(args, "ro.hardware.egl")
+ dri = tools.helpers.gpu.getDriNode(args)
gralloc = find_hal("gralloc")
- if gralloc == "":
- if os.path.exists("/dev/dri"):
+ if not gralloc:
+ if find_hidl("android.hardware.graphics.allocator@4.0::IAllocator/default"):
+ gralloc = "android"
+ if not gralloc:
+ if dri:
gralloc = "gbm"
egl = "mesa"
else:
@@ -199,7 +234,9 @@
props.append("ro.vendor.extension_library=" + ext_library)
vulkan = find_hal("vulkan")
- if vulkan != "":
+ if not vulkan and dri:
+ vulkan = tools.helpers.gpu.getVulkanDriver(args, os.path.basename(dri))
+ if vulkan:
props.append("ro.hardware.vulkan=" + vulkan)
treble = tools.helpers.props.host_get(args, "ro.treble.enabled")
@@ -216,8 +253,12 @@
opengles = "196608"
props.append("ro.opengles.version=" + opengles)
- props.append("waydroid.system_ota=" + args.system_ota)
- props.append("waydroid.vendor_ota=" + args.vendor_ota)
+ if args.images_path not in tools.config.defaults["preinstalled_images_paths"]:
+ props.append("waydroid.system_ota=" + args.system_ota)
+ props.append("waydroid.vendor_ota=" + args.vendor_ota)
+ else:
+ props.append("waydroid.updater.disabled=true")
+
props.append("waydroid.tools_version=" + tools.config.version)
if args.vendor_type == "MAINLINE":
@@ -240,6 +281,14 @@
if prop_fp != "":
props.append("ro.build.fingerprint=" + prop_fp)
+ # now append/override with values in [properties] section of waydroid.cfg
+ cfg = tools.config.load(args)
+ for k, v in cfg["properties"].items():
+ for idx, elem in enumerate(props):
+ if (k+"=") in elem:
+ props.pop(idx)
+ props.append(k+"="+v)
+
base_props = open(args.work + "/waydroid_base.prop", "w")
for prop in props:
base_props.write(prop + "\n")
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/helpers/props.py
^
|
@@ -49,3 +49,14 @@
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 ""
|
[-]
[+]
|
Added |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/helpers/protocol.py
^
|
@@ -0,0 +1,31 @@
+from tools import helpers
+import tools.config
+import logging
+
+# Call me with rootfs mounted!
+def set_aidl_version(args):
+ cfg = tools.config.load(args)
+ android_api = 0
+ try:
+ android_api = int(helpers.props.file_get(args,
+ tools.config.defaults["rootfs"] + "/system/build.prop",
+ "ro.build.version.sdk"))
+ except:
+ logging.error("Failed to parse android version from system.img")
+
+ 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)
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/interfaces/IClipboard.py
^
|
@@ -12,7 +12,10 @@
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(
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/interfaces/IHardware.py
^
|
@@ -15,7 +15,10 @@
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(
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/interfaces/IPlatform.py
^
|
@@ -18,7 +18,8 @@
TRANSACTION_settingsPutString = 9
TRANSACTION_settingsGetString = 10
TRANSACTION_settingsPutInt = 11
-TRANSACTION_getAppName = 12
+TRANSACTION_settingsGetInt = 12
+TRANSACTION_launchIntent = 13
class IPlatform:
def __init__(self, remote):
@@ -182,6 +183,25 @@
if exception != 0:
logging.error("Failed with code: {}".format(exception))
+ def launchIntent(self, arg1, arg2):
+ request = self.client.new_request()
+ request.append_string16(arg1)
+ request.append_string16(arg2)
+ reply, status = self.client.transact_sync_reply(
+ TRANSACTION_launchIntent, request)
+
+ if status:
+ logging.error("Sending reply failed")
+ else:
+ reader = reply.init_reader()
+ status, exception = reader.read_int32()
+ if exception == 0:
+ rep1 = reader.read_string16()
+ return rep1
+ else:
+ logging.error("Failed with code: {}".format(exception))
+ return None
+
def getAppName(self, arg1):
request = self.client.new_request()
request.append_string16(arg1)
@@ -275,7 +295,10 @@
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)
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/interfaces/IStatusBarService.py
^
|
@@ -42,7 +42,10 @@
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)
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/interfaces/IUserMonitor.py
^
|
@@ -12,7 +12,10 @@
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(
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/services/clipboard_manager.py
^
|
@@ -11,6 +11,8 @@
logging.debug(str(e))
canClip = False
+stopping = False
+
def start(args):
def sendClipboardData(value):
try:
@@ -25,15 +27,20 @@
logging.debug(str(e))
def service_thread():
- IClipboard.add_service(args, sendClipboardData, getClipboardData)
+ while not stopping:
+ IClipboard.add_service(args, sendClipboardData, getClipboardData)
if canClip:
+ global stopping
+ stopping = False
args.clipboard_manager = threading.Thread(target=service_thread)
args.clipboard_manager.start()
else:
logging.warning("Failed to start Clipboard manager service, check logs")
def stop(args):
+ global stopping
+ stopping = True
try:
if args.clipboardLoop:
args.clipboardLoop.quit()
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/services/hardware_manager.py
^
|
@@ -6,6 +6,7 @@
from tools import helpers
from tools.interfaces import IHardware
+stopping = False
def start(args):
def enableNFC(enable):
@@ -27,16 +28,22 @@
helpers.images.replace(args, system_zip, system_time,
vendor_zip, vendor_time)
helpers.images.mount_rootfs(args, args.images_path)
+ helpers.protocol.set_aidl_version(args)
helpers.lxc.start(args)
def service_thread():
- IHardware.add_service(
- args, enableNFC, enableBluetooth, suspend, reboot, upgrade)
+ while not stopping:
+ IHardware.add_service(
+ args, enableNFC, enableBluetooth, suspend, reboot, upgrade)
+ global stopping
+ stopping = False
args.hardware_manager = threading.Thread(target=service_thread)
args.hardware_manager.start()
def stop(args):
+ global stopping
+ stopping = True
try:
if args.hardwareLoop:
args.hardwareLoop.quit()
|
[-]
[+]
|
Changed |
_service:tar_git:waydroid-1.3.3+git2.tar.gz/upstream/tools/services/user_manager.py
^
|
@@ -7,6 +7,7 @@
from tools.interfaces import IUserMonitor
from tools.interfaces import IPlatform
+stopping = False
def start(args, unlocked_cb=None):
@@ -89,12 +90,17 @@
os.remove(desktop_file_path)
def service_thread():
- IUserMonitor.add_service(args, userUnlocked, packageStateChanged)
+ while not stopping:
+ IUserMonitor.add_service(args, userUnlocked, packageStateChanged)
+ global stopping
+ stopping = False
args.user_manager = threading.Thread(target=service_thread)
args.user_manager.start()
def stop(args):
+ global stopping
+ stopping = True
try:
if args.userMonitorLoop:
args.userMonitorLoop.quit()
|