Skip to content

Truly independent web browser

Everywhere: Remove the Android port for now

Shannon Booth48d36b1709f6
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index c715e896d50..b59ce39099e 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -17,7 +17,6 @@ body:
- Linux
- macOS
- Windows
- - Android
validations:
required: true
- type: input
diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml
index 5f65f496728..46a2b3efbf1 100644
--- a/.github/actions/setup/action.yml
+++ b/.github/actions/setup/action.yml
@@ -74,13 +74,13 @@ runs:
echo "pythonLocation=$(dirname "${python_bin}")" >> "$GITHUB_ENV"
- name: 'Select latest Xcode'
- if: ${{ inputs.os == 'macOS' || inputs.os == 'Android' }}
+ if: ${{ inputs.os == 'macOS' }}
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '27'
- name: 'Install Dependencies'
- if: ${{ inputs.os == 'macOS' || inputs.os == 'Android' }}
+ if: ${{ inputs.os == 'macOS' }}
shell: bash
run: |
brew update
@@ -119,11 +119,11 @@ runs:
clang-cl --version
- name: 'Install Rust toolchain'
- if: ${{ inputs.os == 'macOS' || inputs.os == 'Android' }}
+ if: ${{ inputs.os == 'macOS' }}
uses: dtolnay/rust-toolchain@stable
- name: 'Warm up the Rust toolchain'
- if: ${{ inputs.os == 'macOS' || inputs.os == 'Android' || inputs.os == 'Windows' }}
+ if: ${{ inputs.os == 'macOS' || inputs.os == 'Windows' }}
shell: bash
run: |
if rustup toolchain install && cargo --version && rustc --version ; then
diff --git a/.github/workflows/nightly-android.yml b/.github/workflows/nightly-android.yml
deleted file mode 100644
index d4a7304f2b7..00000000000
--- a/.github/workflows/nightly-android.yml
+++ /dev/null
@@ -1,111 +0,0 @@
-name: Nightly Android
-
-on:
- # Automatically run at the end of every day.
- schedule:
- - cron: '0 0 * * *'
-
-env:
- # runner.workspace = /home/runner/work/ladybird
- # github.workspace = /home/runner/work/ladybird/ladybird
- LADYBIRD_SOURCE_DIR: ${{ github.workspace }}
- CCACHE_DIR: ${{ github.workspace }}/.ccache
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || format('{0}-{1}', github.ref, github.run_number) }}
- cancel-in-progress: true
-
-jobs:
- CI:
- runs-on: ${{ matrix.os }}
- if: github.repository == 'LadybirdBrowser/ladybird'
- strategy:
- fail-fast: false
- matrix:
- os_name: ['Android']
- os: [macos-14]
-
- steps:
- - uses: actions/[email protected]
-
- - name: Set Up Environment
- id: 'setup'
- uses: ./.github/actions/setup
- with:
- os: ${{ matrix.os_name }}
- arch: 'Lagom'
- build_preset: 'Release'
-
- - name: Set Up Java
- uses: actions/setup-java@v6
- with:
- distribution: 'temurin'
- java-version: 17
-
- - name: Set Up Gradle
- uses: gradle/actions/setup-gradle@v6
-
- # === PREPARE FOR BUILDING ===
-
- - name: Restore Caches
- uses: ./.github/actions/cache-restore
- id: 'cache-restore'
- with:
- os: ${{ matrix.os_name }}
- arch: 'Lagom'
- toolchain: 'Clang'
- cache_key_extra: 'Nightly Android'
- ccache_path: ${{ steps.setup.outputs.ccache_path }}
- sccache_path: ${{ steps.setup.outputs.sccache_path }}
- vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}
-
- - name: Assign Build Parameters
- id: 'build-parameters'
- run: |
- echo "host_cc=$(xcrun --find clang)" >> "$GITHUB_OUTPUT"
- echo "host_cxx=$(xcrun --find clang++)" >> "$GITHUB_OUTPUT"
-
- - name: Install NDK
- run: |
- yes | ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --licenses
- yes | ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "platform-tools" "build-tools;32.0.0" "platforms;android-34"
- yes | ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "ndk;26.1.10909125"
-
- - name: Start Android Emulator
- run: |
- # Install AVD files
- echo "y" | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install 'system-images;android-30;google_apis;x86_64'
-
- # Create emulator
- echo "no" | ${ANDROID_HOME}/cmdline-tools/latest/bin/avdmanager create avd -n xamarin_android_emulator -k 'system-images;android-30;google_apis;x86_64' --force
-
-
- ${ANDROID_HOME}/emulator/emulator -list-avds
-
- echo "Starting emulator"
-
- # Start emulator in background
- nohup ${ANDROID_HOME}/emulator/emulator -avd xamarin_android_emulator -no-snapshot > /dev/null 2>&1 &
- ${ANDROID_HOME}/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
- ${ANDROID_HOME}/platform-tools/adb devices
- echo "Emulator started"
-
- # === BUILD ===
-
- - name: Build and Test
- working-directory: ${{ github.workspace }}/UI/Android
- run: ./gradlew connectedAndroidTest
- env:
- GRADLE_OPTS: '-Xmx3072m'
- LADYBIRD_CACHE_DIR: ${{ github.workspace }}/Build/caches
-
- - name: Save Caches
- uses: ./.github/actions/cache-save
- with:
- arch: 'Lagom'
- ccache_path: ${{ steps.setup.outputs.ccache_path }}
- ccache_primary_key: ${{ steps.cache-restore.outputs.ccache_primary_key }}
- sccache_path: ${{ steps.setup.outputs.sccache_path }}
- sccache_primary_key: ${{ steps.cache-restore.outputs.sccache_primary_key }}
- vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}
- vcpkg_cache_primary_key: ${{ steps.cache-restore.outputs.vcpkg_cache_primary_key }}
diff --git a/.gitignore b/.gitignore
index 71a2a2f7adc..820002db4b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,13 +37,6 @@ output/
.venv*/
venv*/
-# Gradle/AndroidStudio
-.gradle/
-.cxx/
-local.properties
-# We can't build from cmd.exe anyway
-gradlew.bat
-
Libraries/LibWasm/Tests/Fixtures/SpecTests
Libraries/LibWasm/Tests/Spec
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f56f070f1d8..ff886075f00 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,13 +2,6 @@ cmake_minimum_required(VERSION 3.25)
include("Meta/CMake/environment.cmake")
-if (VCPKG_TARGET_ANDROID)
- # If we are building for Android, we must load vcpkg_android.cmake before the project() declaration.
- # This ensures that the CMAKE_TOOLCHAIN_FILE is set correctly.
- # (we cannot set CMAKE_TOOLCHAIN_FILE from Gradle, unfortunately, so this is the only place we can do it.)
- include("UI/Android/vcpkg_android.cmake")
-endif()
-
# vcpkg flags depend on what linker we are using
include("Meta/CMake/use_linker.cmake")
@@ -141,13 +134,10 @@ if (ENABLE_GUI_TARGETS)
add_subdirectory(Services)
add_subdirectory(UI)
- # Android has no Compositor process yet, so it keeps Skia elsewhere.
- if (NOT ANDROID AND NOT VCPKG_TARGET_ANDROID)
- include(check_skia_confinement)
- set(processes_without_skia ${ladybird_helper_processes} ladybird WebDriver)
- list(REMOVE_ITEM processes_without_skia Compositor)
- ladybird_check_skia_confinement(${processes_without_skia})
- endif()
+ include(check_skia_confinement)
+ set(processes_without_skia ${ladybird_helper_processes} ladybird WebDriver)
+ list(REMOVE_ITEM processes_without_skia Compositor)
+ ladybird_check_skia_confinement(${processes_without_skia})
endif()
include(packaging)
diff --git a/Documentation/BuildInstructionsLadybird.md b/Documentation/BuildInstructionsLadybird.md
index 954646a983e..dc2f53faf32 100644
--- a/Documentation/BuildInstructionsLadybird.md
+++ b/Documentation/BuildInstructionsLadybird.md
@@ -181,11 +181,6 @@ In a VS command prompt build using ladybird.py:
py Meta\ladybird.py build
```
-### Android:
-
-On a Unix-like platform, install the prerequisites for that platform and then see the [Android Studio guide](EditorConfiguration/AndroidStudioConfiguration.md).
-Or, download a version of Gradle >= 8.0.0, and run the ``gradlew`` program in ``UI/Android``
-
### FreeBSD
```
@@ -242,9 +237,7 @@ including sanitizer options. It does not update the binary or change its build c
### The User Interfaces
-Ladybird will be built with one of the following browser frontends, depending on the platform:
-* [Android UI](https://developer.android.com/develop/ui) - The native UI on Android.
-* [Qt](https://doc.qt.io/qt-6/) - The UI used on all other platforms.
+Ladybird is built with a [Qt](https://doc.qt.io/qt-6/) browser frontend on all platforms.
### Build error messages you may encounter
diff --git a/Documentation/EditorConfiguration/AndroidStudioConfiguration.md b/Documentation/EditorConfiguration/AndroidStudioConfiguration.md
deleted file mode 100644
index ee1effe470a..00000000000
--- a/Documentation/EditorConfiguration/AndroidStudioConfiguration.md
+++ /dev/null
@@ -1,35 +0,0 @@
-## Android Studio Project Configuration
-
-The Android port of Ladybird has straightforward integration with the Android Studio IDE.
-
-## Prerequisites
-
-Ensure that your system has the following tools available:
-
-- Android Studio Narwhal 2025.1.1 or later
-- CMake 3.23 or higher as the default CMake executable
-- 20G or more storage space for SDKs + Emulator images + Gradle dependencies + build artifacts
-
-## Opening the project
-
-After opening the ``ladybird`` directory in Android Studio (NOT the UI/Android directory!)
-there should be a pop-up in the bottom left indicating that an Android Gradle project was detected
-in ``UI/Android``.
-
-In the top left of the screen in the Project view, navigate to ``UI/Android``. Or, click the
-highlighted text in the notification for that path. Open the ``settings.gradle.kts`` file. At the
-top of the file should be a banner that says ``Code Insight unavailable (related Gradle project not
-linked).`` Click the ``Link Gradle project`` text on the right side of the banner. After the IDE
-loads the Gradle view to the right of the code window, go back to the banner at the top of the
-``settings.gradle.kts`` file and click ``Load Script Configurations`` to finish loading the Gradle
-project.
-
-Gradle will index the project, and download all the required plugins. If it complains about no NDK,
-follow the instructions in Android Studio to install an appropriate NDK version. If it still
-complains about the NDK version, open ``File->Invalidate Caches...`` and click ``Invalidate and
-Restart``.
-
-## Getting the most out of the IDE
-
-See the sections in the [CLionConfiguration](CLionConfiguration.md) for [Excluding Build Artifacts](CLionConfiguration.md#excluding-build-artifacts),
-and [Code Generation Settings](CLionConfiguration.md#code-generation-settings).
diff --git a/Documentation/Porting.md b/Documentation/Porting.md
index 905936684f6..b8809352391 100644
--- a/Documentation/Porting.md
+++ b/Documentation/Porting.md
@@ -13,10 +13,9 @@ There are two types of ports that can be made to Ladybird:
### UI Ports
-There are currently two supported UI ports:
+There is currently one supported UI port:
-* [Android UI](https://developer.android.com/develop/ui) - The native UI on Android.
-* [Qt](https://doc.qt.io/qt-6/) - The UI used on all other platforms.
+* [Qt](https://doc.qt.io/qt-6/) - The UI used on all platforms.
### Platform Ports
@@ -30,10 +29,6 @@ Among others, these include Alpine Linux, FreeBSD, OpenBSD, and Haiku. Support f
meaning there is no regular CI to ensure that each master branch commit maintains their functionality.
Contributions to restore or improve compatibility are welcome!
-There is currently one in progress platform port:
-
-- Android: The Android platform port, using the Android SDK/NDK directly.
-
## Porting Steps
### UI ports
diff --git a/Documentation/README.md b/Documentation/README.md
index c4b5c80d0a0..838b6ec6842 100644
--- a/Documentation/README.md
+++ b/Documentation/README.md
@@ -11,7 +11,6 @@ If you have any questions that are not answered here or in the [FAQ](FAQ.md), yo
* [Profiling the Build](BuildProfilingInstructions.md)
## Configuring Editors
-* [Android Studio](EditorConfiguration/AndroidStudioConfiguration.md)
* [CLion](EditorConfiguration/CLionConfiguration.md)
* [Emacs](EditorConfiguration/EmacsConfiguration.md)
* [Helix](EditorConfiguration/HelixConfiguration.md)
diff --git a/Meta/CMake/check_for_dependencies.cmake b/Meta/CMake/check_for_dependencies.cmake
index 6fdb389b02d..4767a665bc4 100644
--- a/Meta/CMake/check_for_dependencies.cmake
+++ b/Meta/CMake/check_for_dependencies.cmake
@@ -145,7 +145,7 @@ else()
set(HAS_DIRECTX OFF CACHE BOOL "" FORCE)
endif()
-if (ENABLE_GUI_TARGETS AND NOT (ANDROID OR VCPKG_TARGET_ANDROID))
+if (ENABLE_GUI_TARGETS AND NOT ANDROID)
set(LADYBIRD_QT_COMPONENTS Core Gui Widgets)
if (NOT APPLE)
list(APPEND LADYBIRD_QT_COMPONENTS Positioning)
diff --git a/Meta/CMake/use_linker.cmake b/Meta/CMake/use_linker.cmake
index cf48ac34371..3513ea5fdc3 100644
--- a/Meta/CMake/use_linker.cmake
+++ b/Meta/CMake/use_linker.cmake
@@ -4,7 +4,7 @@
# SPDX-License-Identifier: BSD-2-Clause
#
-if (NOT APPLE AND NOT ANDROID AND NOT VCPKG_TARGET_ANDROID AND NOT WIN32 AND NOT LAGOM_USE_LINKER)
+if (NOT APPLE AND NOT ANDROID AND NOT WIN32 AND NOT LAGOM_USE_LINKER)
find_program(LLD_LINKER NAMES "ld.lld")
if (LLD_LINKER)
message(STATUS "Using LLD to link Lagom.")
diff --git a/Services/ImageDecoder/CMakeLists.txt b/Services/ImageDecoder/CMakeLists.txt
index 5fbb3723a0c..f9660bce181 100644
--- a/Services/ImageDecoder/CMakeLists.txt
+++ b/Services/ImageDecoder/CMakeLists.txt
@@ -7,16 +7,7 @@ set(SOURCES
ControlConnection.cpp
)
-if (ANDROID)
- add_library(imagedecoderservice SHARED
- ${LADYBIRD_SOURCE_DIR}/UI/Android/src/main/cpp/ImageDecoderService.cpp
- ${LADYBIRD_SOURCE_DIR}/UI/Android/src/main/cpp/LadybirdServiceBaseJNI.cpp
- ${SOURCES}
- )
- target_link_libraries(imagedecoderservice PRIVATE LibWebView)
-else()
- add_library(imagedecoderservice STATIC ${SOURCES})
-endif()
+add_library(imagedecoderservice STATIC ${SOURCES})
add_executable(ImageDecoder main.cpp)
diff --git a/Services/RequestServer/CMakeLists.txt b/Services/RequestServer/CMakeLists.txt
index c206faca3e5..4b772bb4f74 100644
--- a/Services/RequestServer/CMakeLists.txt
+++ b/Services/RequestServer/CMakeLists.txt
@@ -26,16 +26,7 @@ set(GENERATED_SOURCES
RequestServerEndpoint.h
)
-set(RS_LIB_TYPE STATIC)
-if (ANDROID)
- list(APPEND SOURCES
- ${LADYBIRD_SOURCE_DIR}/UI/Android/src/main/cpp/RequestServerService.cpp
- ${LADYBIRD_SOURCE_DIR}/UI/Android/src/main/cpp/LadybirdServiceBaseJNI.cpp
- )
- set(RS_LIB_TYPE SHARED)
-endif()
-
-add_library(requestserverservice ${RS_LIB_TYPE} ${SOURCES} ${GENERATED_SOURCES})
+add_library(requestserverservice STATIC ${SOURCES} ${GENERATED_SOURCES})
ladybird_generated_sources(requestserverservice)
add_executable(RequestServer main.cpp)
@@ -59,9 +50,5 @@ if (HAIKU)
# Haiku has networking related functions in the network library
target_link_libraries(RequestServer PRIVATE network)
endif()
-if (ANDROID)
- # We need s_ladybird_resource_root from LibWebView
- target_link_libraries(requestserverservice PUBLIC LibWebView)
-endif()
ladybird_sign_helper_process(RequestServer)
diff --git a/Services/WebContent/CMakeLists.txt b/Services/WebContent/CMakeLists.txt
index dab5f556976..d100308e214 100644
--- a/Services/WebContent/CMakeLists.txt
+++ b/Services/WebContent/CMakeLists.txt
@@ -20,19 +20,8 @@ set(SOURCES
Worker/WorkerThread.cpp
)
-if (ANDROID)
- add_library(webcontentservice SHARED
- ${LADYBIRD_SOURCE_DIR}/UI/Android/src/main/cpp/WebContentService.cpp
- ${LADYBIRD_SOURCE_DIR}/UI/Android/src/main/cpp/WebContentServiceJNI.cpp
- ${LADYBIRD_SOURCE_DIR}/UI/Android/src/main/cpp/LadybirdServiceBaseJNI.cpp
- ${LADYBIRD_SOURCE_DIR}/UI/Android/src/main/cpp/JNIHelpers.cpp
- ${SOURCES}
- )
- target_link_libraries(webcontentservice PRIVATE android LibWebView)
-else()
- add_library(webcontentservice STATIC ${SOURCES})
- set_target_properties(webcontentservice PROPERTIES AUTOMOC OFF AUTORCC OFF AUTOUIC OFF)
-endif()
+add_library(webcontentservice STATIC ${SOURCES})
+set_target_properties(webcontentservice PROPERTIES AUTOMOC OFF AUTORCC OFF AUTOUIC OFF)
target_include_directories(webcontentservice PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../..>)
target_include_directories(webcontentservice PUBLIC $<BUILD_INTERFACE:${LADYBIRD_SOURCE_DIR}>)
diff --git a/UI/.gitignore b/UI/.gitignore
index 27c0a8d1724..f06c877be44 100644
--- a/UI/.gitignore
+++ b/UI/.gitignore
@@ -5,4 +5,3 @@ moc_*
Build
build
CMakeLists.txt.user
-Android/src/main/assets/
diff --git a/UI/Android/CMakeLists.txt b/UI/Android/CMakeLists.txt
deleted file mode 100644
index 8287330eabc..00000000000
--- a/UI/Android/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-add_library(ladybird SHARED
- src/main/cpp/LadybirdActivity.cpp
- src/main/cpp/WebViewImplementationNative.cpp
- src/main/cpp/WebViewImplementationNativeJNI.cpp
- src/main/cpp/ALooperEventLoopImplementation.cpp
- src/main/cpp/TimerExecutorService.cpp
- src/main/cpp/JNIHelpers.cpp
-)
-target_link_libraries(ladybird PRIVATE LibFileSystem jnigraphics android)
-
-include(../cmake/AndroidExtras.cmake)
-create_ladybird_bundle(ladybird)
diff --git a/UI/Android/build.gradle.kts b/UI/Android/build.gradle.kts
deleted file mode 100644
index dc012741ea6..00000000000
--- a/UI/Android/build.gradle.kts
+++ /dev/null
@@ -1,76 +0,0 @@
-plugins {
- id("com.android.application") version "8.11.0"
- id("org.jetbrains.kotlin.android") version "2.1.20"
-}
-
-android {
- namespace = "org.serenityos.ladybird"
- compileSdk = 35
- // FIXME: Replace the NDK version to a stable one (this is r29 beta 2)
- ndkVersion = "29.0.13599879"
-
- defaultConfig {
- applicationId = "org.serenityos.ladybird"
- minSdk = 30
- targetSdk = 35
- versionCode = 1
- versionName = "1.0"
-
- testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
- externalNativeBuild {
- cmake {
- cppFlags += "-std=c++23"
- arguments += listOf(
- "-DANDROID_STL=c++_shared",
- "-DLADYBIRD_VCPKG_TYPE=release",
- "-DVCPKG_TARGET_ANDROID=ON"
- )
- }
- }
- ndk {
- // Specifies the ABI configurations of your native
- // libraries Gradle should build and package with your app.
- abiFilters += listOf("x86_64", "arm64-v8a")
- }
- }
-
- buildTypes {
- release {
- isMinifyEnabled = false
- proguardFiles(
- getDefaultProguardFile("proguard-android-optimize.txt"),
- "proguard-rules.pro"
- )
- }
- }
- compileOptions {
- sourceCompatibility = JavaVersion.VERSION_11
- targetCompatibility = JavaVersion.VERSION_11
- }
- kotlinOptions {
- jvmTarget = "11"
- }
- externalNativeBuild {
- cmake {
- path = file("../../CMakeLists.txt")
- version = "3.23.0+"
- }
- }
-
- buildFeatures {
- viewBinding = true
- prefab = true
- }
-}
-
-dependencies {
- implementation("androidx.core:core-ktx:1.13.1")
- implementation("androidx.appcompat:appcompat:1.6.1")
- implementation("com.google.android.material:material:1.12.0")
- implementation("androidx.constraintlayout:constraintlayout:2.1.4")
- implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
- testImplementation("junit:junit:4.13.2")
- androidTestImplementation("androidx.test.ext:junit:1.1.5")
- androidTestImplementation("androidx.test.ext:junit-ktx:1.1.5")
- androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
-}
diff --git a/UI/Android/gradle.properties b/UI/Android/gradle.properties
deleted file mode 100644
index 2cbd6d19d33..00000000000
--- a/UI/Android/gradle.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-# Project-wide Gradle settings.
-# IDE (e.g. Android Studio) users:
-# Gradle settings configured through the IDE *will override*
-# any settings specified in this file.
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
-# AndroidX package structure to make it clearer which packages are bundled with the
-# Android operating system, and which are packaged with your app's APK
-# https://developer.android.com/topic/libraries/support-library/androidx-rn
-android.useAndroidX=true
-# Kotlin code style for this project: "official" or "obsolete":
-kotlin.code.style=official
-# Enables namespacing of each library's R class so that its R class includes only the
-# resources declared in the library itself and none from the library's dependencies,
-# thereby reducing the size of the R class for that library
-android.nonTransitiveRClass=true
diff --git a/UI/Android/gradle/wrapper/gradle-wrapper.jar b/UI/Android/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index e708b1c023e..00000000000
Binary files a/UI/Android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/UI/Android/gradle/wrapper/gradle-wrapper.properties b/UI/Android/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 103ad6520b1..00000000000
--- a/UI/Android/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Fri Sep 01 12:36:55 CEST 2023
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
diff --git a/UI/Android/gradlew b/UI/Android/gradlew
deleted file mode 100755
index 4f906e0c811..00000000000
--- a/UI/Android/gradlew
+++ /dev/null
@@ -1,185 +0,0 @@
-#!/usr/bin/env sh
-
-#
-# Copyright 2015 the original author or authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
- echo "$*"
-}
-
-die () {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin or MSYS, switch paths to Windows format before running java
-if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=`expr $i + 1`
- done
- case $i in
- 0) set -- ;;
- 1) set -- "$args0" ;;
- 2) set -- "$args0" "$args1" ;;
- 3) set -- "$args0" "$args1" "$args2" ;;
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=`save "$@"`
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-exec "$JAVACMD" "$@"
diff --git a/UI/Android/proguard-rules.pro b/UI/Android/proguard-rules.pro
deleted file mode 100644
index f1b424510da..00000000000
--- a/UI/Android/proguard-rules.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
diff --git a/UI/Android/settings.gradle.kts b/UI/Android/settings.gradle.kts
deleted file mode 100644
index 5895af3dc53..00000000000
--- a/UI/Android/settings.gradle.kts
+++ /dev/null
@@ -1,16 +0,0 @@
-pluginManagement {
- repositories {
- google()
- mavenCentral()
- gradlePluginPortal()
- }
-}
-dependencyResolutionManagement {
- repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
- repositories {
- google()
- mavenCentral()
- }
-}
-
-rootProject.name = "Ladybird"
diff --git a/UI/Android/src/androidTest/java/org/serenityos/ladybird/SmokeTest.kt b/UI/Android/src/androidTest/java/org/serenityos/ladybird/SmokeTest.kt
deleted file mode 100644
index e9e7d1c3848..00000000000
--- a/UI/Android/src/androidTest/java/org/serenityos/ladybird/SmokeTest.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.serenityos.ladybird
-
-import androidx.test.ext.junit.rules.activityScenarioRule
-import androidx.test.platform.app.InstrumentationRegistry
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import androidx.test.espresso.Espresso.onView
-import androidx.test.espresso.assertion.ViewAssertions.matches
-import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
-import androidx.test.espresso.matcher.ViewMatchers.withId
-
-import org.junit.Test
-import org.junit.runner.RunWith
-
-import org.junit.Assert.*
-import org.junit.Rule
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * See [testing documentation](http://d.android.com/tools/testing).
- */
-@RunWith(AndroidJUnit4::class)
-class SmokeTest {
-
- @get:Rule
- var activityScenarioRule = activityScenarioRule<LadybirdActivity>()
-
- @Test
- fun useAppContext() {
- // Context of the app under test.
- val appContext = InstrumentationRegistry.getInstrumentation().targetContext
- assertEquals("org.serenityos.ladybird", appContext.packageName)
- }
-
- @Test
- fun loadWebView() {
- // We can actually load a web view, and it is visible
- onView(withId(R.id.web_view)).check(matches(isDisplayed()))
- }
-}
diff --git a/UI/Android/src/main/AndroidManifest.xml b/UI/Android/src/main/AndroidManifest.xml
deleted file mode 100644
index 0bb6360f63f..00000000000
--- a/UI/Android/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:installLocation="auto"
- android:versionCode="001"
- android:versionName="head">
-
- <supports-screens
- android:anyDensity="true"
- android:largeScreens="true"
- android:normalScreens="true"
- android:smallScreens="true" />
-
- <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
- <uses-permission android:name="android.permission.INTERNET"/>
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
-
- <application
- android:allowBackup="true"
- android:allowNativeHeapPointerTagging="false"
- android:dataExtractionRules="@xml/data_extraction_rules"
- android:enableOnBackInvokedCallback="true"
- android:fullBackupContent="@xml/backup_rules"
- android:fullBackupOnly="false"
- android:hardwareAccelerated="true"
- android:icon="@mipmap/ic_launcher"
- android:label="@string/app_name"
- android:requestLegacyExternalStorage="true"
- android:roundIcon="@mipmap/ic_launcher_round"
- android:supportsRtl="true"
- android:theme="@style/Theme.Ladybird"
- tools:targetApi="33">
- <activity
- android:name=".LadybirdActivity"
- android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
- android:exported="true"
- android:launchMode="singleTop"
- android:screenOrientation="unspecified">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
-
- <meta-data
- android:name="android.app.extract_android_style"
- android:value="minimal" />
- </activity>
- <service
- android:name=".WebContentService"
- android:enabled="true"
- android:exported="false"
- android:process=":WebContent" />
- <service
- android:name=".RequestServerService"
- android:enabled="true"
- android:exported="false"
- android:process=":RequestServer" />
- <service
- android:name=".ImageDecoderService"
- android:enabled="true"
- android:exported="false"
- android:process=":ImageDecoder" />
- </application>
-
-</manifest>
diff --git a/UI/Android/src/main/assets/.gitkeep b/UI/Android/src/main/assets/.gitkeep
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/UI/Android/src/main/cpp/ALooperEventLoopImplementation.cpp b/UI/Android/src/main/cpp/ALooperEventLoopImplementation.cpp
deleted file mode 100644
index e2846dbd20e..00000000000
--- a/UI/Android/src/main/cpp/ALooperEventLoopImplementation.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include "ALooperEventLoopImplementation.h"
-#include "JNIHelpers.h"
-#include <AK/Time.h>
-#include <LibCore/EventLoop.h>
-#include <LibCore/Notifier.h>
-#include <LibCore/ThreadEventQueue.h>
-#include <android/log.h>
-#include <android/looper.h>
-#include <fcntl.h>
-#include <jni.h>
-
-namespace Ladybird {
-
-EventLoopThreadData& EventLoopThreadData::the()
-{
- static thread_local EventLoopThreadData s_thread_data { {}, {}, &Core::ThreadEventQueue::current() };
- return s_thread_data;
-}
-
-EventLoopThreadData::~EventLoopThreadData()
-{
- Core::ThreadEventQueue::destroy_current();
-}
-
-static ALooperEventLoopImplementation& current_impl()
-{
- return as<ALooperEventLoopImplementation>(Core::EventLoop::current().impl());
-}
-
-static int looper_callback(int fd, int events, void* data);
-
-ALooperEventLoopManager::ALooperEventLoopManager(jobject timer_service)
- : m_timer_service(timer_service)
-{
- JavaEnvironment env(global_vm);
-
- jclass timer_class = env.get()->FindClass("org/serenityos/ladybird/TimerExecutorService$Timer");
- if (!timer_class)
- TODO();
- m_timer_class = reinterpret_cast<jclass>(env.get()->NewGlobalRef(timer_class));
- env.get()->DeleteLocalRef(timer_class);
-
- m_timer_constructor = env.get()->GetMethodID(m_timer_class, "<init>", "(J)V");
- if (!m_timer_constructor)
- TODO();
-
- jclass timer_service_class = env.get()->GetObjectClass(m_timer_service);
-
- m_register_timer = env.get()->GetMethodID(timer_service_class, "registerTimer", "(Lorg/serenityos/ladybird/TimerExecutorService$Timer;ZJ)J");
- if (!m_register_timer)
- TODO();
-
- m_unregister_timer = env.get()->GetMethodID(timer_service_class, "unregisterTimer", "(J)V");
- if (!m_unregister_timer)
- TODO();
- env.get()->DeleteLocalRef(timer_service_class);
-
- auto ret = pipe2(m_pipe, O_CLOEXEC | O_NONBLOCK);
- VERIFY(ret == 0);
-
- m_main_looper = ALooper_forThread();
- VERIFY(m_main_looper);
- ALooper_acquire(m_main_looper);
-
- ret = ALooper_addFd(m_main_looper, m_pipe[0], ALOOPER_POLL_CALLBACK, ALOOPER_EVENT_INPUT, &looper_callback, this);
- VERIFY(ret == 1);
-}
-
-ALooperEventLoopManager::~ALooperEventLoopManager()
-{
- JavaEnvironment env(global_vm);
-
- env.get()->DeleteGlobalRef(m_timer_service);
- env.get()->DeleteGlobalRef(m_timer_class);
-
- ALooper_removeFd(m_main_looper, m_pipe[0]);
- ALooper_release(m_main_looper);
-
- ::close(m_pipe[0]);
- ::close(m_pipe[1]);
-}
-
-NonnullOwnPtr<Core::EventLoopImplementation> ALooperEventLoopManager::make_implementation()
-{
- return ALooperEventLoopImplementation::create();
-}
-
-intptr_t ALooperEventLoopManager::register_timer(Core::EventReceiver& receiver, AK::Duration interval, bool should_reload)
-{
- JavaEnvironment env(global_vm);
- auto& thread_data = EventLoopThreadData::the();
-
- auto timer = env.get()->NewObject(m_timer_class, m_timer_constructor, reinterpret_cast<long>(&current_impl()));
-
- long millis = interval.to_ceiled_milliseconds();
- long timer_id = env.get()->CallLongMethod(m_timer_service, m_register_timer, timer, !should_reload, millis);
-
- // FIXME: Is there a race condition here? Maybe we should take a lock on the timers...
- thread_data.timers.set(timer_id, { receiver.make_weak_ptr() });
-
- return timer_id;
-}
-
-void ALooperEventLoopManager::unregister_timer(intptr_t timer_id)
-{
- if (auto timer = EventLoopThreadData::the().timers.take(timer_id); timer.has_value()) {
- JavaEnvironment env(global_vm);
- env.get()->CallVoidMethod(m_timer_service, m_unregister_timer, timer_id);
- }
-}
-
-void ALooperEventLoopManager::register_notifier(Core::Notifier& notifier)
-{
- EventLoopThreadData::the().notifiers.set(&notifier);
- current_impl().register_notifier(notifier);
-}
-
-void ALooperEventLoopManager::unregister_notifier(Core::Notifier& notifier)
-{
- EventLoopThreadData::the().notifiers.remove(&notifier);
- current_impl().unregister_notifier(notifier);
-}
-
-void ALooperEventLoopManager::did_post_event()
-{
- int msg = 0xCAFEBABE;
- (void)write(m_pipe[1], &msg, sizeof(msg));
-}
-
-int looper_callback(int fd, int events, void* data)
-{
- auto& manager = *static_cast<ALooperEventLoopManager*>(data);
-
- if (events & ALOOPER_EVENT_INPUT) {
- int msg = 0;
- while (read(fd, &msg, sizeof(msg)) == sizeof(msg)) {
- // Do nothing, we don't actually care what the message was, just that it was posted
- }
- manager.on_did_post_event();
- }
- return 1;
-}
-
-ALooperEventLoopImplementation::ALooperEventLoopImplementation()
- : m_event_loop(ALooper_prepare(0))
- , m_thread_data(&EventLoopThreadData::the())
-{
- ALooper_acquire(m_event_loop);
-}
-
-ALooperEventLoopImplementation::~ALooperEventLoopImplementation()
-{
- ALooper_release(m_event_loop);
-}
-
-EventLoopThreadData& ALooperEventLoopImplementation::thread_data()
-{
- return *m_thread_data;
-}
-
-int ALooperEventLoopImplementation::exec()
-{
- while (!m_exit_requested.load(MemoryOrder::memory_order_acquire))
- pump(PumpMode::WaitForEvents);
- return m_exit_code;
-}
-
-size_t ALooperEventLoopImplementation::pump(Core::EventLoopImplementation::PumpMode mode)
-{
- auto num_events = Core::ThreadEventQueue::current().process();
-
- int timeout_ms = mode == Core::EventLoopImplementation::PumpMode::WaitForEvents ? -1 : 0;
- int ret;
- do {
- ret = ALooper_pollOnce(timeout_ms, nullptr, nullptr, nullptr);
- } while (ret == ALOOPER_POLL_CALLBACK);
-
- // We don't expect any non-callback FDs to be ready
- VERIFY(ret <= 0);
-
- if (ret == ALOOPER_POLL_ERROR)
- m_exit_requested.store(true, MemoryOrder::memory_order_release);
-
- num_events += Core::ThreadEventQueue::current().process();
- return num_events;
-}
-
-void ALooperEventLoopImplementation::quit(int code)
-{
- m_exit_code = code;
- m_exit_requested.store(true, MemoryOrder::memory_order_release);
- wake();
-}
-
-void ALooperEventLoopImplementation::wake()
-{
- ALooper_wake(m_event_loop);
-}
-
-void ALooperEventLoopImplementation::post_event(Core::EventReceiver& receiver, NonnullOwnPtr<Core::Event>&& event)
-{
- m_thread_event_queue.post_event(receiver, move(event));
-
- if (&m_thread_event_queue != &Core::ThreadEventQueue::current())
- wake();
-}
-
-static int notifier_callback(int fd, int events, void* data)
-{
- auto& notifier = *static_cast<Core::Notifier*>(data);
-
- VERIFY(fd == notifier.fd());
-
- Core::NotificationType type = Core::NotificationType::None;
- if (events & ALOOPER_EVENT_INPUT)
- type |= Core::NotificationType::Read;
- if (events & ALOOPER_EVENT_OUTPUT)
- type |= Core::NotificationType::Write;
- if (events & ALOOPER_EVENT_HANGUP)
- type |= Core::NotificationType::HangUp;
- if (events & ALOOPER_EVENT_ERROR)
- type |= Core::NotificationType::Error;
-
- if (type != Core::NotificationType::None) {
- Core::NotifierActivationEvent event;
- notifier.dispatch_event(event);
- }
-
- // Wake up from ALooper_pollAll, and service this event on the event queue
- current_impl().wake();
-
- return 1;
-}
-
-void ALooperEventLoopImplementation::register_notifier(Core::Notifier& notifier)
-{
- auto event_flags = 0;
- switch (notifier.type()) {
- case Core::Notifier::Type::Read:
- event_flags = ALOOPER_EVENT_INPUT;
- break;
- case Core::Notifier::Type::Write:
- event_flags = ALOOPER_EVENT_OUTPUT;
- break;
- case Core::Notifier::Type::Error:
- event_flags = ALOOPER_EVENT_ERROR;
- break;
- case Core::Notifier::Type::HangUp:
- event_flags = ALOOPER_EVENT_HANGUP;
- break;
- case Core::Notifier::Type::None:
- TODO();
- }
-
- auto ret = ALooper_addFd(m_event_loop, notifier.fd(), ALOOPER_POLL_CALLBACK, event_flags, &notifier_callback, &notifier);
- VERIFY(ret == 1);
-}
-
-void ALooperEventLoopImplementation::unregister_notifier(Core::Notifier& notifier)
-{
- ALooper_removeFd(m_event_loop, notifier.fd());
-}
-
-}
diff --git a/UI/Android/src/main/cpp/ALooperEventLoopImplementation.h b/UI/Android/src/main/cpp/ALooperEventLoopImplementation.h
deleted file mode 100644
index fc868c38fde..00000000000
--- a/UI/Android/src/main/cpp/ALooperEventLoopImplementation.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <AK/Atomic.h>
-#include <AK/HashMap.h>
-#include <AK/NonnullOwnPtr.h>
-#include <AK/WeakPtr.h>
-#include <LibCore/EventLoopImplementation.h>
-#include <jni.h>
-
-extern "C" struct ALooper;
-
-namespace Ladybird {
-
-class ALooperEventLoopManager : public Core::EventLoopManager {
-public:
- ALooperEventLoopManager(jobject timer_service);
- virtual ~ALooperEventLoopManager() override;
- virtual NonnullOwnPtr<Core::EventLoopImplementation> make_implementation() override;
-
- virtual intptr_t register_timer(Core::EventReceiver&, AK::Duration interval, bool should_reload) override;
- virtual void unregister_timer(intptr_t timer_id) override;
-
- virtual void register_notifier(Core::Notifier&) override;
- virtual void unregister_notifier(Core::Notifier&) override;
-
- virtual void did_post_event() override;
-
- Function<void()> on_did_post_event;
-
- // FIXME: These APIs only exist for obscure use-cases inside SerenityOS. Try to get rid of them.
- virtual int register_signal(int, Function<void(int)>) override { return 0; }
- virtual void unregister_signal(int) override { }
-
-private:
- int m_pipe[2] = {};
- ALooper* m_main_looper { nullptr };
- jobject m_timer_service { nullptr };
- jmethodID m_register_timer { nullptr };
- jmethodID m_unregister_timer { nullptr };
- jclass m_timer_class { nullptr };
- jmethodID m_timer_constructor { nullptr };
-};
-
-struct TimerData {
- WeakPtr<Core::EventReceiver> receiver;
-};
-
-struct EventLoopThreadData {
- static EventLoopThreadData& the();
-
- ~EventLoopThreadData();
-
- HashMap<long, TimerData> timers;
- HashTable<Core::Notifier*> notifiers;
- Core::ThreadEventQueue* thread_queue = nullptr;
-};
-
-class ALooperEventLoopImplementation : public Core::EventLoopImplementation {
-public:
- static NonnullOwnPtr<ALooperEventLoopImplementation> create() { return adopt_own(*new ALooperEventLoopImplementation); }
-
- virtual ~ALooperEventLoopImplementation() override;
-
- virtual int exec() override;
- virtual size_t pump(PumpMode) override;
- virtual void quit(int) override;
- virtual void wake() override;
-
- virtual bool was_exit_requested() const override { return false; }
-
- EventLoopThreadData& thread_data();
-
-private:
- friend class ALooperEventLoopManager;
-
- ALooperEventLoopImplementation();
-
- void register_notifier(Core::Notifier&);
- void unregister_notifier(Core::Notifier&);
-
- ALooper* m_event_loop { nullptr };
- int m_exit_code { 0 };
- Atomic<bool> m_exit_requested { false };
- EventLoopThreadData* m_thread_data { nullptr };
-};
-
-}
diff --git a/UI/Android/src/main/cpp/ImageDecoderService.cpp b/UI/Android/src/main/cpp/ImageDecoderService.cpp
deleted file mode 100644
index b8cc06f9ac3..00000000000
--- a/UI/Android/src/main/cpp/ImageDecoderService.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Andreas Kling <[email protected]>
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- * Copyright (c) 2023, Lucas Chollet <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include "LadybirdServiceBase.h"
-#include <ImageDecoder/ConnectionFromClient.h>
-#include <LibCore/EventLoop.h>
-#include <LibIPC/SingleServer.h>
-
-ErrorOr<int> service_main(int ipc_socket)
-{
- auto& event_loop = Core::EventLoop::initialize_for_current_thread();
-
- auto socket = TRY(Core::LocalSocket::adopt_fd(ipc_socket));
- auto client = TRY(ImageDecoder::ConnectionFromClient::try_create(make<IPC::Transport>(move(socket))));
-
- return event_loop.exec();
-}
diff --git a/UI/Android/src/main/cpp/JNIHelpers.cpp b/UI/Android/src/main/cpp/JNIHelpers.cpp
deleted file mode 100644
index dc90215a411..00000000000
--- a/UI/Android/src/main/cpp/JNIHelpers.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include "JNIHelpers.h"
-#include <AK/Utf16View.h>
-
-namespace Ladybird {
-
-jstring JavaEnvironment::jstring_from_ak_string(String const& str)
-{
- auto as_utf16 = MUST(AK::utf8_to_utf16(str.code_points()));
- return m_env->NewString(reinterpret_cast<jchar const*>(as_utf16.data.data()), as_utf16.data.size());
-}
-
-}
diff --git a/UI/Android/src/main/cpp/JNIHelpers.h b/UI/Android/src/main/cpp/JNIHelpers.h
deleted file mode 100644
index 6145ab20090..00000000000
--- a/UI/Android/src/main/cpp/JNIHelpers.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <AK/Assertions.h>
-#include <AK/String.h>
-#include <jni.h>
-
-namespace Ladybird {
-
-class JavaEnvironment {
-public:
- JavaEnvironment(JavaVM* vm)
- : m_vm(vm)
- {
- auto ret = m_vm->GetEnv(reinterpret_cast<void**>(&m_env), JNI_VERSION_1_6);
- if (ret == JNI_EDETACHED) {
- ret = m_vm->AttachCurrentThread(&m_env, nullptr);
- VERIFY(ret == JNI_OK);
- m_did_attach_thread = true;
- } else if (ret == JNI_EVERSION) {
- VERIFY_NOT_REACHED();
- } else {
- VERIFY(ret == JNI_OK);
- }
-
- VERIFY(m_env != nullptr);
- }
-
- ~JavaEnvironment()
- {
- if (m_did_attach_thread)
- m_vm->DetachCurrentThread();
- }
-
- JNIEnv* get() const { return m_env; }
-
- jstring jstring_from_ak_string(String const& str);
-
-private:
- JavaVM* m_vm = nullptr;
- JNIEnv* m_env = nullptr;
- bool m_did_attach_thread = false;
-};
-
-}
-extern JavaVM* global_vm;
diff --git a/UI/Android/src/main/cpp/LadybirdActivity.cpp b/UI/Android/src/main/cpp/LadybirdActivity.cpp
deleted file mode 100644
index 77d5f218203..00000000000
--- a/UI/Android/src/main/cpp/LadybirdActivity.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include "ALooperEventLoopImplementation.h"
-#include "JNIHelpers.h"
-#include <AK/ByteString.h>
-#include <AK/Format.h>
-#include <AK/HashMap.h>
-#include <AK/LexicalPath.h>
-#include <AK/OwnPtr.h>
-#include <LibCore/DirIterator.h>
-#include <LibCore/Directory.h>
-#include <LibCore/EventLoop.h>
-#include <LibCore/System.h>
-#include <LibCore/Timer.h>
-#include <LibFileSystem/FileSystem.h>
-#include <LibWebView/Application.h>
-#include <LibWebView/Utilities.h>
-#include <jni.h>
-
-JavaVM* global_vm;
-static OwnPtr<WebView::Application> s_application;
-static OwnPtr<Core::EventLoop> s_main_event_loop;
-static jobject s_java_instance;
-static jmethodID s_schedule_event_loop_method;
-
-class Application : public WebView::Application {
- WEB_VIEW_APPLICATION(Application);
-
-public:
- explicit Application();
-
-private:
- virtual bool should_coordinate_browser_process() const override { return false; }
-};
-
-Application::Application() = default;
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_LadybirdActivity_initNativeCode(JNIEnv*, jobject, jstring, jstring, jobject, jstring);
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_LadybirdActivity_initNativeCode(JNIEnv* env, jobject thiz, jstring resource_dir, jstring tag_name, jobject timer_service, jstring user_dir)
-{
- char const* raw_resource_dir = env->GetStringUTFChars(resource_dir, nullptr);
- WebView::s_ladybird_resource_root = raw_resource_dir;
- env->ReleaseStringUTFChars(resource_dir, raw_resource_dir);
-
- // While setting XDG environment variables in order to store user data may seem silly
- // but in our case it seems to be the most rational idea.
- char const* raw_user_dir = env->GetStringUTFChars(user_dir, nullptr);
- setenv("XDG_CONFIG_HOME", ByteString::formatted("{}/config", raw_user_dir).characters(), 1);
- setenv("XDG_DATA_HOME", ByteString::formatted("{}/userdata", raw_user_dir).characters(), 1);
- env->ReleaseStringUTFChars(user_dir, raw_user_dir);
-
- char const* raw_tag_name = env->GetStringUTFChars(tag_name, nullptr);
- AK::set_log_tag_name(raw_tag_name);
- env->ReleaseStringUTFChars(tag_name, raw_tag_name);
-
- dbgln("Set resource dir to {}", WebView::s_ladybird_resource_root);
-
- auto file_or_error = Core::System::open(MUST(String::formatted("{}/res/icons/48x48/app-browser.png", WebView::s_ladybird_resource_root)), O_RDONLY);
- if (file_or_error.is_error()) {
- dbgln("No resource files, perhaps extracting went wrong?");
- } else {
- dbgln("Found app-browser.png");
- dbgln("Hopefully no developer changed the asset files and expected them to be re-extracted!");
- }
-
- env->GetJavaVM(&global_vm);
- VERIFY(global_vm);
-
- s_java_instance = env->NewGlobalRef(thiz);
- jclass clazz = env->GetObjectClass(s_java_instance);
- VERIFY(clazz);
- s_schedule_event_loop_method = env->GetMethodID(clazz, "scheduleEventLoop", "()V");
- VERIFY(s_schedule_event_loop_method);
- env->DeleteLocalRef(clazz);
-
- jobject timer_service_ref = env->NewGlobalRef(timer_service);
-
- auto* event_loop_manager = new Ladybird::ALooperEventLoopManager(timer_service_ref);
- event_loop_manager->on_did_post_event = [] {
- Ladybird::JavaEnvironment env(global_vm);
- env.get()->CallVoidMethod(s_java_instance, s_schedule_event_loop_method);
- };
- Core::EventLoopManager::install(*event_loop_manager);
- s_main_event_loop = make<Core::EventLoop>();
-
- // The strings cannot be empty
- Main::Arguments arguments = {
- .argc = 0,
- .argv = nullptr,
- .strings = Span<StringView> { new StringView("ladybird"sv), 1 }
- };
-
- // FIXME: We are not making use of this Application object to track our processes.
- // So, right now, the Application's ProcessManager is constantly empty.
- // (However, LibWebView depends on an Application object existing, so we do have to actually create one.)
- s_application = Application::create(arguments).release_value_but_fixme_should_propagate_errors();
-}
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_LadybirdActivity_execMainEventLoop(JNIEnv*, jobject /* thiz */);
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_LadybirdActivity_execMainEventLoop(JNIEnv*, jobject /* thiz */)
-{
- if (s_main_event_loop) {
- s_main_event_loop->pump(Core::EventLoop::WaitMode::PollForEvents);
- }
-}
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_LadybirdActivity_disposeNativeCode(JNIEnv*, jobject /* thiz */);
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_LadybirdActivity_disposeNativeCode(JNIEnv* env, jobject /* thiz */)
-{
- s_main_event_loop = nullptr;
- s_schedule_event_loop_method = nullptr;
- s_application = nullptr;
- env->DeleteGlobalRef(s_java_instance);
-
- delete &Core::EventLoopManager::the();
-}
diff --git a/UI/Android/src/main/cpp/LadybirdServiceBase.h b/UI/Android/src/main/cpp/LadybirdServiceBase.h
deleted file mode 100644
index c75f2c46dfa..00000000000
--- a/UI/Android/src/main/cpp/LadybirdServiceBase.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <AK/Error.h>
-#include <jni.h>
-
-ErrorOr<int> service_main(int ipc_socket);
diff --git a/UI/Android/src/main/cpp/LadybirdServiceBaseJNI.cpp b/UI/Android/src/main/cpp/LadybirdServiceBaseJNI.cpp
deleted file mode 100644
index 190bb389360..00000000000
--- a/UI/Android/src/main/cpp/LadybirdServiceBaseJNI.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include "LadybirdServiceBase.h"
-#include <AK/Atomic.h>
-#include <AK/Format.h>
-#include <LibCore/ResourceImplementationFile.h>
-#include <LibWebView/Utilities.h>
-#include <jni.h>
-
-JavaVM* global_vm;
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_LadybirdServiceBase_nativeThreadLoop(JNIEnv*, jobject /* thiz */, jint);
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_LadybirdServiceBase_nativeThreadLoop(JNIEnv*, jobject /* thiz */, jint ipc_socket)
-{
- auto ret = service_main(ipc_socket);
- if (ret.is_error()) {
- warnln("Runtime Error: {}", ret.release_error());
- } else {
- outln("Thread exited with code {}", ret.release_value());
- }
-}
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_LadybirdServiceBase_initNativeCode(JNIEnv*, jobject /* thiz */, jstring, jstring);
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_LadybirdServiceBase_initNativeCode(JNIEnv* env, jobject /* thiz */, jstring resource_dir, jstring tag_name)
-{
- static Atomic<bool> s_initialized_flag { false };
- if (s_initialized_flag.exchange(true) == true) {
- // Skip initializing if someone else already started the process at some point in the past
- return;
- }
-
- env->GetJavaVM(&global_vm);
-
- char const* raw_resource_dir = env->GetStringUTFChars(resource_dir, nullptr);
- // FIXME: Don't set s_ladybird_resource_root on every service in order not to link with LibWebView.
- WebView::s_ladybird_resource_root = raw_resource_dir;
- env->ReleaseStringUTFChars(resource_dir, raw_resource_dir);
- // FIXME: Use a custom Android version that uses AssetManager to load files.
- Core::ResourceImplementation::install(make<Core::ResourceImplementationFile>(MUST(String::formatted("{}/res", WebView::s_ladybird_resource_root))));
-
- char const* raw_tag_name = env->GetStringUTFChars(tag_name, nullptr);
- AK::set_log_tag_name(raw_tag_name);
- env->ReleaseStringUTFChars(tag_name, raw_tag_name);
-}
diff --git a/UI/Android/src/main/cpp/RequestServerService.cpp b/UI/Android/src/main/cpp/RequestServerService.cpp
deleted file mode 100644
index ca36b1a8b15..00000000000
--- a/UI/Android/src/main/cpp/RequestServerService.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Andreas Kling <[email protected]>
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include "LadybirdServiceBase.h"
-#include <AK/LexicalPath.h>
-#include <AK/OwnPtr.h>
-#include <LibCore/ArgsParser.h>
-#include <LibCore/EventLoop.h>
-#include <LibCore/LocalServer.h>
-#include <LibCore/System.h>
-#include <LibFileSystem/FileSystem.h>
-#include <LibIPC/SingleServer.h>
-#include <LibTLS/TLSv12.h>
-#include <LibWebView/Utilities.h>
-#include <RequestServer/ConnectionFromClient.h>
-
-namespace RequestServer {
-
-extern ByteString g_default_certificate_path;
-
-}
-
-ErrorOr<int> service_main(int ipc_socket)
-{
-
- RequestServer::g_default_certificate_path = ByteString::formatted("{}/cacert.pem", WebView::s_ladybird_resource_root);
-
- auto& event_loop = Core::EventLoop::initialize_for_current_thread();
-
- auto socket = TRY(Core::LocalSocket::adopt_fd(ipc_socket));
- auto client = TRY(RequestServer::ConnectionFromClient::try_create(make<IPC::Transport>(move(socket))));
-
- return event_loop.exec();
-}
diff --git a/UI/Android/src/main/cpp/TimerExecutorService.cpp b/UI/Android/src/main/cpp/TimerExecutorService.cpp
deleted file mode 100644
index 5559a3f0531..00000000000
--- a/UI/Android/src/main/cpp/TimerExecutorService.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include "ALooperEventLoopImplementation.h"
-#include <LibCore/EventLoop.h>
-#include <LibCore/ThreadEventQueue.h>
-#include <jni.h>
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_TimerExecutorService_00024Timer_nativeRun(JNIEnv*, jobject /* thiz */, jlong, jlong);
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_TimerExecutorService_00024Timer_nativeRun(JNIEnv*, jobject /* thiz */, jlong native_data, jlong id)
-{
- static Core::EventLoop s_event_loop; // Here to exist for this thread
-
- auto& event_loop_impl = *reinterpret_cast<Ladybird::ALooperEventLoopImplementation*>(native_data);
- auto& thread_data = event_loop_impl.thread_data();
-
- if (auto timer_data = thread_data.timers.get(id); timer_data.has_value()) {
- auto receiver = timer_data->receiver.strong_ref();
- if (!receiver)
- return;
-
- event_loop_impl.post_event(*receiver, Core::Event::Type::Timer);
- }
- // Flush the event loop on this thread to keep any garbage from building up
- if (auto num_events = s_event_loop.pump(Core::EventLoop::WaitMode::PollForEvents); num_events != 0) {
- dbgln("BUG: Processed {} events on Timer thread!", num_events);
- }
-}
diff --git a/UI/Android/src/main/cpp/WebContentService.cpp b/UI/Android/src/main/cpp/WebContentService.cpp
deleted file mode 100644
index a8500fca7c1..00000000000
--- a/UI/Android/src/main/cpp/WebContentService.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include "WebContentService.h"
-#include "LadybirdServiceBase.h"
-#include <AK/LexicalPath.h>
-#include <LibCore/ArgsParser.h>
-#include <LibCore/EventLoop.h>
-#include <LibCore/LocalServer.h>
-#include <LibCore/System.h>
-#include <LibIPC/ConnectionFromClient.h>
-#include <LibImageDecoderClient/Client.h>
-#include <LibMedia/Audio/Loader.h>
-#include <LibRequests/RequestClient.h>
-#include <LibWeb/Bindings/MainThreadVM.h>
-#include <LibWeb/Fetch/Fetching/FetchEngine.h>
-#include <LibWeb/HTML/Scripting/Agent.h>
-#include <LibWeb/HTML/Window.h>
-#include <LibWeb/Loader/GeneratedPagesLoader.h>
-#include <LibWeb/Loader/ResourceLoader.h>
-#include <LibWeb/Platform/EventLoopPlugin.h>
-#include <LibWeb/Platform/FontPlugin.h>
-#include <LibWeb/Platform/RemoteImageCodecPlugin.h>
-#include <LibWebView/HelperProcess.h>
-#include <LibWebView/Utilities.h>
-#include <WebContent/ConnectionFromClient.h>
-#include <WebContent/PageHost.h>
-
-static ErrorOr<NonnullRefPtr<Requests::RequestClient>> bind_request_server_service()
-{
- return bind_service<Requests::RequestClient>(&bind_request_server_java);
-}
-
-static ErrorOr<NonnullRefPtr<ImageDecoderClient::Client>> bind_image_decoder_service()
-{
- return bind_service<ImageDecoderClient::Client>(&bind_image_decoder_java);
-}
-
-ErrorOr<int> service_main(int ipc_socket)
-{
- auto& event_loop = Core::EventLoop::initialize_for_current_thread();
-
- Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPlugin);
-
- Web::Platform::ImageCodecPlugin::install(*new Web::Platform::RemoteImageCodecPlugin(bind_image_decoder_service));
-
- Web::Bindings::initialize_agent(Web::HTML::AgentType::SimilarOriginWindow);
- auto& agent = Web::HTML::surrounding_agent();
- agent.fetch_executor = Web::Fetch::Fetching::create_inline_fetch_executor(agent.network_activity_observers);
-
- auto request_server_client = TRY(bind_request_server_service());
- Web::ResourceLoader::initialize(Web::Bindings::main_thread_vm().heap());
- Web::ResourceLoader::the().set_client({}, move(request_server_client));
-
- bool is_test_mode = false;
-
- Web::HTML::Window::set_internals_object_exposed(is_test_mode);
- Web::Platform::FontPlugin::install(*new Web::Platform::FontPlugin(is_test_mode));
-
- auto webcontent_socket = TRY(Core::LocalSocket::adopt_fd(ipc_socket));
- auto webcontent_client = TRY(WebContent::ConnectionFromClient::try_create(make<IPC::Transport>(move(webcontent_socket))));
-
- return event_loop.exec();
-}
-
-template<typename Client>
-ErrorOr<NonnullRefPtr<Client>> bind_service(void (*bind_method)(int))
-{
- int socket_fds[2] {};
- TRY(Core::System::socketpair(AF_LOCAL, SOCK_STREAM, 0, socket_fds));
-
- int ui_fd = socket_fds[0];
- int server_fd = socket_fds[1];
-
- // NOTE: The java object takes ownership of the socket fds
- (*bind_method)(server_fd);
-
- auto socket = TRY(Core::LocalSocket::adopt_fd(ui_fd));
- TRY(socket->set_blocking(true));
-
- auto new_client = TRY(try_make_ref_counted<Client>(make<IPC::Transport>(move(socket))));
-
- return new_client;
-}
diff --git a/UI/Android/src/main/cpp/WebContentService.h b/UI/Android/src/main/cpp/WebContentService.h
deleted file mode 100644
index 18ac67ba0ff..00000000000
--- a/UI/Android/src/main/cpp/WebContentService.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <AK/NonnullRefPtr.h>
-
-template<typename Client>
-ErrorOr<NonnullRefPtr<Client>> bind_service(void (*bind_method)(int));
-
-void bind_request_server_java(int ipc_socket);
-void bind_image_decoder_java(int ipc_socket);
diff --git a/UI/Android/src/main/cpp/WebContentServiceJNI.cpp b/UI/Android/src/main/cpp/WebContentServiceJNI.cpp
deleted file mode 100644
index 1e756ffff88..00000000000
--- a/UI/Android/src/main/cpp/WebContentServiceJNI.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include "JNIHelpers.h"
-#include "LadybirdServiceBase.h"
-#include "WebContentService.h"
-#include <jni.h>
-
-jobject global_instance;
-jclass global_class_reference;
-jmethodID bind_request_server_method;
-jmethodID bind_image_decoder_method;
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebContentService_nativeInit(JNIEnv*, jobject);
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebContentService_nativeInit(JNIEnv* env, jobject thiz)
-{
- global_instance = env->NewGlobalRef(thiz);
-
- auto local_class = env->FindClass("org/serenityos/ladybird/WebContentService");
- if (!local_class)
- TODO();
- global_class_reference = reinterpret_cast<jclass>(env->NewGlobalRef(local_class));
- env->DeleteLocalRef(local_class);
-
- auto method = env->GetMethodID(global_class_reference, "bindRequestServer", "(I)V");
- if (!method)
- TODO();
- bind_request_server_method = method;
-
- method = env->GetMethodID(global_class_reference, "bindImageDecoder", "(I)V");
- if (!method)
- TODO();
- bind_image_decoder_method = method;
-}
-
-void bind_request_server_java(int ipc_socket)
-{
- Ladybird::JavaEnvironment env(global_vm);
- env.get()->CallVoidMethod(global_instance, bind_request_server_method, ipc_socket);
-}
-
-void bind_image_decoder_java(int ipc_socket)
-{
- Ladybird::JavaEnvironment env(global_vm);
- env.get()->CallVoidMethod(global_instance, bind_image_decoder_method, ipc_socket);
-}
diff --git a/UI/Android/src/main/cpp/WebViewImplementationNative.cpp b/UI/Android/src/main/cpp/WebViewImplementationNative.cpp
deleted file mode 100644
index 4dc604879a6..00000000000
--- a/UI/Android/src/main/cpp/WebViewImplementationNative.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include "WebViewImplementationNative.h"
-#include "JNIHelpers.h"
-#include <AK/Random.h>
-#include <LibGfx/Bitmap.h>
-#include <LibGfx/DecodedImageFrame.h>
-#include <LibGfx/Painter.h>
-#include <LibWebView/ViewImplementation.h>
-#include <LibWebView/WebContentClient.h>
-#include <android/bitmap.h>
-#include <jni.h>
-
-namespace Ladybird {
-
-static Gfx::BitmapFormat to_gfx_bitmap_format(i32 f)
-{
- switch (f) {
- case ANDROID_BITMAP_FORMAT_RGBA_8888:
- return Gfx::BitmapFormat::RGBA8888;
- default:
- VERIFY_NOT_REACHED();
- }
-}
-
-WebViewImplementationNative::WebViewImplementationNative(jobject thiz)
- : m_java_instance(thiz)
-{
- // NOTE: m_java_instance's global ref is controlled by the JNI bindings
- initialize_client(CreateNewClient::Yes);
-
- on_ready_to_paint = [this]() {
- JavaEnvironment env(global_vm);
- env.get()->CallVoidMethod(m_java_instance, invalidate_layout_method);
- };
-
- on_load_start = [this](URL::URL const& url, bool is_redirect) {
- JavaEnvironment env(global_vm);
- auto url_string = env.jstring_from_ak_string(url.to_string());
- env.get()->CallVoidMethod(m_java_instance, on_load_start_method, url_string, is_redirect);
- env.get()->DeleteLocalRef(url_string);
- };
-}
-
-void WebViewImplementationNative::initialize_client(WebView::ViewImplementation::CreateNewClient)
-{
- m_client_state = {};
-
- auto new_client = bind_web_content_client();
-
- new_client->on_web_content_process_crash = [] {
- warnln("WebContent crashed!");
- // FIXME: launch a new client
- };
- new_client->register_view(0, *this);
-
- m_client_state.client_handle = generate_random_uuid();
- client().async_set_window_handle(0, m_client_state.client_handle);
-
- client().async_set_viewport(0, viewport_size(), m_device_pixel_ratio, Web::ViewportIsFullscreen::No);
- client().async_set_zoom_level(0, m_zoom_level);
-
- set_system_visibility_state(Web::HTML::VisibilityState::Visible);
-
- // FIXME: update_palette, update system fonts
-}
-
-void WebViewImplementationNative::paint_into_bitmap(void* android_bitmap_raw, AndroidBitmapInfo const& info)
-{
- // Software bitmaps only for now!
- VERIFY((info.flags & ANDROID_BITMAP_FLAGS_IS_HARDWARE) == 0);
-
- auto android_bitmap = MUST(Gfx::Bitmap::create_wrapper(to_gfx_bitmap_format(info.format), Gfx::AlphaType::Premultiplied, { info.width, info.height }, info.stride, android_bitmap_raw));
- auto painter = Gfx::Painter::create(android_bitmap);
- if (auto* bitmap = m_client_state.has_usable_bitmap ? m_client_state.front_bitmap.bitmap.ptr() : m_backup_bitmap.ptr())
- painter->draw_bitmap(android_bitmap->rect().to_type<float>(), MUST(Gfx::DecodedImageFrame::create(*MUST(bitmap->clone()))), bitmap->rect(), Gfx::ScalingMode::NearestNeighbor, {}, 1.0f, Gfx::CompositingAndBlendingOperator::Copy);
- else
- painter->fill_rect(android_bitmap->rect().to_type<float>(), Gfx::Color::Magenta);
-}
-
-void WebViewImplementationNative::set_viewport_geometry(int w, int h)
-{
- m_viewport_size = { w, h };
- handle_resize();
-}
-
-void WebViewImplementationNative::set_device_pixel_ratio(double f)
-{
- m_device_pixel_ratio = f;
- handle_resize();
-}
-
-void WebViewImplementationNative::set_zoom_level(double f)
-{
- m_zoom_level = f;
- client().async_set_zoom_level(0, m_zoom_level);
-}
-
-void WebViewImplementationNative::mouse_event(Web::MouseEvent::Type event_type, float x, float y, float raw_x, float raw_y)
-{
- Gfx::IntPoint position = { x, y };
- Gfx::IntPoint screen_position = { raw_x, raw_y };
- auto event = Web::MouseEvent {
- event_type,
- position.to_type<Web::DevicePixels>(),
- screen_position.to_type<Web::DevicePixels>(),
- Web::UIEvents::MouseButton::Primary,
- Web::UIEvents::MouseButton::Primary,
- Web::UIEvents::KeyModifier::Mod_None,
- 0,
- 0,
- 0,
- 0,
- Web::WheelDeltaPrecision::Discrete,
- Web::ScrollGesturePhase::None,
- 0,
- nullptr
- };
-
- enqueue_input_event(move(event));
-}
-
-NonnullRefPtr<WebView::WebContentClient> WebViewImplementationNative::bind_web_content_client()
-{
- JavaEnvironment env(global_vm);
-
- int socket_fds[2] {};
- MUST(Core::System::socketpair(AF_LOCAL, SOCK_STREAM, 0, socket_fds));
-
- int ui_fd = socket_fds[0];
- int wc_fd = socket_fds[1];
-
- // NOTE: The java object takes ownership of the socket fds
- env.get()->CallVoidMethod(m_java_instance, bind_webcontent_method, wc_fd);
-
- auto socket = MUST(Core::LocalSocket::adopt_fd(ui_fd));
- MUST(socket->set_blocking(true));
-
- auto new_client = make_ref_counted<WebView::WebContentClient>(make<IPC::Transport>(move(socket)), *this);
-
- return new_client;
-}
-
-}
diff --git a/UI/Android/src/main/cpp/WebViewImplementationNative.h b/UI/Android/src/main/cpp/WebViewImplementationNative.h
deleted file mode 100644
index c5833714fee..00000000000
--- a/UI/Android/src/main/cpp/WebViewImplementationNative.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <LibWebView/ViewImplementation.h>
-#include <android/bitmap.h>
-#include <jni.h>
-
-namespace Ladybird {
-
-class WebViewImplementationNative : public WebView::ViewImplementation {
-public:
- WebViewImplementationNative(jobject thiz);
-
- virtual Web::DevicePixelSize viewport_size() const override { return m_viewport_size; }
- virtual Gfx::IntPoint to_content_position(Gfx::IntPoint p) const override { return p; }
- virtual Gfx::IntPoint to_widget_position(Gfx::IntPoint p) const override { return p; }
- virtual void update_zoom() override { }
-
- NonnullRefPtr<WebView::WebContentClient> bind_web_content_client();
-
- virtual void initialize_client(CreateNewClient) override;
-
- void paint_into_bitmap(void* android_bitmap_raw, AndroidBitmapInfo const& info);
-
- void set_viewport_geometry(int w, int h);
- void set_zoom_level(double zoom_level);
- void set_device_pixel_ratio(double f);
-
- void mouse_event(Web::MouseEvent::Type event_type, float x, float y, float raw_x, float raw_y);
-
- static jclass global_class_reference;
- static jmethodID bind_webcontent_method;
- static jmethodID invalidate_layout_method;
- static jmethodID on_load_start_method;
-
- jobject java_instance() const { return m_java_instance; }
-
-private:
- jobject m_java_instance = nullptr;
- Web::DevicePixelSize m_viewport_size;
-};
-
-}
diff --git a/UI/Android/src/main/cpp/WebViewImplementationNativeJNI.cpp b/UI/Android/src/main/cpp/WebViewImplementationNativeJNI.cpp
deleted file mode 100644
index b4ab29e6349..00000000000
--- a/UI/Android/src/main/cpp/WebViewImplementationNativeJNI.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include "WebViewImplementationNative.h"
-#include <jni.h>
-
-using namespace Ladybird;
-
-jclass WebViewImplementationNative::global_class_reference;
-jmethodID WebViewImplementationNative::bind_webcontent_method;
-jmethodID WebViewImplementationNative::invalidate_layout_method;
-jmethodID WebViewImplementationNative::on_load_start_method;
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_00024Companion_nativeClassInit(JNIEnv*, jobject /* thiz */);
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_00024Companion_nativeClassInit(JNIEnv* env, jobject /* thiz */)
-{
- auto local_class = env->FindClass("org/serenityos/ladybird/WebViewImplementation");
- if (!local_class)
- TODO();
- WebViewImplementationNative::global_class_reference = reinterpret_cast<jclass>(env->NewGlobalRef(local_class));
- env->DeleteLocalRef(local_class);
-
- auto method = env->GetMethodID(WebViewImplementationNative::global_class_reference, "bindWebContentService", "(I)V");
- if (!method)
- TODO();
- WebViewImplementationNative::bind_webcontent_method = method;
-
- method = env->GetMethodID(WebViewImplementationNative::global_class_reference, "invalidateLayout", "()V");
- if (!method)
- TODO();
- WebViewImplementationNative::invalidate_layout_method = method;
-
- method = env->GetMethodID(WebViewImplementationNative::global_class_reference, "onLoadStart", "(Ljava/lang/String;Z)V");
- if (!method)
- TODO();
- WebViewImplementationNative::on_load_start_method = method;
-}
-
-extern "C" JNIEXPORT jlong JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_nativeObjectInit(JNIEnv*, jobject);
-
-extern "C" JNIEXPORT jlong JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_nativeObjectInit(JNIEnv* env, jobject thiz)
-{
- auto ref = env->NewGlobalRef(thiz);
- auto instance = reinterpret_cast<jlong>(new WebViewImplementationNative(ref));
- return instance;
-}
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_nativeObjectDispose(JNIEnv*, jobject /* thiz */, jlong);
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_nativeObjectDispose(JNIEnv* env, jobject /* thiz */, jlong instance)
-{
- auto* impl = reinterpret_cast<WebViewImplementationNative*>(instance);
- env->DeleteGlobalRef(impl->java_instance());
- delete impl;
-}
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_nativeDrawIntoBitmap(JNIEnv*, jobject /* thiz */, jlong, jobject);
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_nativeDrawIntoBitmap(JNIEnv* env, jobject /* thiz */, jlong instance, jobject bitmap)
-{
- auto* impl = reinterpret_cast<WebViewImplementationNative*>(instance);
-
- AndroidBitmapInfo bitmap_info = {};
- void* pixels = nullptr;
- AndroidBitmap_getInfo(env, bitmap, &bitmap_info);
- AndroidBitmap_lockPixels(env, bitmap, &pixels);
- if (pixels)
- impl->paint_into_bitmap(pixels, bitmap_info);
-
- AndroidBitmap_unlockPixels(env, bitmap);
-}
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_nativeSetViewportGeometry(JNIEnv*, jobject /* thiz */, jlong, jint, jint);
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_nativeSetViewportGeometry(JNIEnv*, jobject /* thiz */, jlong instance, jint w, jint h)
-{
- auto* impl = reinterpret_cast<WebViewImplementationNative*>(instance);
- impl->set_viewport_geometry(w, h);
-}
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_nativeLoadURL(JNIEnv*, jobject /* thiz */, jlong, jstring);
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_nativeLoadURL(JNIEnv* env, jobject /* thiz */, jlong instance, jstring url)
-{
- auto* impl = reinterpret_cast<WebViewImplementationNative*>(instance);
- char const* raw_url = env->GetStringUTFChars(url, nullptr);
- auto ak_url = URL::create_with_url_or_path(StringView { raw_url, strlen(raw_url) });
- env->ReleaseStringUTFChars(url, raw_url);
- impl->load(ak_url.release_value());
-}
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_nativeSetDevicePixelRatio(JNIEnv*, jobject /* thiz */, jlong instance, jfloat);
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_nativeSetDevicePixelRatio(JNIEnv*, jobject /* thiz */, jlong instance, jfloat ratio)
-{
- auto* impl = reinterpret_cast<WebViewImplementationNative*>(instance);
- impl->set_device_pixel_ratio(ratio);
-}
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_nativeMouseEvent(JNIEnv*, jobject /* thiz */, jlong, jint, jfloat, jfloat, jfloat, jfloat);
-
-extern "C" JNIEXPORT void JNICALL
-Java_org_serenityos_ladybird_WebViewImplementation_nativeMouseEvent(JNIEnv*, jobject /* thiz */, jlong instance, jint event_type, jfloat x, jfloat y, jfloat raw_x, jfloat raw_y)
-{
- auto* impl = reinterpret_cast<WebViewImplementationNative*>(instance);
-
- Web::MouseEvent::Type web_event_type;
-
- // These integers are defined in Android's MotionEvent.
- // See https://developer.android.com/reference/android/view/MotionEvent#constants_1
- if (event_type == 0) {
- // MotionEvent.ACTION_DOWN
- web_event_type = Web::MouseEvent::Type::MouseDown;
- } else if (event_type == 1) {
- // MotionEvent.ACTION_UP
- web_event_type = Web::MouseEvent::Type::MouseUp;
- } else if (event_type == 2) {
- // MotionEvent.ACTION_MOVE
- web_event_type = Web::MouseEvent::Type::MouseMove;
- } else {
- // Unknown event type, default to MouseUp
- web_event_type = Web::MouseEvent::Type::MouseUp;
- }
-
- impl->mouse_event(web_event_type, x, y, raw_x, raw_y);
-}
diff --git a/UI/Android/src/main/java/org/serenityos/ladybird/ImageDecoderService.kt b/UI/Android/src/main/java/org/serenityos/ladybird/ImageDecoderService.kt
deleted file mode 100644
index 816484be363..00000000000
--- a/UI/Android/src/main/java/org/serenityos/ladybird/ImageDecoderService.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-package org.serenityos.ladybird
-
-import android.os.Message
-
-class ImageDecoderService : LadybirdServiceBase("ImageDecoderService") {
- override fun handleServiceSpecificMessage(msg: Message): Boolean {
- return false
- }
-
- companion object {
- init {
- System.loadLibrary("imagedecoderservice")
- }
- }
-}
diff --git a/UI/Android/src/main/java/org/serenityos/ladybird/LadybirdActivity.kt b/UI/Android/src/main/java/org/serenityos/ladybird/LadybirdActivity.kt
deleted file mode 100644
index 48892475b86..00000000000
--- a/UI/Android/src/main/java/org/serenityos/ladybird/LadybirdActivity.kt
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-package org.serenityos.ladybird
-
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import android.view.KeyEvent
-import android.view.inputmethod.EditorInfo
-import android.widget.EditText
-import android.widget.TextView
-import org.serenityos.ladybird.databinding.ActivityMainBinding
-import java.io.BufferedInputStream
-import java.io.BufferedOutputStream
-import java.io.File
-import java.io.FileOutputStream
-import java.nio.file.Files
-import java.util.zip.ZipFile
-import kotlin.io.path.Path
-import kotlin.io.path.inputStream
-import kotlin.io.path.isDirectory
-import kotlin.io.path.outputStream
-
-class LadybirdActivity : AppCompatActivity() {
-
- private lateinit var binding: ActivityMainBinding
- private lateinit var resourceDir: String
- private lateinit var view: WebView
- private lateinit var urlEditText: EditText
- private var timerService = TimerExecutorService()
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
-
- resourceDir = TransferAssets.transferAssets(this)
- val testFile = File("$resourceDir/res/icons/48x48/app-browser.png")
- if (!testFile.exists())
- {
- ZipFile("$resourceDir/ladybird-assets.zip").use { zip ->
- zip.entries().asSequence().forEach { entry ->
- val fileName = entry.name
- val file = File("$resourceDir/$fileName")
- if (!entry.isDirectory)
- {
- val parentFolder = File(file.parent!!)
- if (!parentFolder.exists())
- parentFolder.mkdirs()
- zip.getInputStream(entry).use { input ->
- file.outputStream().use { output ->
- input.copyTo(output)
- }
- }
- }
- }
- }
-
- // curl has some issues with the Android's way of storing certificates.
- // We need to do this in order to make curl happy.
- val certMain = File("$resourceDir/cacert.pem")
- certMain.outputStream().use { output ->
- Files.walk(Path("/system/etc/security/cacerts")).forEach { certPath ->
- if (!certPath.isDirectory()) {
- certPath.inputStream().use { input ->
- input.copyTo(output)
- }
- }
- }
- }
- }
- val userDir = applicationContext.getExternalFilesDir(null)!!.absolutePath;
- initNativeCode(resourceDir, "Ladybird", timerService, userDir)
-
- binding = ActivityMainBinding.inflate(layoutInflater)
- setContentView(binding.root)
- setSupportActionBar(binding.toolbar)
- urlEditText = binding.urlEditText
- view = binding.webView
- view.onLoadStart = { url: String, _ ->
- urlEditText.setText(url, TextView.BufferType.EDITABLE)
- }
- urlEditText.setOnEditorActionListener { textView: TextView, actionId: Int, _: KeyEvent? ->
- when (actionId) {
- EditorInfo.IME_ACTION_GO, EditorInfo.IME_ACTION_SEARCH -> view.loadURL(textView.text.toString())
- }
- false
- }
- view.initialize(resourceDir)
- view.loadURL(intent.dataString ?: "https://ladybird.dev")
- }
-
- override fun onStart() {
- super.onStart()
- }
-
- override fun onDestroy() {
- view.dispose()
- disposeNativeCode()
- super.onDestroy()
- }
-
- private fun scheduleEventLoop() {
- mainExecutor.execute {
- execMainEventLoop()
- }
- }
-
- private external fun initNativeCode(
- resourceDir: String, tag: String, timerService: TimerExecutorService, userDir: String
- )
-
- private external fun disposeNativeCode()
- private external fun execMainEventLoop()
-
- companion object {
- // Used to load the 'ladybird' library on application startup.
- init {
- System.loadLibrary("Ladybird")
- }
- }
-}
diff --git a/UI/Android/src/main/java/org/serenityos/ladybird/LadybirdServiceBase.kt b/UI/Android/src/main/java/org/serenityos/ladybird/LadybirdServiceBase.kt
deleted file mode 100644
index c4c5cc1b5d1..00000000000
--- a/UI/Android/src/main/java/org/serenityos/ladybird/LadybirdServiceBase.kt
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-package org.serenityos.ladybird
-
-import android.app.Service
-import android.content.Intent
-import android.util.Log
-import android.os.ParcelFileDescriptor
-import android.os.Handler
-import android.os.IBinder
-import android.os.Looper
-import android.os.Message
-import android.os.Messenger
-import java.lang.ref.WeakReference
-import java.util.concurrent.Executors
-
-const val MSG_SET_RESOURCE_ROOT = 1
-const val MSG_TRANSFER_SOCKET = 2
-
-abstract class LadybirdServiceBase(protected val TAG: String) : Service() {
- private val threadPool = Executors.newCachedThreadPool()
- protected lateinit var resourceDir: String
-
- override fun onCreate() {
- super.onCreate()
- Log.i(TAG, "Creating Service")
- }
-
- override fun onDestroy() {
- super.onDestroy()
- Log.i(TAG, "Destroying Service")
- }
-
- override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
- Log.i(TAG, "Start command received")
- return super.onStartCommand(intent, flags, startId)
- }
-
- private fun handleTransferSockets(msg: Message) {
- val bundle = msg.data
- // FIXME: Handle garbage messages from wierd clients
- val ipcSocket = bundle.getParcelable<ParcelFileDescriptor>("IPC_SOCKET")!!
- createThread(ipcSocket)
- }
-
- private fun handleSetResourceRoot(msg: Message) {
- // FIXME: Handle this being already set, not being present, etc
- resourceDir = msg.data.getString("PATH")!!
-
- initNativeCode(resourceDir, TAG)
- }
-
- override fun onBind(p0: Intent?): IBinder? {
- // FIXME: Check the intent to make sure it's legit
- return Messenger(IncomingHandler(WeakReference(this))).binder
- }
-
-
- private fun createThread(ipcSocket: ParcelFileDescriptor) {
- threadPool.execute {
- nativeThreadLoop(ipcSocket.detachFd())
- }
- }
-
- private external fun nativeThreadLoop(ipcSocket: Int)
- private external fun initNativeCode(resourceDir: String, tagName: String);
-
- abstract fun handleServiceSpecificMessage(msg: Message): Boolean
-
- companion object {
-
- class IncomingHandler(private val service: WeakReference<LadybirdServiceBase>) :
- Handler(Looper.getMainLooper()) {
- override fun handleMessage(msg: Message) {
- when (msg.what) {
- MSG_TRANSFER_SOCKET -> service.get()?.handleTransferSockets(msg)
- ?: super.handleMessage(msg)
-
- MSG_SET_RESOURCE_ROOT -> service.get()?.handleSetResourceRoot(msg)
- ?: super.handleMessage(msg)
-
- else -> {
- val ret = service.get()?.handleServiceSpecificMessage(msg)
- if (ret == null || !ret)
- super.handleMessage(msg)
- }
- }
- }
- }
- }
-}
diff --git a/UI/Android/src/main/java/org/serenityos/ladybird/LadybirdServiceConnection.kt b/UI/Android/src/main/java/org/serenityos/ladybird/LadybirdServiceConnection.kt
deleted file mode 100644
index 8b2a62d9409..00000000000
--- a/UI/Android/src/main/java/org/serenityos/ladybird/LadybirdServiceConnection.kt
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-package org.serenityos.ladybird
-
-import android.content.ComponentName
-import android.content.ServiceConnection
-import android.os.IBinder
-import android.os.Message
-import android.os.Messenger
-import android.os.ParcelFileDescriptor
-
-class LadybirdServiceConnection(
- private var ipcFd: Int,
- private var resourceDir: String
-) :
- ServiceConnection {
- var boundToService: Boolean = false
- var onDisconnect: () -> Unit = {}
- private var service: Messenger? = null
-
- override fun onServiceConnected(className: ComponentName, svc: IBinder) {
- // This is called when the connection with the service has been
- // established, giving us the object we can use to
- // interact with the service. We are communicating with the
- // service using a Messenger, so here we get a client-side
- // representation of that from the raw IBinder object.
- service = Messenger(svc)
- boundToService = true
-
- val init = Message.obtain(null, MSG_SET_RESOURCE_ROOT)
- init.data.putString("PATH", resourceDir)
- service!!.send(init)
-
- val parcel = ParcelFileDescriptor.adoptFd(ipcFd)
- val msg = Message.obtain(null, MSG_TRANSFER_SOCKET)
- msg.data.putParcelable("IPC_SOCKET", parcel)
- service!!.send(msg)
- parcel.detachFd()
- }
-
- override fun onServiceDisconnected(className: ComponentName) {
- // This is called when the connection with the service has been
- // unexpectedly disconnected; that is, its process crashed.
- service = null
- boundToService = false
-
- // Notify owner that the service is dead
- onDisconnect()
- }
-}
diff --git a/UI/Android/src/main/java/org/serenityos/ladybird/RequestServerService.kt b/UI/Android/src/main/java/org/serenityos/ladybird/RequestServerService.kt
deleted file mode 100644
index fb60abb82e0..00000000000
--- a/UI/Android/src/main/java/org/serenityos/ladybird/RequestServerService.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-package org.serenityos.ladybird
-
-import android.os.Message
-
-class RequestServerService : LadybirdServiceBase("RequestServerService") {
- override fun handleServiceSpecificMessage(msg: Message): Boolean {
- return false
- }
-
- companion object {
- init {
- System.loadLibrary("requestserverservice")
- }
- }
-}
diff --git a/UI/Android/src/main/java/org/serenityos/ladybird/TimerExecutorService.kt b/UI/Android/src/main/java/org/serenityos/ladybird/TimerExecutorService.kt
deleted file mode 100644
index b907f4776ae..00000000000
--- a/UI/Android/src/main/java/org/serenityos/ladybird/TimerExecutorService.kt
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-package org.serenityos.ladybird
-
-import java.util.concurrent.Executors
-import java.util.concurrent.ScheduledFuture
-import java.util.concurrent.TimeUnit
-
-class TimerExecutorService {
-
- private val executor = Executors.newSingleThreadScheduledExecutor()
-
- class Timer(private var nativeData: Long) : Runnable {
- override fun run() {
- nativeRun(nativeData, id)
- }
-
- private external fun nativeRun(nativeData: Long, id: Long)
- var id: Long = 0
- }
-
- fun registerTimer(timer: Timer, singleShot: Boolean, milliseconds: Long): Long {
- val id = ++nextId
- timer.id = id
- val handle: ScheduledFuture<*> = if (singleShot) executor.schedule(
- timer,
- milliseconds,
- TimeUnit.MILLISECONDS
- ) else executor.scheduleWithFixedDelay(
- timer,
- milliseconds,
- milliseconds,
- TimeUnit.MILLISECONDS
- )
- timers[id] = handle
- return id
- }
-
- fun unregisterTimer(id: Long) {
- val timer = timers[id] ?: return
- timer.cancel(false)
- }
-
- private var nextId: Long = 0
- private val timers: HashMap<Long, ScheduledFuture<*>> = hashMapOf()
-
-}
diff --git a/UI/Android/src/main/java/org/serenityos/ladybird/TransferAssets.java b/UI/Android/src/main/java/org/serenityos/ladybird/TransferAssets.java
deleted file mode 100644
index fcba154d842..00000000000
--- a/UI/Android/src/main/java/org/serenityos/ladybird/TransferAssets.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Copyright (c) 2022, Andrew Kaster <[email protected]>
- * <p>
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-package org.serenityos.ladybird;
-
-import android.content.Context;
-import android.content.res.AssetManager;
-import android.util.Log;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import java.lang.String;
-
-public class TransferAssets {
- /**
- * @return new ladybird resource root
- */
- static public String transferAssets(Context context) {
- Log.d("Ladybird", "Hello from java");
- Context applicationContext = context.getApplicationContext();
- File assetDir = applicationContext.getFilesDir();
- AssetManager assetManager = applicationContext.getAssets();
- if (!copyAsset(assetManager, "ladybird-assets.zip", assetDir.getAbsolutePath() + "/ladybird-assets.zip")) {
- Log.e("Ladybird", "Unable to copy assets");
- return "Invalid Assets, this won't work";
- }
- Log.d("Ladybird", "Copied ladybird-assets.zip to app-specific storage path");
- return assetDir.getAbsolutePath();
- }
-
- // ty to https://stackoverflow.com/a/22903693 for the sauce
- private static boolean copyAsset(AssetManager assetManager,
- String fromAssetPath, String toPath) {
- try {
- InputStream in = assetManager.open(fromAssetPath);
- new File(toPath).createNewFile();
- OutputStream out = new FileOutputStream(toPath);
- copyFile(in, out);
- in.close();
- out.flush();
- out.close();
- return true;
- } catch (Exception e) {
- e.printStackTrace();
- return false;
- }
- }
-
- private static void copyFile(InputStream in, OutputStream out) throws IOException {
- byte[] buffer = new byte[4096];
- int read;
- while ((read = in.read(buffer)) != -1) {
- out.write(buffer, 0, read);
- }
- }
-}
diff --git a/UI/Android/src/main/java/org/serenityos/ladybird/WebContentService.kt b/UI/Android/src/main/java/org/serenityos/ladybird/WebContentService.kt
deleted file mode 100644
index fb7e41da2b6..00000000000
--- a/UI/Android/src/main/java/org/serenityos/ladybird/WebContentService.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-package org.serenityos.ladybird
-
-import android.content.Context
-import android.content.Intent
-import android.os.Message
-import android.util.Log
-
-class WebContentService : LadybirdServiceBase("WebContentService") {
- override fun handleServiceSpecificMessage(msg: Message): Boolean {
- return false
- }
-
- init {
- nativeInit();
- }
-
- private fun bindRequestServer(ipcFd: Int)
- {
- val connector = LadybirdServiceConnection(ipcFd, resourceDir)
- connector.onDisconnect = {
- // FIXME: Notify impl that service is dead and might need restarted
- Log.e(TAG, "RequestServer Died! :(")
- }
- // FIXME: Unbind this at some point maybe
- bindService(
- Intent(this, RequestServerService::class.java),
- connector,
- Context.BIND_AUTO_CREATE
- )
- }
-
- private fun bindImageDecoder(ipcFd: Int)
- {
- val connector = LadybirdServiceConnection(ipcFd, resourceDir)
- connector.onDisconnect = {
- // FIXME: Notify impl that service is dead and might need restarted
- Log.e(TAG, "ImageDecoder Died! :(")
- }
- // FIXME: Unbind this at some point maybe
- bindService(
- Intent(this, ImageDecoderService::class.java),
- connector,
- Context.BIND_AUTO_CREATE
- )
- }
-
- external fun nativeInit()
-
- companion object {
- init {
- System.loadLibrary("webcontentservice")
- }
- }
-}
diff --git a/UI/Android/src/main/java/org/serenityos/ladybird/WebView.kt b/UI/Android/src/main/java/org/serenityos/ladybird/WebView.kt
deleted file mode 100644
index d1ed3a2698a..00000000000
--- a/UI/Android/src/main/java/org/serenityos/ladybird/WebView.kt
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-package org.serenityos.ladybird
-
-import android.content.Context
-import android.graphics.Bitmap
-import android.graphics.Canvas
-import android.util.AttributeSet
-import android.view.MotionEvent
-import android.view.View
-
-// FIXME: This should (eventually) implement NestedScrollingChild3 and ScrollingView
-class WebView(context: Context, attributeSet: AttributeSet) : View(context, attributeSet) {
- private val viewImpl = WebViewImplementation(this)
- private lateinit var contentBitmap: Bitmap
- var onLoadStart: (url: String, isRedirect: Boolean) -> Unit = { _, _ -> }
-
- fun initialize(resourceDir: String) {
- viewImpl.initialize(resourceDir)
- }
-
- fun dispose() {
- viewImpl.dispose()
- }
-
- fun loadURL(url: String) {
- viewImpl.loadURL(url)
- }
-
- override fun onTouchEvent(event: MotionEvent): Boolean {
- // The native side only supports down, move, and up events.
- // So, ignore any other MotionEvents.
- if (event.action != MotionEvent.ACTION_DOWN &&
- event.action != MotionEvent.ACTION_MOVE &&
- event.action != MotionEvent.ACTION_UP) {
- return super.onTouchEvent(event);
- }
-
- // FIXME: We are passing these through as mouse events.
- // We should really be handling them as touch events.
- // (And we should handle scrolling - right now you have tap and drag the scrollbar!)
- viewImpl.mouseEvent(event.action, event.x, event.y, event.rawX, event.rawY)
-
- return true
- }
-
- override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
- super.onSizeChanged(w, h, oldw, oldh)
- contentBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)
-
- val pixelDensity = context.resources.displayMetrics.density
- viewImpl.setDevicePixelRatio(pixelDensity)
-
- // FIXME: Account for scroll offset when view supports scrolling
- viewImpl.setViewportGeometry(w, h)
- }
-
- override fun onDraw(canvas: Canvas) {
- super.onDraw(canvas)
-
- viewImpl.drawIntoBitmap(contentBitmap);
- canvas.drawBitmap(contentBitmap, 0f, 0f, null)
- }
-
-}
diff --git a/UI/Android/src/main/java/org/serenityos/ladybird/WebViewImplementation.kt b/UI/Android/src/main/java/org/serenityos/ladybird/WebViewImplementation.kt
deleted file mode 100644
index 9de762dcbe6..00000000000
--- a/UI/Android/src/main/java/org/serenityos/ladybird/WebViewImplementation.kt
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * Copyright (c) 2023, Andrew Kaster <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-package org.serenityos.ladybird
-
-import android.content.Context
-import android.content.Intent
-import android.content.ServiceConnection
-import android.graphics.Bitmap
-import android.util.Log
-import android.view.MotionEvent
-import android.view.View
-import java.net.URL
-
-/**
- * Wrapper around WebView::ViewImplementation for use by Kotlin
- */
-class WebViewImplementation(private val view: WebView) {
- // Instance Pointer to native object, very unsafe :)
- private var nativeInstance: Long = 0
- private lateinit var resourceDir: String
- private lateinit var connection: ServiceConnection
-
- fun initialize(resourceDir: String) {
- this.resourceDir = resourceDir
- nativeInstance = nativeObjectInit()
- }
-
- fun dispose() {
- nativeObjectDispose(nativeInstance)
- nativeInstance = 0
- }
-
- fun loadURL(url: String) {
- nativeLoadURL(nativeInstance, url)
- }
-
- fun drawIntoBitmap(bitmap: Bitmap) {
- nativeDrawIntoBitmap(nativeInstance, bitmap)
- }
-
- fun setViewportGeometry(w: Int, h: Int) {
- nativeSetViewportGeometry(nativeInstance, w, h)
- }
-
- fun setDevicePixelRatio(ratio: Float) {
- nativeSetDevicePixelRatio(nativeInstance, ratio)
- }
-
- fun mouseEvent(eventType: Int, x: Float, y: Float, rawX: Float, rawY: Float) {
- nativeMouseEvent(nativeInstance, eventType, x, y, rawX, rawY)
- }
-
- // Functions called from native code
- fun bindWebContentService(ipcFd: Int) {
- val connector = LadybirdServiceConnection(ipcFd, resourceDir)
- connector.onDisconnect = {
- // FIXME: Notify impl that service is dead and might need restarted
- Log.e("WebContentView", "WebContent Died! :(")
- }
- // FIXME: Unbind this at some point maybe
- view.context.bindService(
- Intent(view.context, WebContentService::class.java),
- connector,
- Context.BIND_AUTO_CREATE
- )
- connection = connector
- }
-
- fun invalidateLayout() {
- view.requestLayout()
- view.invalidate()
- }
-
- fun onLoadStart(url: String, isRedirect: Boolean) {
- view.onLoadStart(url, isRedirect)
- }
-
- // Functions implemented in native code
- private external fun nativeObjectInit(): Long
- private external fun nativeObjectDispose(instance: Long)
-
- private external fun nativeDrawIntoBitmap(instance: Long, bitmap: Bitmap)
- private external fun nativeSetViewportGeometry(instance: Long, w: Int, h: Int)
- private external fun nativeSetDevicePixelRatio(instance: Long, ratio: Float)
- private external fun nativeLoadURL(instance: Long, url: String)
- private external fun nativeMouseEvent(instance: Long, eventType: Int, x: Float, y: Float, rawX: Float, rawY: Float)
-
- companion object {
- /*
- * We use a static class initializer to allow the native code to cache some
- * field offsets. This native function looks up and caches interesting
- * class/field/method IDs. Throws on failure.
- */
- private external fun nativeClassInit()
-
- init {
- nativeClassInit()
- }
- }
-};
diff --git a/UI/Android/src/main/res/drawable/ic_launcher_background.xml b/UI/Android/src/main/res/drawable/ic_launcher_background.xml
deleted file mode 100644
index 07d5da9cbf1..00000000000
--- a/UI/Android/src/main/res/drawable/ic_launcher_background.xml
+++ /dev/null
@@ -1,170 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="108dp"
- android:height="108dp"
- android:viewportWidth="108"
- android:viewportHeight="108">
- <path
- android:fillColor="#3DDC84"
- android:pathData="M0,0h108v108h-108z" />
- <path
- android:fillColor="#00000000"
- android:pathData="M9,0L9,108"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M19,0L19,108"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M29,0L29,108"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M39,0L39,108"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M49,0L49,108"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M59,0L59,108"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M69,0L69,108"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M79,0L79,108"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M89,0L89,108"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M99,0L99,108"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,9L108,9"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,19L108,19"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,29L108,29"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,39L108,39"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,49L108,49"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,59L108,59"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,69L108,69"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,79L108,79"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,89L108,89"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M0,99L108,99"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M19,29L89,29"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M19,39L89,39"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M19,49L89,49"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M19,59L89,59"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M19,69L89,69"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M19,79L89,79"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M29,19L29,89"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M39,19L39,89"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M49,19L49,89"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M59,19L59,89"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M69,19L69,89"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
- <path
- android:fillColor="#00000000"
- android:pathData="M79,19L79,89"
- android:strokeWidth="0.8"
- android:strokeColor="#33FFFFFF" />
-</vector>
diff --git a/UI/Android/src/main/res/drawable/ic_launcher_foreground.xml b/UI/Android/src/main/res/drawable/ic_launcher_foreground.xml
deleted file mode 100644
index 7706ab9e6d4..00000000000
--- a/UI/Android/src/main/res/drawable/ic_launcher_foreground.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:aapt="http://schemas.android.com/aapt"
- android:width="108dp"
- android:height="108dp"
- android:viewportWidth="108"
- android:viewportHeight="108">
- <path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
- <aapt:attr name="android:fillColor">
- <gradient
- android:endX="85.84757"
- android:endY="92.4963"
- android:startX="42.9492"
- android:startY="49.59793"
- android:type="linear">
- <item
- android:color="#44000000"
- android:offset="0.0" />
- <item
- android:color="#00000000"
- android:offset="1.0" />
- </gradient>
- </aapt:attr>
- </path>
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
- android:strokeWidth="1"
- android:strokeColor="#00000000" />
-</vector>
diff --git a/UI/Android/src/main/res/layout/activity_main.xml b/UI/Android/src/main/res/layout/activity_main.xml
deleted file mode 100644
index ab08123dc22..00000000000
--- a/UI/Android/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fitsSystemWindows="true"
- tools:context=".LadybirdActivity">
-
- <com.google.android.material.appbar.AppBarLayout
- android:id="@+id/app_bar"
- android:layout_width="match_parent"
- android:layout_height="?attr/actionBarSize">
- <!-- FIXME: Add Navigation, URL bar, Tab interactions, etc -->
- <androidx.appcompat.widget.Toolbar
- android:id="@+id/toolbar"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:layout_scrollFlags="scroll|snap|enterAlways">
-
- <EditText
- android:id="@+id/urlEditText"
- style="@style/Widget.AppCompat.EditText"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:autofillHints="url"
- android:ems="10"
- android:hint="@string/url_edit_default"
- android:imeOptions="actionGo|actionSearch"
- android:inputType="textUri"
- android:singleLine="true" />
- </androidx.appcompat.widget.Toolbar>
- </com.google.android.material.appbar.AppBarLayout>
-
- <FrameLayout
- android:id="@+id/web_view_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:layout_behavior="@string/appbar_scrolling_view_behavior">
-
- <org.serenityos.ladybird.WebView
- android:id="@+id/web_view"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".LadybirdActivity" />
- </FrameLayout>
-</androidx.coordinatorlayout.widget.CoordinatorLayout>
diff --git a/UI/Android/src/main/res/mipmap-anydpi/ic_launcher.xml b/UI/Android/src/main/res/mipmap-anydpi/ic_launcher.xml
deleted file mode 100644
index b3e26b4c60c..00000000000
--- a/UI/Android/src/main/res/mipmap-anydpi/ic_launcher.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
- <background android:drawable="@drawable/ic_launcher_background" />
- <foreground android:drawable="@drawable/ic_launcher_foreground" />
- <monochrome android:drawable="@drawable/ic_launcher_foreground" />
-</adaptive-icon>
diff --git a/UI/Android/src/main/res/mipmap-anydpi/ic_launcher_round.xml b/UI/Android/src/main/res/mipmap-anydpi/ic_launcher_round.xml
deleted file mode 100644
index b3e26b4c60c..00000000000
--- a/UI/Android/src/main/res/mipmap-anydpi/ic_launcher_round.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
- <background android:drawable="@drawable/ic_launcher_background" />
- <foreground android:drawable="@drawable/ic_launcher_foreground" />
- <monochrome android:drawable="@drawable/ic_launcher_foreground" />
-</adaptive-icon>
diff --git a/UI/Android/src/main/res/mipmap-hdpi/ic_launcher.webp b/UI/Android/src/main/res/mipmap-hdpi/ic_launcher.webp
deleted file mode 100644
index c209e78ecd3..00000000000
Binary files a/UI/Android/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ
diff --git a/UI/Android/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/UI/Android/src/main/res/mipmap-hdpi/ic_launcher_round.webp
deleted file mode 100644
index b2dfe3d1ba5..00000000000
Binary files a/UI/Android/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/UI/Android/src/main/res/mipmap-mdpi/ic_launcher.webp b/UI/Android/src/main/res/mipmap-mdpi/ic_launcher.webp
deleted file mode 100644
index 4f0f1d64e58..00000000000
Binary files a/UI/Android/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ
diff --git a/UI/Android/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/UI/Android/src/main/res/mipmap-mdpi/ic_launcher_round.webp
deleted file mode 100644
index 62b611da081..00000000000
Binary files a/UI/Android/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/UI/Android/src/main/res/mipmap-xhdpi/ic_launcher.webp b/UI/Android/src/main/res/mipmap-xhdpi/ic_launcher.webp
deleted file mode 100644
index 948a3070fe3..00000000000
Binary files a/UI/Android/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ
diff --git a/UI/Android/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/UI/Android/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
deleted file mode 100644
index 1b9a6956b3a..00000000000
Binary files a/UI/Android/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/UI/Android/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/UI/Android/src/main/res/mipmap-xxhdpi/ic_launcher.webp
deleted file mode 100644
index 28d4b77f9f0..00000000000
Binary files a/UI/Android/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ
diff --git a/UI/Android/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/UI/Android/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
deleted file mode 100644
index 9287f508362..00000000000
Binary files a/UI/Android/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/UI/Android/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/UI/Android/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
deleted file mode 100644
index aa7d6427e6f..00000000000
Binary files a/UI/Android/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ
diff --git a/UI/Android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/UI/Android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
deleted file mode 100644
index 9126ae37cbc..00000000000
Binary files a/UI/Android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/UI/Android/src/main/res/values-night/themes.xml b/UI/Android/src/main/res/values-night/themes.xml
deleted file mode 100644
index cff646c5d1f..00000000000
--- a/UI/Android/src/main/res/values-night/themes.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<resources xmlns:tools="http://schemas.android.com/tools">
- <!-- Base application theme. -->
- <style name="Theme.Ladybird" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
- <!-- Primary brand color. -->
- <item name="colorPrimary">@color/purple_200</item>
- <item name="colorPrimaryVariant">@color/purple_700</item>
- <item name="colorOnPrimary">@color/black</item>
- <!-- Secondary brand color. -->
- <item name="colorSecondary">@color/teal_200</item>
- <item name="colorSecondaryVariant">@color/teal_200</item>
- <item name="colorOnSecondary">@color/black</item>
- <!-- Status bar color. -->
- <item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
- <!-- Customize your theme here. -->
- <item name="android:editTextBackground">@color/grey</item>
- <item name="windowActionBar">false</item>
- <item name="windowNoTitle">true</item>
- </style>
-</resources>
diff --git a/UI/Android/src/main/res/values/colors.xml b/UI/Android/src/main/res/values/colors.xml
deleted file mode 100644
index d9462c7ca96..00000000000
--- a/UI/Android/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <color name="purple_200">#FFBB86FC</color>
- <color name="purple_500">#FF6200EE</color>
- <color name="purple_700">#FF3700B3</color>
- <color name="teal_200">#FF03DAC5</color>
- <color name="teal_700">#FF018786</color>
- <color name="black">#FF000000</color>
- <color name="white">#FFFFFFFF</color>
- <color name="grey">#FF6B6B6B</color>
-</resources>
diff --git a/UI/Android/src/main/res/values/strings.xml b/UI/Android/src/main/res/values/strings.xml
deleted file mode 100644
index f5b02a618a2..00000000000
--- a/UI/Android/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<resources>
- <string name="app_name">Ladybird</string>
- <string name="url_edit_default">Enter URL...</string>
-</resources>
diff --git a/UI/Android/src/main/res/values/themes.xml b/UI/Android/src/main/res/values/themes.xml
deleted file mode 100644
index 4d2d58af0ae..00000000000
--- a/UI/Android/src/main/res/values/themes.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<resources xmlns:tools="http://schemas.android.com/tools">
- <!-- Base application theme. -->
- <style name="Theme.Ladybird" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
- <!-- Primary brand color. -->
- <item name="colorPrimary">@color/purple_500</item>
- <item name="colorPrimaryVariant">@color/purple_700</item>
- <item name="colorOnPrimary">@color/white</item>
- <!-- Secondary brand color. -->
- <item name="colorSecondary">@color/teal_200</item>
- <item name="colorSecondaryVariant">@color/teal_700</item>
- <item name="colorOnSecondary">@color/black</item>
- <!-- Status bar color. -->
- <item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
- <!-- Customize your theme here. -->
- <item name="android:editTextBackground">@color/white</item>
- <item name="windowActionBar">false</item>
- <item name="windowNoTitle">true</item>
- </style>
-</resources>
diff --git a/UI/Android/src/main/res/xml/backup_rules.xml b/UI/Android/src/main/res/xml/backup_rules.xml
deleted file mode 100644
index 148c18b6593..00000000000
--- a/UI/Android/src/main/res/xml/backup_rules.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- Sample backup rules file; uncomment and customize as necessary.
- See https://developer.android.com/guide/topics/data/autobackup
- for details.
- Note: This file is ignored for devices older that API 31
- See https://developer.android.com/about/versions/12/backup-restore
--->
-<full-backup-content>
- <!--
- <include domain="sharedpref" path="."/>
- <exclude domain="sharedpref" path="device.xml"/>
--->
-</full-backup-content>
diff --git a/UI/Android/src/main/res/xml/data_extraction_rules.xml b/UI/Android/src/main/res/xml/data_extraction_rules.xml
deleted file mode 100644
index 0c4f95cab91..00000000000
--- a/UI/Android/src/main/res/xml/data_extraction_rules.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- Sample data extraction rules file; uncomment and customize as necessary.
- See https://developer.android.com/about/versions/12/backup-restore#xml-changes
- for details.
--->
-<data-extraction-rules>
- <cloud-backup>
- <!-- TODO: Use <include> and <exclude> to control what is backed up.
- <include .../>
- <exclude .../>
- -->
- </cloud-backup>
- <!--
- <device-transfer>
- <include .../>
- <exclude .../>
- </device-transfer>
- -->
-</data-extraction-rules>
diff --git a/UI/Android/vcpkg_android.cmake b/UI/Android/vcpkg_android.cmake
deleted file mode 100644
index 165e6cc584b..00000000000
--- a/UI/Android/vcpkg_android.cmake
+++ /dev/null
@@ -1,97 +0,0 @@
-# This file is based on the vcpkg Android example from here:
-# https://github.com/microsoft/vcpkg-docs/blob/06b496c3f24dbe651fb593a26bee50537eeaf4e5/vcpkg/examples/vcpkg_android_example_cmake_script/cmake/vcpkg_android.cmake
-#
-# It was modified to use CMake variables instead of environment variables where needed, because it's not possible to set
-# environment variables in the Android Gradle plugin.
-
-# vcpkg_android.cmake
-#
-# Helper script when using vcpkg with cmake. It should be triggered via the variable VCPKG_TARGET_ANDROID
-#
-# For example:
-# if (VCPKG_TARGET_ANDROID)
-# include("cmake/vcpkg_android.cmake")
-# endif()
-#
-# This script will:
-# 1 & 2. check the presence of needed env variables: ANDROID_NDK and VCPKG_ROOT
-# 3. set VCPKG_TARGET_TRIPLET according to ANDROID_ABI
-# 4. Combine vcpkg and Android toolchains by setting CMAKE_TOOLCHAIN_FILE
-# and VCPKG_CHAINLOAD_TOOLCHAIN_FILE
-
-# Note: VCPKG_TARGET_ANDROID is not an official vcpkg variable.
-# it is introduced for the need of this script
-
-if (VCPKG_TARGET_ANDROID)
-
- #
- # 1. Check the presence of variable ANDROID_NDK
- #
- if (NOT DEFINED ANDROID_NDK)
- message(FATAL_ERROR "Please set CMake variable ANDROID_NDK")
- endif()
-
- #
- # 2. Check the presence of environment variable VCPKG_ROOT
- #
- if (NOT DEFINED ENV{VCPKG_ROOT} OR "$ENV{VCPKG_ROOT}" STREQUAL "")
- message(FATAL_ERROR "Please set a non-empty environment variable VCPKG_ROOT")
- endif()
-
- #
- # 3. Set VCPKG_TARGET_TRIPLET according to ANDROID_ABI
- #
- # There are four different Android ABI, each of which maps to
- # a vcpkg triplet. The following table outlines the mapping from vcpkg architectures to android architectures
- #
- # |VCPKG_TARGET_TRIPLET | ANDROID_ABI |
- # |---------------------------|----------------------|
- # |arm64-android | arm64-v8a |
- # |arm-android | armeabi-v7a |
- # |x64-android | x86_64 |
- # |x86-android | x86 |
- #
- # The variable must be stored in the cache in order to successfully the two toolchains.
- #
- if (ANDROID_ABI MATCHES "arm64-v8a")
- set(VCPKG_TARGET_TRIPLET "arm64-android" CACHE STRING "" FORCE)
- elseif(ANDROID_ABI MATCHES "armeabi-v7a")
- set(VCPKG_TARGET_TRIPLET "arm-android" CACHE STRING "" FORCE)
- elseif(ANDROID_ABI MATCHES "x86_64")
- set(VCPKG_TARGET_TRIPLET "x64-android" CACHE STRING "" FORCE)
- elseif(ANDROID_ABI MATCHES "x86")
- set(VCPKG_TARGET_TRIPLET "x86-android" CACHE STRING "" FORCE)
- else()
- message(FATAL_ERROR "
- Please specify ANDROID_ABI
- For example
- cmake ... -DANDROID_ABI=armeabi-v7a
-
- Possible ABIs are: arm64-v8a, armeabi-v7a, x64-android, x86-android
- ")
- endif()
- message("vcpkg_android.cmake: VCPKG_TARGET_TRIPLET was set to ${VCPKG_TARGET_TRIPLET}")
-
- #
- # 4. Combine vcpkg and Android toolchains
- #
-
- # vcpkg and android both provide dedicated toolchains:
- #
- # vcpkg_toolchain_file=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake
- # android_toolchain_file=$ANDROID_NDK/build/cmake/android.toolchain.cmake
- #
- # When using vcpkg, the vcpkg toolchain shall be specified first.
- # However, vcpkg provides a way to preload and additional toolchain,
- # with the VCPKG_CHAINLOAD_TOOLCHAIN_FILE option.
- set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE ${ANDROID_NDK}/build/cmake/android.toolchain.cmake)
- set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
- message("vcpkg_android.cmake: CMAKE_TOOLCHAIN_FILE was set to ${CMAKE_TOOLCHAIN_FILE}")
- message("vcpkg_android.cmake: VCPKG_CHAINLOAD_TOOLCHAIN_FILE was set to ${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
-
- # vcpkg depends on the environment variable ANDROID_NDK_HOME being set. However, we cannot set it through the
- # Android Gradle plugin (we can only set CMake variables). Forward CMake variables to environment variables here.
- # FIXME: would be nice if vcpkg's android toolchain did not require this...
- set(ENV{ANDROID_NDK_HOME} ${ANDROID_NDK})
-
-endif(VCPKG_TARGET_ANDROID)
diff --git a/UI/CMakeLists.txt b/UI/CMakeLists.txt
index 61bef23f278..33a984afec6 100644
--- a/UI/CMakeLists.txt
+++ b/UI/CMakeLists.txt
@@ -141,11 +141,7 @@ function(create_ladybird_bundle target_name)
copy_resources_to_build(${resource_base_dir} ${target_name})
endfunction()
-if (ANDROID OR VCPKG_TARGET_ANDROID)
- add_subdirectory("Android")
-else()
- add_subdirectory("Qt")
-endif()
+add_subdirectory("Qt")
if (NOT TARGET ladybird)
message(FATAL_ERROR "UI Framework selection must declare a ladybird target")
diff --git a/UI/cmake/AndroidExtras.cmake b/UI/cmake/AndroidExtras.cmake
deleted file mode 100644
index e79f9dec7cf..00000000000
--- a/UI/cmake/AndroidExtras.cmake
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (c) 2022, Andrew Kaster <[email protected]>
-#
-# SPDX-License-Identifier: BSD-2-Clause
-#
-
-#
-# Copy resources into tarball for inclusion in /assets of APK
-#
-set(LADYBIRD_RESOURCE_ROOT "${LADYBIRD_SOURCE_DIR}/Base/res")
-macro(copy_res_folder folder)
- add_custom_target(copy-${folder}
- COMMAND ${CMAKE_COMMAND} -E copy_directory
- "${LADYBIRD_RESOURCE_ROOT}/${folder}"
- "asset-bundle/res/${folder}"
- )
- add_dependencies(archive-assets copy-${folder})
-endmacro()
-add_custom_target(archive-assets COMMAND ${CMAKE_COMMAND} -E chdir asset-bundle zip -r ../ladybird-assets.zip ./ )
-copy_res_folder(ladybird)
-copy_res_folder(fonts)
-copy_res_folder(icons)
-copy_res_folder(themes)
-add_custom_target(copy-assets COMMAND ${CMAKE_COMMAND} -E copy_if_different ladybird-assets.zip "${CMAKE_SOURCE_DIR}/UI/Android/src/main/assets/")
-add_dependencies(copy-assets archive-assets)
-add_dependencies(ladybird copy-assets)