How evolution-x-devices/device_xiaomi_raphael works
Project type and purpose
• This is an Android “device tree” / OS configuration project for the Redmi K20 Pro (codename “raphael”) maintained by LineageOS.
• It contains device-specific build scripts, HAL modules, init scripts, overlays, SELinux policies, and proprietary file lists to produce a custom Android system image for this hardware.
File structure
• Top-level files (Android.bp, .mk, proprietary-files.txt) orchestrate the Android.bp (Soong) build and legacy make build.
• Subdirectories represent distinct OS subsystems and services:
• init/ & libinit/ – device-specific init scripts (.rc, .sh) and initialization libraries
• camera/, audio in configs/, gps in configs/, sensors/, light/, livedisplay/, powerstats/ – native HAL implementations (HIDL or AIDL services)
• parts/ & rro_overlays/ – Android apps and runtime resource overlays for Settings, SystemUI, Telephony, etc.
• sepolicy/ – SELinux policies (public, private, vendor)
• seccomp/ – seccomp policies for media/codecs
• hidl/ – hardware interface definitions and compatibility matrices
• configs/ – XML and JSON hardware configuration files (audio policy, display, thermal, NFC, wifi, GPS)
• device.mk, BoardConfig.mk, AndroidProducts.mk, device prop files (.prop) configure product variables, partitions, kernel cmdline.
README
• Confirms that this repository supplies all device-specific bits (HAL services, drivers, configs) to build a LineageOS image for the Xiaomi Mi 9T Pro.
a. Main components:
• Bootloader & kernel (external to this repo, but implied by BoardConfig and device mk files)
• Init subsystem (init binaries + .rc scripts + libinit)
• Hardware Abstraction Layer: native daemons / HIDL services for camera, audio, sensors, light, powerstats, gps, seccomp policies
• SELinux enforcement (sepolicy)
• System partitions: system, system_ext, vendor, odm (with overlays)
• Android framework & apps (Settings, SystemUI, PopupCameraService, etc. under parts/)
• Runtime Resource Overlays (rROs) applied at boot (FrameworksResRaphael, SystemUIResRaphael, TelephonyResCommon, etc.)
• Proprietary libraries and blobs (listed in proprietary-files.txt)
b. Relationships and interactions:
• Bootloader loads kernel → kernel mounts /vendor, /system, /odm → init runs first .rc → loads libinit to set up Dalvik heap, services, filesystems
• init parses device’s init.qcom.rc and xiaomi.rc to start native HAL daemons: light, camera, livedisplay, sensors, powerstats, UDFPS, etc.
• Each HAL service registers with the HIDL service manager for framework to bind via binder IPC
• Android framework (system_server + Java services) invokes HAL interfaces through AIDL/HIDL proxies
• Parts apps (PopupCameraService, ClearSpeakerService) run in the Android app layer, receiving broadcasts from framework, interacting with HAL via Java APIs
• rRO overlays are mounted by vold at runtime to override resources in framework or vendor APKs
• SELinux policies restrict domain permissions for init, HAL daemons, system_server, apps
• Seccomp policies restrict syscalls in mediacodec, vendor systemd
c. Architectural patterns / design principles:
• Layered architecture: hardware drivers → HAL daemons → binder IPC → framework → apps
• Modularization via HIDL interfaces for each hardware domain
• Separation of concerns: configs in XML/JSON under configs/, policies under sepolicy/, code in directories by subsystem
• Soong (Android.bp) + legacy make for reproducible builds
• Runtime Resource Overlay (rRO) for customization without modifying core framework
d. Key technologies / frameworks / libraries:
• Android.bp & mk build system
• HIDL (android.hardware.*@x.x-service)
• SELinux (.te, property_contexts)
• seccomp
• Runtime Resource Overlay (RRO)
• Dalvik/ART initialization (libinit_dalvik_heap)
• Java services in parts/