How It Works • Requirements • Setup • Building • Architecture
Android app that enables shoulder triggers (SAR capacitive sensors) on Nubia Red Magic phones system-wide, without needing Game Space.
Nubia's game framework controls the shoulder trigger hardware. Triggers only work inside Game Space, and the system resets trigger settings every time you switch apps. RedTrigger fixes both issues.
- Sets
nubia_game_scene=1to activate SAR sensors without launching full Game Space - Runs a foreground service with a ContentObserver watchdog that detects when Nubia's SystemMgr resets the setting (on every
notifyActivityResumed) - Re-applies trigger settings instantly, keeping triggers active across all apps
The Nubia game service intercepts the raw trigger keys (F7/F8) and converts them to screen taps. RedTrigger works around this by:
- Reading raw input events from
/dev/input/eventXusing a Shizuku UserService (getevent) - Optionally injecting remapped key events (L1/R1) so apps like KeyMapper can capture them
- Using a virtual
uinputdevice for injection so events appear as real hardware input
- Nubia Red Magic phone (tested on Red Magic 11 Pro)
- Shizuku installed and running
- Install the APK
- Install and start Shizuku (wireless ADB or root)
- Open RedTrigger and grant Shizuku permission when prompted
- Tap "Enable Triggers"
RedTrigger automatically grants itself the required WRITE_SECURE_SETTINGS permission via Shizuku, so no manual ADB commands are needed.
The watchdog service starts automatically and persists across app switches. Enable "Auto-enable on boot" in the app to survive reboots.
Requires Android SDK and JDK 17.
# Using justfile (recommended)
just build # Build debug APK
just ship # Build + copy to shared storage
just version # Show current version
just bump-patch # 3.0.0 → 3.0.1
just bump-minor # 3.0.0 → 3.1.0
just clean # Clean build artifacts
# Or directly with Gradle
ANDROID_HOME=/path/to/android-sdk \
JAVA_HOME=/path/to/jdk-17 \
./gradlew assembleDebug --no-daemon --no-configuration-cacheAPK output: app/build/outputs/apk/debug/RedTrigger-v{version}.apk
| Component | Description |
|---|---|
TriggerManager |
Reads/writes Android Global Settings to enable/disable triggers |
TriggerService |
Foreground service with ContentObserver watchdog |
InputReader |
Manages Shizuku UserService lifecycle (app process) |
InputService |
Shizuku UserService that reads /dev/input/eventX (Shizuku process) |
uinput_injector |
Native C binary that creates a virtual gamepad via /dev/uinput |
BootReceiver |
Re-enables triggers on device boot |
DebugLog |
In-app log buffer with color-coded UI display |
Communication between the app process and Shizuku process uses AIDL:
IInputService.aidl— app → Shizuku (start/stop, config)ITriggerCallback.aidl— Shizuku → app (trigger events, debug)
The shoulder triggers appear as capacitive touch sensors:
- Left trigger (SAR0) →
KEY_F7 - Right trigger (SAR1) →
KEY_F8 - Device names contain
nubia_tgk_aw_sar
- Kotlin + Jetpack Compose
- Material 3
- Shizuku API
- Native C (uinput virtual gamepad)
- Android SDK 35 (min SDK 29)
MIT © Lucas Zampieri


