A modified fork of cybr47/ShadeSwitch, which is based on Samsung QS Lag Fix. The original idea and base implementation, raising the media wave's
stepXinMultiWaveAreaTrackRenderer, are theirs. See Credits and upstream attribution for what this fork changed.Built for One UI 9 (Android 17 / API 37) on Samsung Galaxy phones and tablets. Physically tested on a Galaxy S23 Ultra.
Disclaimer: use at your own risk. Rooting, unlocking the bootloader and running Xposed modules already carry risk. I'm not responsible for bricked devices, boot loops, data loss, voided warranties, tripped Knox or any other damage. Back up before installing. ShadeSwitch is provided "as is", without warranty, under the Apache License 2.0.
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, a media-wave frame-rate cap, album-art colour caching, panel blur radius and System UI animation speed.
- Probes that only measure the shade (frame pacing, layout passes, tile refresh and tile-service binding, who keeps re-laying out the shade), attached only while profiling is on.
- Root tools (optional): check System UI's AOT compile state and low-memory protection, and
compile it with
speed(with a one-tap revert). - Basic mode with five presets and a one-tap Quick Health Check. Advanced mode groups every item of the seven-layer audit into collapsible sections with search, per-section reset, a Hook Inspector, a before/after benchmark and exportable logs.
Primary test device: Galaxy S23 Ultra (SM-S918U1), One UI 9.0, Android 17. Other One UI 9 devices are supported through the same System UI classes plus a structural fallback (below); reports from other models are very welcome.
| Project | Credit |
|---|---|
| Samsung QS Lag Fix (originally for UN1CA) | The original optimisation: raise stepX in Samsung's MultiWaveAreaTrackRenderer so the media wave samples fewer points per frame |
| cybr47/ShadeSwitch by cybr47 (direct upstream of this fork) | ShadeSwitch's base implementation: the move to libxposed API 102, One UI 9 colourful-wave support, CI and packaging |
| This fork (supermegadude/ShadeSwitch) | Rebuilt as independent hook modules; added the wave frame-rate cap, panel blur, animation speed and album-art colour optimisations, the seven-layer audit, root AOT tools, structural hook resolution for One UI 9 builds, profiling probes, the companion app (presets, Quick Health Check, benchmark, Hook Inspector, logs), and the research below |
All three are Apache License 2.0. Upstream's NOTICE is kept unchanged, with this fork's modification notice added. The app's About and credits card links to all three.
Honest expectations: on the S23 Ultra the module measurably reduces the work it targets (each wave draw −34…−43%, half as many wave draws with the 60 fps cap, 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.
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% |
| Wave renderer draws in 8 s with Quick Settings open (120 Hz) | 1228 | 611 at 60 fps, 300 at 30 fps | −50% / −75% |
| System UI animator duration scale (system setting 0.5) | 0.5 | 0.375 at 75% | −25% animation time |
| Panel blur radius on expand | 250 | 125 (Ultra performance) | −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.
Every mechanism that could plausibly cut Quick Settings work was looked at on the S23 Ultra
(One UI 9.0, System UI 17): in the device's System UI and framework dex, with stack samples, and with
the module's own probes. Each one is either optimised, measured (a probe, no behaviour change),
a root tool / status row, or not offered with the reason. The same list, with technical
details and evidence, is in the app (Advanced) and in core/OptimizationCatalog.java.
| Layer | Item | ShadeSwitch | Impact | Visible change | Why / evidence (S23U) |
|---|---|---|---|---|---|
| 1 Media | Wave sampling (stepX) |
Optimises | Medium | None | Each wave draw −34…−43% mean, −39…−64% p95 |
| 1 Media | Wave frame-rate cap (60/40/30/20 fps) | Optimises | Medium | Minimal | Samsung's renderer runs 50% (60 fps) / 75% (30 fps) less often; in-between frames replay the last recording |
| 1 Media | Album-art colour cache | Optimises | Subtle | None | Colour extraction was 0.4% of main-thread samples |
| 1 Media | Album-art decode / Palette throttling | Not offered | — | — | Decoding runs on background executors; nothing on the frame path |
| 2 Blur | Panel blur radius | Optimises | Medium | Noticeable | Radius 250 → 125 at 50%; GPU / SurfaceFlinger cost scales with radius |
| 2 Blur | Blur downsampling | Not offered | — | — | setCanvasScale applies only to canvas blur; the panel uses window blur (Builder(0)) |
| 2 Blur | Static scrim while dragging | Not offered | — | — | The blur would jump at the end of a drag; 0% blur gives a plain scrim instead |
| 3 Tiles | Tile state refresh | Measures | — | — | 132 refreshes in 3 pulls, mean 0.46 ms, p95 1.3 ms, on the tiles' background looper |
| 3 Tiles | Tile service binding | Measures | — | — | 2 binds in 3 pulls, ~8 µs each |
| 3 Tiles | Tile cache TTL / debounce | Not offered | — | — | 0.2% of main-thread time; would show toggles in a stale state |
| 4 Views | Layout cascade tracing | Measures | — | — | Found another module re-laying out the closed shade ~1.2×/s (~18 ms each) |
| 4 Views | Hardware layers | Not offered | — | — | The panel already reuses display lists; the media card redraws every frame, so a layer adds a pass |
| 4 Views | Skipping measure / layout passes | Not offered | — | — | Leaves half-drawn or stuck panels |
| 4 Views | Hiding footer / panel elements | Not offered | — | — | Changes the panel; QuickStar (Good Lock) does this safely |
| 5 Animation | System UI animation speed (50–100%) | Optimises | Medium | Noticeable | Process-local: 75% turns the system's 0.5 scale into 0.375 for System UI only |
| 5 Animation | Shade frame pacing | Measures | — | — | Missed vsyncs 13.9% → 10.1–11.1% (Stock vs Smooth) |
| 6 Samsung | Good Lock / QuickStar / Theme Park | Status | — | — | Detected and shown, since they change the panel too |
| 6 Samsung | Dynamic colour (Monet) caching | Not offered | — | — | Computed on wallpaper / theme change, not per pull |
| 7 System (root) | AOT compile speed / revert |
Root tool | Subtle | None | Stock is speed-profile; hooks keep working under speed (checked) |
| 7 System (root) | Low-memory protection | Status | — | — | oom_score_adj −800 (persistent process): nothing to improve |
| 7 System (root) | Raising priority / cgroups | Not offered | — | — | ActivityManager already moves System UI between cpusets and would overwrite it |
| 7 System | HWUI renderer properties | Status | — | — | skiavk; read at startup, wrong values can break drawing |
Root, not Shizuku. Every LSPosed / Vector install already has root, and Shizuku's shell identity
can't read System UI's process files, so the Layer 7 tools use su only and ask before running.
What was learned along the way:
- One UI 9's colourful wave redraws itself every frame from two places:
WaveSeekbar's Choreographer callback, andMultiWaveAreaTrackRenderer.onDraw, which invalidates again while its spring moves. Gating only the callback changed nothing; the cap therefore wraps the draw itself and replays a recordedRenderNodeon the in-between frames. Phase is time-based, so the motion keeps its speed at a lower frame rate. - System UI makes up to ~2,200 view invalidations a second under load, so the module never hooks invalidation globally.
SecSeekBarObserver.onChanged(the media seek bar position) runs about 12 times a second at about 0.7 ms each; it updates the position and is left alone.
- 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) | Wave fps | Panel blur | Animations | Colour cache | Trade-off |
|---|---|---|---|---|---|---|
| Zero visual loss | 10 / 8 | Samsung's (every frame) | Samsung's | Samsung's | on | None visible |
| Balanced (default) | 10 / 8 | 60 | Samsung's | Samsung's | on | On 120 Hz the wave moves at 60 fps; the panel still runs at full rate |
| Ultra performance | 16 / 8 | 60 | 50% of Samsung's radius | 75% of the time | on | Less blur behind the panel, visibly quicker animations |
| Battery + smooth | 20 / 8 | 30 | 25% | 85% | on | The wave moves less fluidly; busy wallpapers show through more |
| Stock / Off | 2 / 2 (Samsung's) | Samsung's | Samsung's | Samsung's | off | Stock performance. Hooks stay loaded, so switching back needs no restart. |
Coming from 1.0: settings saved from 1.0's Maximum smoothness now show as Custom, because the presets gained the wave cap and animation speed. Pick a preset again to update them.
- 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 per layer (L1 media …
L7 system). Layer 6 lists Good Lock / QuickStar / Theme Park and overlays on System UI. Layer 7
shows System UI's AOT state (
speed-profilevsspeed, orverifyif it isn't compiled) and low-memory protection after a root check. Copy the result to share it. - This phone: model, Android, One UI, firmware, System UI version, framework.
Items are grouped by audit layer in collapsible sections (open state is remembered), with a search box (matches titles, descriptions and technical details), Expand all / Collapse all, Reset all to Balanced and a Reset category to default button per layer. Every item shows its kind, impact and visible-change badges, a plain description and a Technical details toggle with the evidence. 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 |
| Wave frame-rate cap | Samsung's, 60, 40, 30, 20 fps | One UI 9 colourful wave only. In-between frames replay the last recorded drawing; touch, scrolling and the panel keep the full refresh rate |
| 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. |
| Animation speed | 50–100% (stock 100) | Multiplies the animator duration scale inside System UI only; the global setting is untouched. 0 (animations off) stays 0 |
| AOT compile (root) | Check / Compile (speed) / Revert | Runs cmd package compile -m speed (or speed-profile to revert) for System UI after a confirmation, then offers a System UI restart |
| 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.
Disclaimer: use at your own risk. Rooting, unlocking the bootloader and running Xposed modules already carry risk. I'm not responsible for bricked devices, boot loops, data loss, voided warranties, tripped Knox or any other damage. Back up before installing. ShadeSwitch is provided "as is", without warranty, under the Apache License 2.0.
- Root with an LSPosed implementation that supports libxposed API 102 (tested: Vector 2.2 on KernelSU + Zygisk Next).
- Download the latest
ShadeSwitch-v*.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.
Physical testing was done on a Samsung Galaxy S23 Ultra (SM-S918U1, One UI 9.0, Android 17, System UI 17). Support for other One UI 9 Galaxy devices comes from analysis of the One UI 9 System UI dex plus defensive, structure-based hooking. It has not been run on those devices yet, so please send the Quick Health Check and exported log from yours.
| Tested on hardware | Galaxy S23 Ultra, One UI 9.0 / Android 17 (API 37) |
| Designed for | Galaxy phones and tablets on One UI 9 (Android 17): S26 / S25 / S24 / S23 series, Z Fold / Z Flip, A series, Tab S series. They share System UI's class names on a given One UI release. |
| Older / newer | One UI 8 and earlier, or later releases: untested. Hooks that resolve are used, the rest are skipped. The health check labels the platform. |
| Framework | libxposed API 102 (Vector / LSPosed builds that support it). Legacy Xposed API is not supported. |
How hooks find their targets on other devices:
- Known class names verified in the One UI 9 System UI dex (instant, the normal case).
- If a build moved a class, a structural scan of System UI's own dex files finds the class with exactly the fields and method signatures the hook uses. It runs once on a background thread (≈0.2 s on the S23 Ultra), is cached until the next firmware update, and refuses ambiguous matches.
- Anything still missing is skipped and shown as not on this build. Nothing is forced.
Android 17 rules respected:
- No static field is ever written; Android 17 makes static finals unmodifiable.
- Only instance
stepXfields are written. If a future release blocks those, the module stops writing and reports it. - No
MessageQueueinternals are touched, and nothing blocks System UI's main thread. - The app targets API 37.
Safe fallbacks: every hook resolves its whole class/method/field contract before attaching and refuses ambiguous overloads, interceptor bodies catch their own errors, and the module runs in protective exception mode, so a mismatch leaves that part of System UI stock.
| 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 | zero_loss | balanced | smooth | battery
scripts/qs-bench.sh set blur_scale=50 # any config key, see the script header (wave_fps=30, anim_scale=75 …)
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. This is a modified fork of
cybr47/ShadeSwitch by cybr47, based on
Samsung QS Lag Fix, whose
stepX optimisation it builds on. 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.