An LSPosed module (modern libxposed API 102) that cuts the work System UI does while the Quick Settings / notification shade is open on Samsung One UI, plus a companion app to check that it is running, pick a preset, tune each optimisation and measure the result on your own phone.
- Independent hook modules, each switchable live with no reboot: media-wave sampling, panel blur radius, album-art colour caching.
- Probes that only measure the shade (frame pacing, layout passes, who keeps re-laying out the shade), attached only while profiling is on.
- Basic mode with four presets and a one-tap Quick Health Check. Advanced mode with per-module controls, a Hook Inspector, a before/after benchmark and exportable logs.
Primary test device: Galaxy S23 Ultra (SM-S918U1), One UI 9.0, Android 17.
Honest expectations: on the S23 Ultra the module measurably reduces the work it targets (wave drawing −34…−43%, fewer missed frames on System UI's main thread), but whole-pipeline jank measured with
gfxinfodid not change. Most shade cost is Samsung's own layout and rendering, and on the test phone the biggest avoidable cost came from another Xposed module. The app shows you which one. See Findings.
Forked from cybr47/ShadeSwitch (Apache 2.0), whose optimisation came from Samsung QS Lag Fix / OneUI-QSlagfix (originally for UN1CA 3): raise the media-player wave's sampling step so fewer points are computed per frame. This fork moves it to libxposed API 102, verifies every hook target against the One UI 9 System UI dex, and grows it into a set of measured, independently switchable optimisations with an app to check and benchmark them. See NOTICE.
Measured on a Galaxy S23 Ultra (One UI 9.0, System UI 17) by sampling System UI's main thread while pulling the shade with media playing, then confirmed with the module's own probes. Shares are of System UI main-thread samples and overlap (a call can count in two rows).
| Factor | Share | Where (verified in the device's System UI dex) | ShadeSwitch |
|---|---|---|---|
| Shade expansion and layout | 14.2% | NotificationShadeWindowView.onMeasure, ViewRootImpl.doTraversal |
Measures. Skipping layout passes leaves half-drawn panels. |
| Notification stack | 13.3% | NotificationStackScrollLayout.applyCurrentState / onMeasure |
Measures |
| Kotlin flows / coroutines | 10.0% | throughout | — |
| Samsung QS (Compose) | 9.8% | QSImpl.setQsExpansion |
Measures, and drives frame-pacing timing |
| Media player card | 5.4% | wave renderers 4.9%, colour extraction 0.4% | Optimises (wave sampling, colour cache) |
| Status bar icons | 5.4% | — | Shows who requests relayouts |
| Binder calls on the main thread | 2.8% | various | — |
| Panel blur | 0.6% CPU, plus GPU | SecPanelWindowBlurInteractor.getSemBlurInfoBuilder(int), SecQpBlurController.doBlur |
Optimises (radius scale) |
| Resource inflation (cold start) | 0.3% | — | — |
| QS tile state refresh | 0.2% | QSTileImpl.refreshState / handleUpdateState |
— |
Why tile tweaks alone don't help: tile state refresh and its binder calls were 0.2% of System UI's main-thread time while the shade moved. Debouncing them would only make tiles show stale state. The cost is in layout, the notification stack, Samsung's Compose QS, the media card, blur and, often, other modules.
Another module re-laying out the shade. With the shade closed, System UI re-laid out the
whole shade window about 1.2 times a second (about 18 ms each). The layout-request probe traced
it to a network-speed indicator from the OneUIX module (io.github.soclear.oneuix): every speed
update changes a status-bar TextView, and the change propagates a layout request up to the shade
root. ShadeSwitch can't fix another module's code, but the Hook Inspector names it (non-Samsung
code is labelled with its package). Check your own phone the same way.
Measured results (S23 Ultra, media playing):
| Measurement | Stock | ShadeSwitch | Change |
|---|---|---|---|
Colourful wave onDraw, mean / p95 |
182 / 499 µs | 104 / 178 µs | −43% / −64% |
| Panel blur radius on expand | 250 | 125 (Maximum smoothness) | −50% |
| Missed vsyncs on System UI's UI thread while the shade moves | 13.9% | 10.1–11.1% | fewer |
| UI-thread frame interval p95 | 18.9 ms | 16.7 ms | −12% |
Whole pipeline (gfxinfo janky frames, 15 pulls) |
14.48% | 14.75% | within noise (no gain) |
Treat this as "less work", not "lag fixed". Results depend on the phone, firmware, media app, wallpaper and other modules. Measure with the built-in benchmark.
- Status banner: Active, Partially active, System UI restart required or Not active. It is built from the LSPosed framework (enabled, scope, whether System UI runs this build) and a report System UI sends after installing its hooks. On a rooted phone the banner offers to restart System UI when needed and asks first.
- Presets. Each card lists what changes and the trade-off.
| Preset | Wave step (legacy / colourful) | Panel blur | Colour cache | Trade-off |
|---|---|---|---|---|
| Balanced (default) | 10 / 8 | Samsung's | on | Wave slightly less detailed up close |
| Maximum smoothness | 16 / 8 | 50% of Samsung's radius | on | Wallpaper behind the panel looks less blurred |
| Battery + performance | 20 / 8 | 25% | on | Busy wallpapers show through more |
| Stock / Off | 2 / 2 (Samsung's) | Samsung's | off | Stock performance. Hooks stay loaded, so switching back needs no restart. |
- Run Quick Health Check: pings System UI, times the round trip, confirms System UI runs this build with the app's current settings, and lists pass / warn / fail for each module. Copy the result to share it.
- This phone: model, Android, One UI, firmware, System UI version, framework.
Any change here switches the preset label to Custom. Picking a preset updates every control.
| Control | Range | Effect |
|---|---|---|
| Master switch | on / off | All optimisations on or off, live |
| Media wave sampling | on / off | Raises stepX of the legacy and colourful wave renderers. Values Samsung already set higher are kept; switching off restores originals on live instances. |
| Legacy wave step | 2–32 (stock 2) | Points sampled every N px on the older renderer |
| Colourful wave step | 1–8 (stock 2) | System UI clamps this renderer at 8 |
| Panel blur radius | on / off, 0–100% in 5% steps | Scales the quick panel window blur radius from the next expansion. A radius of 0 (blur blocked, e.g. power saving) is left alone. |
| Album-art colour cache | on / off | Reuses the extracted palette while the artwork bitmap is unchanged (weak, identity-keyed). Switching off clears the cache. |
| Profiling probes | on / off | Attaches the measuring hooks; removes them when off |
| Verbose logging | on / off, per module | Debug lines for the ticked modules (none ticked = all) |
- Benchmark (guided before/after): play media, then follow the prompts. Pull the shade fully down
and up a set number of times with optimisations off, then on; the app switches settings between
steps and restores yours at the end. Shows UI-thread frame pacing while the
shade moves: missed vsyncs, frame interval, frame start delay and first-frame delay (cold and
warm), with the change between them. It also shows per-method timings off vs on: wave draw,
shade traversal, notification stack, QS expansion, blur animation and colour extraction.
It measures System UI's UI thread, not GPU time. Use
scripts/qs-bench.sh comparefor gfxinfo. - Hook Inspector: every hook grouped by module, with its
Class.method, status (attached / not on this build / failed / waiting), calls, changes and errors, plus the live blur radius, colour-cache hit rate, hidden-shade relayouts per second and who requested them. - Logs: System UI-side module log (also mirrored to the LSPosed log) with a full viewer, Copy, Export (share sheet) and reset counters.
- Root with an LSPosed implementation that supports libxposed API 102 (tested: Vector 2.2 on KernelSU + Zygisk Next).
- Download
ShadeSwitch-v1.0.0.apkfrom Releases and check its SHA-256. - Install it, then in your LSPosed manager enable ShadeSwitch and make sure the scope is System UI (com.android.systemui).
- Restart System UI (reboot, or
adb shell su -c killall com.android.systemui). - Open ShadeSwitch. The banner should say Active. Tap Run Quick Health Check.
- Play media and pull down Quick Settings once so the wave hooks see a player.
Updating: install the new APK over the old one, then restart System UI. The banner says System UI restart required until you do.
| Verified | Galaxy S23 Ultra (SM-S918U1), One UI 9.0, Android 17, System UI 17 (37). Hook targets also checked against a second One UI 9 System UI 17 region build. |
| Expected | Other Samsung devices on One UI 9 with the same System UI classes |
| Unknown | One UI 6–8 and future builds: classes may be renamed. The Hook Inspector shows which hooks resolve. Unresolved hooks are skipped, never forced. |
| Framework | libxposed API 102 (Vector / LSPosed builds that support it). Legacy Xposed API is not supported. |
Safe fallbacks: every hook resolves its whole class/method/field contract before attaching and refuses ambiguous overloads, so a mismatch on a new firmware leaves that part of System UI stock. Interceptor bodies catch their own errors, the module runs in protective exception mode, and no IPC blocks System UI's main thread.
| Symptom | Fix |
|---|---|
| Framework connected fails | Enable the module in your LSPosed manager and make sure it supports API 102 |
| System UI not in scope | Tick System UI in the module's scope, then restart System UI |
| System UI restart required | System UI started before the module was enabled or updated: restart it (banner button on rooted phones) |
| A module shows not on this build | Your System UI renamed that class. Open an issue with the exported log. |
| Waiting for a media player | Play media and open Quick Settings once |
| Shade still stutters | Turn on profiling, pull the shade a few times, and read Layout requests in the Hook Inspector to find which other module re-lays out the shade |
To report a problem: Advanced → Logs → Export, plus the Quick Health Check (Copy), in a bug report.
Rollback: pick Stock / Off (live), or disable the module in LSPosed and restart System UI.
scripts/qs-bench.sh status # same checklist as the app
scripts/qs-bench.sh preset smooth # stock | balanced | smooth | battery
scripts/qs-bench.sh set blur_scale=50 # any config key, see the script header
scripts/qs-bench.sh logs
scripts/qs-bench.sh reset # clear counters and timings
scripts/qs-bench.sh compare 20 # expand/collapse QS 20x with the module OFF then ON; System UI gfxinfoThe provider answers only shell, root and the app itself. Status reports are accepted only from System UI's UID.
JDK 17+ (CI: 21), Android SDK platform 37, build-tools 37.0.0. AGP 9.5.3, Gradle 9.9.3 (checksum-pinned).
./gradlew :app:testDebugUnitTest :app:lintDebug :app:lintRelease :app:assembleDebug :app:assembleRelease
python3 scripts/verify-apks.py app/build/outputs/apk/debug/app-debug.apk <signed-release.apk>CI runs the same checks on every push. With KEYSTORE_BASE64 and KEYSTORE_PASSWORD repository
secrets (optionally KEYSTORE_ALIAS, KEY_PASSWORD) it signs both APKs. Without them it
uploads them unsigned. Architecture and project rules: CLAUDE.md. Hook target
evidence: docs/ONEUI9-ANALYSIS.md. Contributing: CONTRIBUTING.md.
Apache License 2.0. See LICENSE and NOTICE. Not affiliated with Samsung.
The Java package name com.samsung.music.qs.lagfix is inherited from the upstream project and
kept so existing installs update in place.