Skip to content

Repository files navigation

HyperOS Keyboard Gap Fix

Remove the black bar under the keyboard on HyperOS 3 / HyperOS 2 / MIUI — one ADB command, no root, fully reversible.

If you updated a Xiaomi, Redmi or POCO phone to HyperOS 3 and now every keyboard floats above a dead black strip, with an extra "down arrow" row wedged under Gboard, this repo fixes it in about thirty seconds.

Before                          After
┌─────────────────────┐         ┌─────────────────────┐
│  q w e r t y u i o p│         │  q w e r t y u i o p│
│   a s d f g h j k l │         │   a s d f g h j k l │
│  ⇧  z x c v b n m  ⌫│         │  ⇧  z x c v b n m  ⌫│
│ ?123  ,   ␣   .  ⏎  │         │ ?123  ,   ␣   .  ⏎  │
├─────────────────────┤         └─────────────────────┘
│         ⌄           │  ← the arrow row
│                     │  ← the reserved gap
└─────────────────────┘
  • Works on any Xiaomi / Redmi / POCO build that ships the gesture-line overlay
  • No root, no unlocked bootloader, no Magisk, no custom recovery, no factory reset
  • One write to the phone, and a revert that puts it back exactly
  • Detects first and refuses to touch devices the fix does not apply to

Quick start

Install Android platform-tools, enable USB debugging, plug the phone in, then:

Linux / macOS / Git Bash / WSL

git clone https://github.com/IRDcode/hyperos-keyboard-gap-fix.git
cd hyperos-keyboard-gap-fix
chmod +x fix-keyboard-gap.sh

./fix-keyboard-gap.sh          # look only — changes nothing
./fix-keyboard-gap.sh apply
./fix-keyboard-gap.sh verify

Windows PowerShell

git clone https://github.com/IRDcode/hyperos-keyboard-gap-fix.git
cd hyperos-keyboard-gap-fix

.\fix-keyboard-gap.ps1                    # look only — changes nothing
.\fix-keyboard-gap.ps1 -Action apply
.\fix-keyboard-gap.ps1 -Action verify

One-liner, no clone, if you just want the command

adb shell pm uninstall --user 0 com.android.systemui.gesture.line.overlay

Then do the phone-side step below. The scripts exist because that one line silently leaves your phone in 3-button mode, and because you should know whether your device is even affected before writing to it.

The phone-side step you must not skip

After apply, HyperOS drops to 3-button navigation. Fix it on the phone:

  1. Settings → Home screen → System navigation
  2. Pick Gestures again
  3. Turn Hide full screen indicator ON

Gestures come back, the gap does not. Verified on HyperOS 3 (Android 16). No reboot needed. If a keyboard still shows the gap, force-stop that keyboard app once so it re-measures its window.


Symptoms this fixes

Different people describe this bug differently — if any of these is you, you are in the right place:

  • Black bar / black strip under the keyboard after the HyperOS 3 update
  • Keyboard does not sit flush at the bottom edge; it floats with empty space below
  • An extra row with only a ⌄ down arrow appears under Gboard or SwiftKey
  • Gap between the keyboard and the bottom of the screen that no keyboard setting removes
  • Keyboard height looks wrong, keyboard "shifted up", wasted space at the bottom
  • The gap survives turning off Hide full screen indicator, changing keyboards, clearing keyboard data, and switching themes
  • Persian: نوار مشکی زیر کیبورد، فاصله‌ی اضافه پایین صفحه، دکمه‌ی فلش پایین زیر کیبورد

Not this repo's problem: a gap above the keyboard (that's the app's own layout), the navigation pill itself (that's Hide full screen indicator), or one-handed mode.


What actually causes it

HyperOS ships a runtime resource overlay called com.android.systemui.gesture.line.overlay at /product/overlay/GestureLineOverlay.apk. It targets the android framework package in category com.android.internal.navigation_bar_mode, and it wins with priority 2147483647 — it beats every AOSP navigation-bar overlay on the device.

Reading the live overlay map on a Xiaomi 13T (HyperOS 3, Android 16, API 36):

framework resource with overlay without overlay
bool/config_imeDrawsImeNavBar true false
integer/config_navBarInteractionMode 2 0
dimen/navigation_bar_frame_height 48dp 47.2dp
dimen/navigation_bar_height 16dp 47.2dp
dimen/config_backGestureInset 30dp 0dp

config_imeDrawsImeNavBar = true is the culprit. It tells every input method to draw its own navigation-bar row inside the keyboard window and reserve height for it. You can watch it exist and then stop existing:

# before
mNavigationBarController={mImeDrawsImeNavBar=true
  mNavigationBarFrame=NavigationBarFrame{... 0,0-1220,144} ...}

# after
mNavigationBarController={mImeDrawsImeNavBar=false
  mNavigationBarFrame=null ...}

144px at 3.0 density is 48dp of keyboard you were paying for and could not use. Removing the overlay for user 0 drops the resource back to the framework default, so the row is never built and the inset is never reserved.

Why gestures keep working afterwards: Xiaomi's gesture engine is not the AOSP one. It runs off global force_fsg_nav_bar and global hide_gesture_line, both independent of navigation_mode. On a fixed 13T, secure navigation_mode reads 0 (3-button, per the framework) while gestures work perfectly, because force_fsg_nav_bar=1 and MIUI's own fsgesture handles the swipes.


Why not just toggle Hide full screen indicator

That setting hides the white pill. It does not change config_imeDrawsImeNavBar, so the keyboard still builds the arrow row and still reserves the inset. The pill disappears, the gap stays. That is why people report turning it on and off with nothing happening.


Safety

This is a per-user package disable, which is the mildest write ADB offers.

  • Nothing is deleted. pm uninstall --user 0 flips install state for one Android user. The APK stays byte-identical in read-only /product/overlay — the script prints it as overlay APK on system: yes after the fix.
  • Bootloader stays locked, ro.boot.verifiedbootstate stays green, system partitions are untouched, SafetyNet / Play Integrity are unaffected.
  • No root needed. Plain shell uid 2000 is enough.
  • Fully reversible with revert, tested on a real device (see below).
  • Banking, DRM and Play Services behave exactly as before: no signature, no system property and no partition changed.

What it costs you: a factory reset or a full OTA that re-provisions user 0 will bring the overlay back, and you run apply again. That is the whole downside.

If you have a Second space or work profile, the fix applies per user. Run --user 999 (or whatever adb shell pm list users shows) for the other space.


Reverting

./fix-keyboard-gap.sh revert
# or
.\fix-keyboard-gap.ps1 -Action revert

This runs cmd package install-existing and re-arms the overlay with cmd overlay enable-exclusive. The second half matters: install-existing alone brings the package back disabled, which strands the phone in 3-button mode. Measured on a POCO X3 Pro — install-existing left navigation_mode=0 and overlay_enabled=false until the overlay was explicitly re-enabled, after which it read 2 / true again.


Command reference

Bash PowerShell
detect only (default) ./fix-keyboard-gap.sh .\fix-keyboard-gap.ps1
apply the fix ./fix-keyboard-gap.sh apply -Action apply
check the end state ./fix-keyboard-gap.sh verify -Action verify
undo ./fix-keyboard-gap.sh revert -Action revert
paste-into-an-issue dump ./fix-keyboard-gap.sh report -Action report
flag meaning
-s SERIAL / -Serial pick a device when several are attached
--user N / -UserId N target another Android user (Second space)
--json / -Json machine-readable output, no colour
--dry-run / -DryRun print the write command, do not run it
-y / -Yes skip the confirmation prompt

ADB=/path/to/adb overrides adb discovery. Both scripts search PATH, ANDROID_HOME, the standard SDK locations, and Xiaomi's bundled MiPhoneManager\main\adb.exe.

Verdicts

verdict meaning
affected config_imeDrawsImeNavBar is true. apply will help.
likely-affected A navigationBars inset or NavigationBar window is reserving space.
already-fixed Overlay already gone for this user.
not-affected Overlay present, but nothing is reserving bottom space.
not-applicable No gesture-line overlay in this build — not a Xiaomi ROM of this shape.

apply refuses outright on not-applicable, and warns loudly before continuing on not-affected.


Verified devices

device ROM Android verdict before result
Xiaomi 13T (2306EPN60G) HyperOS OS3.0.5.0.WMFMIXM 16 (API 36) affected fixed, gestures intact
POCO X3 Pro (M2102J20SG) MIUI V13.0.5.0.SJURUXM 12 (API 31) not-affected apply + revert cycle clean

The X3 Pro is there deliberately as the negative case: MIUI 13 has no config_imeDrawsImeNavBar at all, so there is no gap to remove and the script says so instead of writing to it. Both devices were also used to confirm revert restores the exact prior state.

Your device isn't listed? Run report and open a device report — it's a form, paste and go. That's the fastest way to make this table useful.


FAQ

Does this need root? No. Plain adb shell (uid 2000) is enough. No unlocked bootloader either.

Will it trip Play Integrity, SafetyNet, or my banking app? No. No partition, signature or system property changes. Bootloader stays locked and verified boot stays green.

Do I lose gesture navigation? No, but you must re-pick Gestures in Settings once, because HyperOS falls back to 3-button after the overlay disappears. Xiaomi's gesture engine (force_fsg_nav_bar) is independent of the framework's navigation_mode.

Do I need to reboot? No.

Will an OTA undo it? A full OTA or factory reset can. Re-run apply.

Does it survive a reboot? Yes. Per-user install state is persistent.

"USB debugging (Security settings)" — do I need it? Not on the builds tested here; pm uninstall --user 0 went through on plain USB debugging. If your ROM refuses with a SecurityException, the script tells you to enable it. That switch needs a signed-in Xiaomi account and in some regions a 24-hour wait plus an active SIM.

Does it work on a Second space / work profile? Yes, per user. Pass --user 999 (check adb shell pm list users).

Will it work on Samsung / OnePlus / Pixel? No. This overlay is Xiaomi-specific. The script reports not-applicable and does nothing.

Is it safe to just run the raw pm uninstall line? Technically yes — it is the same single command. You lose the pre-flight check, the rollback snapshot, and the reminder about re-picking Gestures.


How to check it yourself

Do not take any of this on trust; read the device:

# which overlay wins for the resource that causes the gap
adb shell cmd overlay lookup --verbose android android:bool/config_imeDrawsImeNavBar

# what the overlay actually overrides
adb shell cmd overlay dump com.android.systemui.gesture.line.overlay

# is space being reserved at the bottom right now
adb shell dumpsys window displays | grep navigationBars

# is the keyboard drawing its own nav row
adb shell dumpsys input_method | grep -i imeDrawsNavBar

Contributing

Device reports are the most useful contribution — especially any HyperOS 3 build where the verdict comes out wrong, or a China / carrier ROM that refuses the uninstall. Bug reports with the report output attached get looked at first.

License

MIT — see LICENSE.

Keywords

hyperos 3 keyboard gap, hyperos keyboard black bar, xiaomi keyboard gap fix, redmi keyboard bottom gap, poco keyboard black bar, hyperos 3 bottom black bar, gboard down arrow row xiaomi, gesture line overlay, GestureLineOverlay.apk, com.android.systemui.gesture.line.overlay, config_imeDrawsImeNavBar, hide full screen indicator not working, adb pm uninstall user 0 xiaomi, miui keyboard gap, hyperos navigation bar overlay, keyboard not flush bottom android, نوار مشکی زیر کیبورد شیائومی, رفع فاصله کیبورد هایپر او اس

About

Remove the black bar / reserved keyboard gap and the extra arrow row under Gboard on HyperOS 3 & MIUI (Xiaomi, Redmi, POCO). One ADB command, no root, fully reversible.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages