Waydroid: Difference between revisions

Onny (talk | contribs)
Restructuring
Onny (talk | contribs)
V4L2 camera forwarding: Simplify setup instructions
 
(6 intermediate revisions by 2 users not shown)
Line 12: Line 12:
{
{
   virtualisation.waydroid.enable = true;
   virtualisation.waydroid.enable = true;
  # Newer kernel versions may need
  virtualisation.waydroid.package = pkgs.waydroid-nftables;
   # Enable clipboard sharing
   # Enable clipboard sharing
   environment.systemPackages = [ pkgs.wl-clipboard ];
   environment.systemPackages = [ pkgs.wl-clipboard ];
Line 32: Line 35:
== Usage ==
== Usage ==


Start the container
Start the container and userspace Wayland session. You'll know it is finished when you see the message "Android with user 0 is ready".


<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
Start the Waydroid LXC container
$ sudo systemctl start waydroid-container
$ sudo systemctl start waydroid-container
You'll know it worked by checking the journal You should see "Started Waydroid Container".
$ sudo journalctl -u waydroid-container -e
Start Waydroid session
You'll know it is finished when you see the message "Android with user 0 is ready".
$ waydroid session start
$ waydroid session start
</syntaxhighlight>
</syntaxhighlight>
Line 67: Line 63:
$ waydroid prop set persist.waydroid.width 608
$ waydroid prop set persist.waydroid.width 608
</syntaxhighlight>
</syntaxhighlight>


== Maintenance  ==
== Maintenance  ==
Line 125: Line 120:
</syntaxhighlight>
</syntaxhighlight>


=== Notification forwarding ===
=== V4L2 camera forwarding ===
 
To forward notifications from the Waydroid container to the host system, [[KDE Connect]] can be used.
 
On a Gnome-desktop, add following to your system config and enable:<syntaxhighlight lang="nix">
programs.kdeconnect = {
  enable = true;
  package = pkgs.gnomeExtensions.gsconnect;
};
</syntaxhighlight>Open the application ''Extensions'' and enable ''Gsconnect'' plugin there.


Inside the Waydroid container, follow these steps:
Camera forwarding using V4L2 is broken on upstream, but can be achieved by using the Waydroid images of the [https://github.com/WayDroid-ATV Waydroid-ATV project]. You might [[Waydroid#Resetting Android Container|need to reset]] your existing Waydroid environment. Then stop the container and fetch the latest Waydroid-ATV images.<syntaxhighlight lang="bash">
systemctl stop waydroid-container
waydroid init -f \
  -c https://waydroid-atv.github.io/ota/a16-qpr2/system \
  -v https://waydroid-atv.github.io/ota/a16-qpr2/vendor \
  -r lineage \
  -s GAPPS
systemctl start waydroid-container
waydroid session start


* Download and install the [https://f-droid.org/en/packages/org.kde.kdeconnect_tp/ KDE Connect app]
</syntaxhighlight>In case the graphical interface wont show up or the setup wizard fails you can do<syntaxhighlight lang="bash">
* Open the app and and start pairing with the host machine
waydroid shell -- am start -a android.intent.action.MAIN -c android.intent.category.HOME 
* You'll have to enable access to notifications by clicking on the corresponding entry in the permissions list inside the app
waydroid shell -- pm disable-user --user 0 com.google.android.setupwizard
* If you get the system message "''Restricted setting / For your security, this setting is currently unavailable''", you'll have to enable restricted settings. Go to Android settings app, in the apps list select KDE connect and click in the upper right corner on the three dot menu to ''Allow restricted settings''
waydroid shell -- pm disable-user --user 0 com.google.android.gms.setup
* You may have to reboot the Waydroid container for notification forward to work.
</syntaxhighlight>In case the camera access will crash the Waydroid container, there's a recent image which solves this on AMD GPUs. Download it and extract the contents to <code>/etc/waydroid-extra/images</code>. After that recreate the environment as mentioned above but only issue <code>waydroid init -f</code>.


=== Running applications that differ from the current host architecture via libhoudini or libndk<ref>Need help with activating libhoudini for waydroid on NixOS
=== Running applications that differ from the current host architecture via libhoudini or libndk<ref>Need help with activating libhoudini for waydroid on NixOS