Skip to content

[FEAT] Wayland support on Android #2530

Description

@sharath-5br2r

Description

Considering display servers like anland exist now on Android, it too needs wayland support. I tested with a local copy of vibe coded diff of source code and it recognised compositor correctly

Motivation

Anland Support and other similar wayland implementations

Additional context

the AI Genrated Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 13a6fa83a..4dd01a349 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -78,7 +78,7 @@ endif()
include(CMakeDependentOption)

cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR FreeBSD OR OpenBSD OR NetBSD OR WIN32 OR ANDROID OR SunOS OR Haiku OR GNU" OFF)
-cmake_dependent_option(ENABLE_WAYLAND "Enable wayland-client" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD" OFF)
+cmake_dependent_option(ENABLE_WAYLAND "Enable wayland-client" ON "ANDROID OR LINUX OR FreeBSD OR OpenBSD OR NetBSD" OFF)
cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR SunOS OR GNU" OFF)
cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR SunOS OR GNU" OFF)
cmake_dependent_option(ENABLE_DRM "Enable libdrm" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS OR GNU" OFF)
@@ -691,6 +691,13 @@ elseif(ANDROID)
        src/detection/physicalmemory/physicalmemory_nosupport.c
        src/detection/diskio/diskio_linux.c
        src/detection/displayserver/displayserver_android.c
+        src/detection/displayserver/linux/wayland/wayland.c
+        src/detection/displayserver/linux/wayland/global-output.c
+        src/detection/displayserver/linux/wayland/kde-output.c
+        src/detection/displayserver/linux/wayland/wl-output-protocol.c
+        src/detection/displayserver/linux/wayland/wp-color-management-v1-protocol.c
+        src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c
+        src/detection/displayserver/linux/wayland/xdg-output-unstable-v1-protocol.c
        src/detection/displayserver/linux/common.c
        src/detection/displayserver/linux/wmde.c
        src/detection/displayserver/linux/xcb.c
diff --git a/src/detection/displayserver/displayserver_android.c b/src/detection/displayserver/displayserver_android.c
index 13f5fab0e..d29c8b728 100644
--- a/src/detection/displayserver/displayserver_android.c
+++ b/src/detection/displayserver/displayserver_android.c
@@ -187,13 +187,24 @@ static bool detectDE(FFDisplayServerResult* ds) {
}

void ffConnectDisplayServerImpl(FFDisplayServerResult* ds) {
-    const char* error = ffdsConnectXcbRandr(ds);
-    if (error) {
-        error = ffdsConnectXrandr(ds);
-    }
-    if (!error) {
-        ffdsDetectWMDE(ds);
-        return;
+    // Keep the same display-server preference as Linux: Wayland provides the
+    // richest output information, followed by XCB and XRandR.
+    if (instance.config.general.dsForceDrm == FF_DS_FORCE_DRM_TYPE_FALSE) {
+        ffdsConnectWayland(ds);
+
+        if (ds->displays.length == 0) {
+            ffdsConnectXcbRandr(ds);
+        }
+
+        if (ds->displays.length == 0) {
+            ffdsConnectXrandr(ds);
+        }
+
+        if (ds->displays.length > 0) {
+            detectDE(ds);
+            ffdsDetectWMDE(ds);
+            return;
+        }
    }

    // https://source.android.com/docs/core/graphics/surfaceflinger-windowmanager

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions