r/androiddev • • 35m ago

Open Source Lessons from building a ~1.8 MB Jetpack Compose Android launcher: avoiding 150 MB FBO spikes, clean stroked outline text with Path.Op.UNION, and edge Back gestures

I recently open-sourced OpenLauncher (GitHub, GPL-3.0, forked from yLauncher) after refactoring and profiling it heavily on Android 17 (compileSdk 37 / targetSdk 36, Compose BOM 2026.08.00, Kotlin 2.4.10). Thought I'd share a few Compose / Android platform gotchas we hit and how we solved them:

1. Full-screen CompositingStrategy.Offscreen FBOs silently blew up Graphics RAM

For a soft top/bottom fade on the A–Z LazyColumn, the obvious Compose pattern is Modifier.graphicsLayer { compositingStrategy = CompositingStrategy.Offscreen } + BlendMode.DstIn gradient mask. Profiling dumpsys meminfo showed Vulkan Graphics memory jumping from ~7.5 MB to >150 MB.

  • Fix: Dropped the offscreen FBO completely and computed per-row edge alpha (computeRowEdgeAlpha) directly inside each item's graphicsLayer { alpha = ... } lambda. Zero extra render target allocations.

2. Zero-recomposition scrubbing & WindowManager IPC stalls

Scrubbing an alphabet edge rail shouldn't trigger Compose recompositions or WindowInsetsControllerCompat Binder calls on every letter change:

  • Fix: Passed state snapshots (State<Float> / State<RailEntry>) that are only read inside graphicsLayer { } draw-phase lambdas, kept one persistent LazyColumn across scrubbing and browsing with synchronous SideEffect { listState.requestScrollToItem(...) } (zero jump when lifting your thumb), and keyed the system-bars DisposableEffect strictly on uiMode is Search rather than the full uiMode sealed class.

3. Clean outlined clock typography (Path.Op.UNION)

Stroked Compose TextStyle(drawStyle = Stroke(...)) renders ugly internal crossing lines on fonts whose glyphs have overlapping sub-contours (e.g., 9, 4 in Josefin Sans).

  • Fix: Extracted glyph outlines via Paint.getTextPath(...) and ran android.graphics.Path.op(rawPath, Path(), Path.Op.UNION) before stroking on Canvas. Result is crisp hollow digits with zero interior seams.

4. Right-edge alphabet rail vs. Android's predictive Back gesture

Putting a touchable alphabet rail on the right screen edge fights Android's system Back gesture if systemGestureExclusion stays active blindly or intercepts immediately on ACTION_DOWN.

  • Fix: Attached Modifier.systemGestureExclusion dynamically only when the rail is dormant or actively scrubbing (detached while browsing the drawer), and waited for 6.dp slop (or clean finger-up tap, ignoring ACTION_CANCEL) before claiming the gesture when visible.

5. Keeping the R8 release APK at ~1.8 MB & RAM tight

  • Avoided material-icons-extended completely (small XML vector drawables instead).
  • Zero Drawable/Bitmap references inside AppInfo or repositories (@Immutable metadata only); icons are rasterized strictly at target sizePx inside a 3 MB byte-bounded LRU cache with single-IPC background pre-warming.
  • Full Work Profile / Private Space isolation keying favorites and search history by "$packageName|$userSerialNumber" and launching App Info / uninstall via LauncherApps.startAppDetailsActivity & Intent.EXTRA_USER.

All code is open-source (GPL-3.0) in the repo (70 unit tests across Robolectric + MockK, zero INTERNET permission in the manifest). Curious how others handle custom glyph stroking or edge-rail gesture arbitration in Compose launchers!

1 Upvotes

0 comments sorted by