The name stands for "Wayland's long-awaited, very slowly developed Android compatibility project". :>
The "Waylovely" project aims to bring Linux application compatibility to the Android platform by porting the Smithay compositor and other desktop Linux services.
From a technical perspective, running desktop Linux applications within a non-rooted Android system is challenging due to the difference with regard to how the windowing systems work in desktop Linux and Android. Android windows are typically main app interfaces that are usually displayed fullscreen, so Linux windows, which often are not the main app interface but the popups or the floating menus instead, would face layout problems. Moreover, while desktop applications can open windows as freely as they wish, Android apps can't.
The reason underlying this inability is that they can only open new windows by calling activities, which are the Android entry points called when you click the app icon on the home screen and the "Open File" app selector. These activities must be hard-coded into the app manifest; therefore, they can't just create infinitely many windows. Furthermore, native code looking to create its own activities would require the subclassing of Android's NativeActivity class, which would require Java code and would probably provide other complexities.
Although native support for Android within Linux desktop windowing toolkits, and subsequently many Linux applications, is unlikely to come anytime soon due to these complexities, there is the potential to build a Wayland compositor solving this problem with the Smithay framework, given that Smithay can display its output to a Winit window. Since the Winit windowing library supports Android, a solution is now found.
This project attempts to implement this solution by:
- building the cross-compile build system for all project components and their dependencies
- porting Smithay and Anvil (Smithay's reference compositor) to Android,
- building the interfaces found in desktop Linux systems (including Portals), and
- packaging them into a usable Android app.
The development of this project is splitted up in different repositories, namely:
- Smithay - backend in Smithay for use in Android applications.
- simple-and-kawaii - A custom build system for boostrapping a large chunk of dependencies. Not a package manager.
- waylovely-build - A repository of dependencies and build recipes for our use case.
- xdg-desktop-portal-android - XDG Desktop Portal implementation for Android. This allows bridging between is also useful for SDL-based applications even SDL actually can render without the need of a Wayland compositor but the app might depend on Portals.
- Flaura - Git's merging feature without Git.
Right now, we would be focusing on getting a Proof of Concept build ready. Due to constraints, the XDG Desktop Portal implementation is not a top priority.
To build or work on this project, you will need to install some packages from the Android's SDK. You can do so either with Android Studio (Download) or with the sdkmanager command-line tool.
This guide will assume that you are going to use sdkmanager. To do so, you would need to download and extract the cmdline-tools package available on Android Studio's page. On the page, click on one of the files that is for your operating system, assumed to be Linux throughout this guide, to download it.
After the download is complete, you should extract all content under the cmdline-tools directory into your Android SDK installation path, which you need to create before hand. If we assume that your Android SDK path is on ~/Android/Sdk, the assumed location for your SDK path throughout this guide, it is better to place the extracted content on ~/Android/Sdk/cmdline-tools/latest. This setup would "auto-configure" the SDK manager's configured SDK installation path, so you would not need to configure it yourself with the --sdk_root flag.
unzip commandlinetools-linux-13114758_latest.zip
mkdir "~/Android/Sdk/cmdline-tools/latest" -p
mv "commandlinetools-linux-13114758_latest/cmdline-tools/*" "~/Android/Sdk/cmdline-tools/latest"
Don't forget adding ~/Android/Sdk/cmdline-tools/latest/bin to your PATH environment variable for ease. That way you can just call sdkmanager on the shell right away.
After all that, install all required packages using sdkmanager. These required packages include the NDK, the build tools, Cmake, and the platform tools. (note: maybe the host's Cmake can replace the SDK's Cmake, should check later )
sdkmanager "build-tools;36.1.0" "ndk;29.0.14206865" platform-tools "cmake;4.1.2 "platforms;android-36.1" --install
Note: The package names are tied to their respective versions, so you can't just run sdkmanager ndk --install. Check out the latest versions of these packages by running sdkmanager --list.
Once we get the SDK installed, you can clone this repository, kawaii, and kawaiiWraps.
First, install Kawaii by going into the repository's cloned folder and running:
pip install .
Make sure you have Python3 and PIP installed.
Then, go inside of the waylovely-comp directory inside this repository's cloned folder and run:
kawaii --verbose
Kawaii will then generate all packages for you, but make sure the source code to each package is installed first in the same directory as the package's .kawaii recipe file. Getting the source code to each package is supposed to be done automatically by Kawaii, but for now you have to manually get the source code, which you can just clone using Git.
The results will be like this:
The next step would be executing cargo-apk to build the APK for our compositor, but telling the steps in this guide is a TODO for now.
Back in 2012-2013, Collabora's Pekka Paalanen was working to have a fork of AOSP that uses Wayland as its display server. However since there aren't any work anymore on that, it was removed a few months later.
(I wonder if I should explore the mythical lands of getting Wayland inside of today's AOSP....)
- First Signs Of Wayland Running On Android - Phoronix
- Wayland's Weston Running On Android - Phoronix
- The Android Back-End For Wayland's Weston - Phoronix
- Android Support Removed From Wayland's Weston - Phoronix
Jason Ekstrand is a developer for libhydris, a library used by "Linux on mobile phones" projects to have a great support for Android OEMs. In this article, he lays out the technical differences between the windowing systems in Android and Wayland, the state of EGL support in each of these platforms, and why it's quite hard to make them talk to each other nicely.
