NOTE: OneLineage is just a proof of concept, this repo should provide you with enough to port other roms to bootloader locked devices, the lineageos with this repo is just a demo of this capability, and therefore does not fully work. Have fun!
Hot-switch between stock One UI and a LineageOS 23.2 (Android 16) GSI on a rooted Samsung phone, with no reflashing and no second partition. OneLineage stages the GSI under /data/local/tmp, pivots into it as a container with its own zygote and system_server, and can hand the screen back to One UI.
This has been tested on only a handful of devices, and it seems if you want to install it without making modifications, it has to be on Android 16 It may not work on other Samsung models, other One UI versions, or other devices at all. It is experimental, it replaces core parts of a running system, and it can crash, hang or soft-brick your phone, fill
/data, or break radio/SMS. Back up everything first. Use at your own risk. Also, I did use AI a fair bit in this project, it would have taken a LOT longer without it.
- A rooted Samsung phone (the tested one is an S26 Ultra on One UI 8.5)
- Enough free space on
/datafor the extracted GSI - Internet access for the GSI download (LineageOS 23.2 GSI, EXT4, VANILLA or GAPPS builds from SourceForge)
| Path | What it is |
|---|---|
src/, res/, AndroidManifest.xml |
The Android app (com.wewaffles.onelineage) |
assets/master_prepare.sh |
Stages the rootfs, binds the patched files, fixes labels/ownership |
assets/master_inner.sh |
Runs inside the container, starts the guest zygote |
assets/switch_to_lineage.sh / return_to_oneui.sh |
Switch in and back out |
assets/zygote_exec |
Static aarch64 launcher for the guest zygote |
build_apk.sh |
Builds and signs the APK |
services_patched.jaroversystem/framework/services.jarframework_patched.jaroversystem/framework/framework.jarPermissionController_patched.apk: removes theandroid.permission.RANGINGreference so runtime-permission dialogs stop crashing (Samsung's PermissionController needs a permission the LineageOS 23.2 platform doesn't define)- Optional bind-mounts when present:
framework-res_patched.apk,libaudio_aidl_conversion_common_cpp_patched.so,libaudioclient_aidl_conversion_patched.so
- APEX paths in the container. Host
/system/apexand/system_ext/apexare bound into the rootfs after the GSI payloads are extracted, so PackageManagerService stops dying inscanApexPackages. - SELinux labels on the staged
/data. The tree is relabeled like a real/data(system_data_file, per-packageapp_data_file) instead ofshell_data_file. Alsosetenforce 0during the takeover andsetenforce 1on return. - Audio hang. Host
audioserver/cameraserverare left running (they used to be stopped/frozen, which deadlockedAudioService). Only the host zygote is suppressed. - Runaway
sf.log. SurfaceFlinger output goes to/dev/null(it was growing to hundreds of MB in minutes). - App data ownership.
fix_app_dirs.shre-owns app data dirs to the uid PackageManager assigned, strips write bits from dex/apk/jar files (ART refuses writable dex), and creates missing dirs such as/data/misc/bluedroid. - No installd.
ensure_app_storage.shplus a 15 s sweeper create/data/user/0,/data/user_de/0and shared-storage dirs for new installs, so apps installed inside Lineage can launch. - Gesture navigation. Overlay idmaps are generated with
idmap2 --ignore-overlayablebefore zygote starts. - Bluetooth crash loop fixed by creating
/data/misc/bluedroidbefore boot. - adb.
Settings.Global.ADB_ENABLEDis pre-seeded, hostadb_keysare copied into the guest, andadb_watchdog.shkeeps adbd and the USB gadget alive. - Networking. The preferred APN is switched to
IPV4V6, andnet_fix.shmaintains a private routing table (4242) because the guest's ConnectivityService can't program the host's netd. - SMS.
ims_watchdog.shkeeps One UI'simsdrunning andswitch_to_lineage.shwaits for voice registration before pivoting. - Boot diagnostics. Each boot writes
/data/boot_failures.log.
- Returning to One UI may still need a manual reboot.
- The guest binds the host's
media.codec, whose AIDL hash differs from the GSI's, which can cause high CPU during codec enumeration. - No IMS stack in the guest, so voice calls don't work (data and SMS depend on One UI's
imsd). - Developer options crash (the guest registers no
adbservice). - DTMF tones glitch, and deep-buffer audio hangs, so it stays disabled.
- Never kill the host
netdwhile Lineage is running.
Edit the paths at the top of build_apk.sh (JDK 17, Android SDK build-tools 34, android-34 platform), provide your own signing keystore, then run ./build_apk.sh.
LineageOS GSI builds by MisterZtr (SourceForge). LineageOS and Android are trademarks of their respective owners. Not affiliated with Samsung, Google or LineageOS.