Files
MosisService/CLAUDE.md
2026-01-16 08:15:28 +01:00

2.6 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Build Commands

# Build entire project
./gradlew build

# Build debug APK
./gradlew assembleDebug

# Build release APK
./gradlew assembleRelease

# Clean build outputs
./gradlew clean

# Build with verbose output
./gradlew build --info --stacktrace

# Run lint checks
./gradlew lint

# Run unit tests
./gradlew test

# Run connected device tests
./gradlew connectedAndroidTest

Environment Requirements

Required environment variables:

  • ANDROID_HOME - Android SDK path
  • ANDROID_NDK_HOME - Android NDK path (version 29.0.14206865)
  • VCPKG_ROOT - vcpkg package manager root

Architecture Overview

MosisService is an Android application combining Kotlin UI with native C++ libraries for UI rendering via Android's Binder IPC system.

Two Native Libraries

mosis-service (libmosis-service.so):

  • Main Android Binder service implementation
  • Implements IMosisService.aidl interface for touch events and initialization
  • Contains the Kernel rendering engine with RmlUi integration
  • Links against RmlUi for HTML/CSS-like UI rendering

mosis-test (libmosis-test.so):

  • Test/rendering client implementation
  • Implements IMosisListener.aidl for receiving callbacks
  • OpenGL ES 2.0 rendering pipeline using GLAD

IPC Flow

Kotlin NativeService → JNI → mosis-service (IMosisService)
                              ↓
                         IMosisListener callbacks
                              ↓
                         mosis-test (rendering client)

Key Interfaces (AIDL)

IMosisService: initOS(), onTouchDown(), onTouchMove(), onTouchUp()

IMosisListener (oneway/async): onServiceInitialized(), onBufferAvailable(), onFrameAvailable()

Native Code Structure (src/main/cpp/)

  • kernel.cpp - Core rendering engine, RmlUi integration, event processing
  • mosis-service.cpp - Binder service implementation, JNI entry points
  • mosis-test.cpp - Test client implementation
  • egl_context.cpp - OpenGL ES context management
  • render_target.cpp - Framebuffer and buffer management
  • RmlUi_Renderer_GL3.cpp - RmlUi OpenGL renderer backend
  • assets_manager.cpp - Android AssetManager integration

Code Style

  • C++23 standard with modern features (std::span, std::format)
  • PascalCase for classes/functions, camelCase for variables
  • RAII principles with smart pointers
  • Kotlin code follows Android conventions

Dependencies

  • vcpkg manages native dependencies (RmlUi)
  • CMake build system with vcpkg toolchain integration
  • Target architecture: arm64-v8a only