Files
statusbartweak/README.md
T

161 lines
8.5 KiB
Markdown

# StatusBarTweak
StatusBarTweak is an Xposed/LSPosed module originally built for Samsung
SystemUI. It focuses on making the status bar, lockscreen, and Always On
Display more configurable while still keeping the system's own icons and visual
style where possible.
The project is physically tested only on a Samsung Galaxy Z Fold5 running One UI
8.0 / Android 16. Other SystemUI builds have emulator-tested support as shown
in the compatibility matrix.
## AI Assistance
This project was developed with help from AI-assisted coding tools. The design
decisions, physical device testing, and final behaviour are still manually reviewed.
## What It Does
- Custom status bar layout for the unlocked screen, lockscreen, and AOD where
supported by the SystemUI build.
- Independent placement of clock, carrier text, notification icons, status
icons, and Samsung status chips.
- Separate notification display handling for Samsung's cards, icons, and dot
modes.
- Configurable icon sizes, vertical offsets, ordering, spacing, truncation, and
cutout handling.
- Hide selected notification icons by app, separately for AOD, lockscreen, and
unlocked mode.
- Hide selected status icons such as NFC, Bluetooth, hotspot, location, VPN,
battery, and similar SystemUI indicators.
- Optional custom clock text with multi-line formatting, colours, font families,
and cutout-aware split alignment.
- Battery bar with configurable position, alignment, thickness, colours, and
threshold colours.
- Controls for Samsung status chips such as media, navigation, and call chips.
- Debug tools for generating test notifications, visualizing layout containers,
and restarting SystemUI during development.
## Custom Clock Text
The custom clock uses Java-style date/time patterns such as `HH:mm`,
`EEE d MMM HH:mm`, or `HH:mm:ss`.
It also supports lightweight markup:
- HTML-like tags: `<i>`, `<u>`, `<small>`, `<big>`, and `<font ...>`.
- Shorthand blocks such as `{#FA0 big @sans-serif-condensed}HH:mm`.
- Multi-line text using `\n` or `{\\n12}`; numbered line breaks use statusbar units.
- Pipe alignment with `|`, useful for aligning split clock rows around a camera
cutout.
- Colour variants and reverse Polish notation colour math for light/dark status
bar states, for example `color(#batterybar 1.2 *RGB ; #batterybar 0.5 *RGB)`, which uses the batterybar's dynamic colour as its base. For the bright tint, it brightens it up some more, while for the dark tint, it is darkened.
The in-app clock page has the full syntax help and examples.
## Requirements
- A rooted Android 14+ device or emulator. Actual feature support depends on
the SystemUI implementation; see the compatibility matrix.
- A modern Xposed implementation such as LSPosed or another libxposed-compatible runtime.
- Xposed API 101 or newer.
- SystemUI access for the module scope.
The module is developed and manually tested on a Samsung Galaxy Z Fold5 running
One UI 8.0 / Android 16. Non-Samsung builds have emulator-tested support as
shown below, but hardware-dependent behavior remains experimental unless it has
also been verified on physical hardware.
## Device Compatibility
Some behavior cannot be fully verified on emulators. Emulator testing can still
verify whether hooks load, whether SystemUI stays stable, whether settings apply,
whether excessive background work appears in logs, and whether the steady state
looks the way it should.
`⚠️ Experimental` means best-effort support exists, but the emulator cannot
expose the required hardware or state for real verification.
| Feature | Galaxy Z Fold5<br>One UI 8 / Android 16 | AOSP API 34<br>Android 14 | AOSP API 35<br>Android 15 | AOSP API 36<br>Android 16 | Google APIs API 35<br>Android 15 | Google APIs API 36<br>Android 16 | LineageOS 22<br>Android 15 | LineageOS 23<br>Android 16 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Module loads in SystemUI | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Settings app opens and writes settings | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Custom unlocked statusbar layout | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Custom lockscreen statusbar layout | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Custom AOD statusbar layout | ✅ | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental |
| Notification icons mode | ✅ | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental |
| Notification cards mode | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Notification dot mode and read-state behavior | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Hide notification icons by app | ✅ | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental |
| Hide status icons | ✅ | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental | ✅ AOD experimental |
| Dual-SIM status icon handling | ✅ | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental |
| Samsung status chips: media/navigation/call | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Samsung charging chip handling | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Privacy indicator stability | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Custom statusbar clock text | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Custom drawer clock/date text | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Stored clock pattern previews | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Battery bar: base statusbar modes | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Battery bar: fullscreen and transparent statusbar modes | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Battery bar: curved top-edge geometry | ✅ | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental |
| Battery bar threshold colours and colour math | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Camera cutout and under-display-camera handling | ✅ | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental | ⚠️ Experimental |
| Rotation and fold/unfold handling | ✅ | ✅ rotation verified | ✅ rotation verified | ✅ rotation verified | ✅ rotation verified | ✅ rotation verified | ✅ rotation verified | ✅ rotation verified |
| Drawer scrolling and background-work performance | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Debug visualizers and debug notifications | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Current emulator targets use rooted LSPosed snapshots. They are useful for
compatibility work, but hardware-specific entries remain marked as experimental
when the emulator cannot expose the required state.
## Build
The project is a standard Gradle Android project:
```bash
./gradlew assembleDebug
```
Release builds require local signing configuration:
```bash
./gradlew assembleRelease
```
## Test Harness
The repository also includes a small companion app for compatibility testing.
It is not required for normal use of the module. It creates repeatable
statusbar scenarios such as opaque, transparent, fullscreen, privacy-indicator,
and notification states:
```bash
./gradlew :test-harness:assembleDebug
adb install -r test-harness/build/outputs/apk/debug/test-harness-debug.apk
adb shell am start -n se.ajpanton.statusbartweak.harness/.MainActivity
```
Automation can launch scenarios directly:
```bash
adb shell am start -n se.ajpanton.statusbartweak.harness/.ScenarioActivity --es scenario fullscreen_landscape
adb shell am start -n se.ajpanton.statusbartweak.harness/.MainActivity --es command post_normal
```
Useful scenario values include `opaque_light`, `opaque_dark`, `transparent`,
`fullscreen_portrait`, `fullscreen_landscape`, `camera`, `microphone`, and
`camera_microphone`.
Useful command values include `post_normal`, `post_ongoing`, `post_grouped`,
`update`, `start_chronometer`, `start_churn`, `stop_churn`, `start_media`,
`start_foreground`, `stop_service`, and `clear`.
Battery charging state is controlled by Android system commands rather than by
the harness APK:
```bash
adb shell cmd battery set status 2
adb shell cmd battery set level 80
adb shell cmd battery reset
```