You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BT keyboard repeats one character continuously #77
When I tried to input a password with a length of equal to 14 symbols or more, the last (sometime the 14-th) character repeats until I turn off BT or try to input something else.
Application version: 0.5.0
Android version: 12
Host: Windows 11 24H2
I have the same problem, sometimes the last character repeats. Also I did this:
Open a text editor
Type a long (>100 chars) password several times
If you look close, some characters may be missing at random, specially the more chars that are typed. I think that the PC cannot receive all characters successfully, causing the repeating last character and/or missing characters.
If so, I think a quick fix would be to add a delay between characters sent. It would be better if the delay is customizable in settings to everybody can adjust to their bluetooth devices.
My knowledge of Java, Bluetooth and Android is limited, I looked at the code and I think the delay should be inside this, but I'm not sure. Even if I tried to modify it I wouldn't know how to compile.
Hopefully somebody else will do it, if so I'll gladly test the app for them.
Application version: 0.5.0
Android version: 13
Host: Linux Mint 21
Auto-Type over Bluetooth leaves the last key stuck on longer passwords
When I auto-type a password that's around 14 characters or longer, the last character often gets
stuck down on the PC and repeats until I type something else. Short passwords are fine.
I had a dig through the code. In HidDeviceController.sendToKeyboardHost() the key-down and
key-up reports go out one after another with no gap at all, and HidDeviceApp.sendScancode()
throws away whatever sendReport() returns.
sendReport() doesn't queue anything. If the channel is busy it drops the report and returns
false. A 14 character password is 28 reports fired back to back, so past a certain point they
start getting dropped. If the dropped one happens to be the key-up, the PC still thinks the key
is held and its own key repeat kicks in. That matches what I was seeing, including why it stops
as soon as anything else gets typed.
The clean() call is doing the right thing, it just has no way to find out it failed.
What I changed:
Put a 12ms gap between reports. I picked that because the QoS in Constants.java already
says 800 bytes/s with a 9 byte bucket, and a report is 9 bytes, so it works out to about
11.25ms per report. The code was sending with no gap at all.
Actually check what sendReport() returns and retry when it's false, with a few more retries
for key-up reports since that's the one that causes the stuck key.
Always finish with an all-zero report, plus a second one after a short delay just in case.
I also had to move the typing off the main thread. It was already running there with SystemClock.sleep() calls in it, so adding any delay would have frozen the UI.
Long passwords type fine now, including repeated characters and lots of capitals. No stuck keys
so far.
Two smaller things I noticed while in there: keyboardOutput in BluetoothForegroundService is
never cleared, so the password stays in memory and gets typed again if the same host reconnects.
And debug builds were logging every password character and its scancode in plain text in convertTextToScancode().
Separate issue: master doesn't run on Android 14
Probably worth its own ticket, but I couldn't test any of the above until I sorted these out.
Looks like targetSdk went to 34 without the migration.
Crashes on launch. FileTimeoutReceiver calls registerReceiver() with SCREEN_OFF plus the
app's own FILE_TIMEOUT action, and Android 14 wants RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED when the filter isn't system-only. otp/ScanActivity has the same
problem with its own action.
"Bluetooth Service is not available" on pairing. BluetoothForegroundService has no foregroundServiceType, so startForeground() throws MissingForegroundServiceTypeException
and the service dies every time it starts. connectedDevice is the right type for it.
Same error again on a fresh install even after granting the Bluetooth permission. PasswdSafe.onStart() only binds the service if the permission is already granted, but it's
first requested from BluetoothFragment, and nothing tells the activity to try again after
you grant it. So it stays broken until Android restarts the activity on its own.
Code
Both fixes are on a branch in my fork, as two separate commits so they can be taken
independently:
The HID commit adds 22 plain JUnit tests for the report sequencing, covering 5, 13, 14, 20 and
50 character passwords, repeated characters, case changes, symbols and shift-heavy strings, and
checking every sequence ends with all keys released. They run on the JVM, no device needed
(./gradlew testDebugUnitTest).
Tested on a vivo V2562 on Android , en_US layout, typing to a laptop. I've
only tried the one phone and the one host, so worth a second pair of eyes on the timing.
Happy to open a PR with either or both if you want them.
Hi — thanks for Authorizer. I've been using its Bluetooth auto-type as a hardware-key
replacement for a while.
It also fixes the Android 14 crashes (missing foregroundServiceType, and registerReceiver without an exported flag), moves auto-type off the main thread, and stops
the credential lingering on the heap and in debug logs. Happy to open it as a PR if you'd
like it.
Your files keep their original package and licence headers, and there's a LICENSES/BLUETOOTH-HID-PORT.md recording every change I made to them. Let me know if you'd
like the attribution done differently.
Activity
jralo7 commentedon Mar 11, 2025
I have the same problem, sometimes the last character repeats. Also I did this:
If you look close, some characters may be missing at random, specially the more chars that are typed. I think that the PC cannot receive all characters successfully, causing the repeating last character and/or missing characters.
If so, I think a quick fix would be to add a delay between characters sent. It would be better if the delay is customizable in settings to everybody can adjust to their bluetooth devices.
My knowledge of Java, Bluetooth and Android is limited, I looked at the code and I think the delay should be inside this, but I'm not sure. Even if I tried to modify it I wouldn't know how to compile.
Hopefully somebody else will do it, if so I'll gladly test the app for them.
Application version:
0.5.0Android version: 13
Host: Linux Mint 21
amitjaju82 commentedon Sep 1, 2026
i fixed the apk (removed)
It is signed with a debug license so you will have to install it fresh and cant update the developer version
tejado commentedon Sep 1, 2026
Can you provide more details about your fix? I don't feel comfortable that you provide "fixed" apks without any source to verify it.
amitjaju82 commentedon Sep 1, 2026
Auto-Type over Bluetooth leaves the last key stuck on longer passwords
When I auto-type a password that's around 14 characters or longer, the last character often gets
stuck down on the PC and repeats until I type something else. Short passwords are fine.
I had a dig through the code. In
HidDeviceController.sendToKeyboardHost()the key-down andkey-up reports go out one after another with no gap at all, and
HidDeviceApp.sendScancode()throws away whatever
sendReport()returns.sendReport()doesn't queue anything. If the channel is busy it drops the report and returnsfalse. A 14 character password is 28 reports fired back to back, so past a certain point they
start getting dropped. If the dropped one happens to be the key-up, the PC still thinks the key
is held and its own key repeat kicks in. That matches what I was seeing, including why it stops
as soon as anything else gets typed.
The
clean()call is doing the right thing, it just has no way to find out it failed.What I changed:
Constants.javaalreadysays 800 bytes/s with a 9 byte bucket, and a report is 9 bytes, so it works out to about
11.25ms per report. The code was sending with no gap at all.
sendReport()returns and retry when it's false, with a few more retriesfor key-up reports since that's the one that causes the stuck key.
I also had to move the typing off the main thread. It was already running there with
SystemClock.sleep()calls in it, so adding any delay would have frozen the UI.Long passwords type fine now, including repeated characters and lots of capitals. No stuck keys
so far.
Two smaller things I noticed while in there:
keyboardOutputinBluetoothForegroundServiceisnever cleared, so the password stays in memory and gets typed again if the same host reconnects.
And debug builds were logging every password character and its scancode in plain text in
convertTextToScancode().Separate issue: master doesn't run on Android 14
Probably worth its own ticket, but I couldn't test any of the above until I sorted these out.
Looks like
targetSdkwent to 34 without the migration.FileTimeoutReceivercallsregisterReceiver()withSCREEN_OFFplus theapp's own
FILE_TIMEOUTaction, and Android 14 wantsRECEIVER_EXPORTEDorRECEIVER_NOT_EXPORTEDwhen the filter isn't system-only.otp/ScanActivityhas the sameproblem with its own action.
BluetoothForegroundServicehas noforegroundServiceType, sostartForeground()throwsMissingForegroundServiceTypeExceptionand the service dies every time it starts.
connectedDeviceis the right type for it.PasswdSafe.onStart()only binds the service if the permission is already granted, but it'sfirst requested from
BluetoothFragment, and nothing tells the activity to try again afteryou grant it. So it stays broken until Android restarts the activity on its own.
Code
Both fixes are on a branch in my fork, as two separate commits so they can be taken
independently:
master...amitjaju82:Authorizer:bluetooth-hid-autotype-fixes
The HID commit adds 22 plain JUnit tests for the report sequencing, covering 5, 13, 14, 20 and
50 character passwords, repeated characters, case changes, symbols and shift-heavy strings, and
checking every sequence ends with all keys released. They run on the JVM, no device needed
(
./gradlew testDebugUnitTest).Tested on a vivo V2562 on Android , en_US layout, typing to a laptop. I've
only tried the one phone and the one host, so worth a second pair of eyes on the timing.
Happy to open a PR with either or both if you want them.
tejado commentedon Sep 1, 2026
Great, thank you @amitjaju82. I will look into it and will fix it.
As I'm currently in the middle of a large refactor of Authorizer, please don't open a PR for it yet.
amitjaju82 commentedon Sep 2, 2026
Hi — thanks for Authorizer. I've been using its Bluetooth auto-type as a hardware-key
replacement for a while.
It also fixes the Android 14 crashes (missing
foregroundServiceType, andregisterReceiverwithout an exported flag), moves auto-type off the main thread, and stopsthe credential lingering on the heap and in debug logs. Happy to open it as a PR if you'd
like it.
A heads-up. I've ported the HID transport and the layout tables into a KeePassDX fork,
so the same feature works with
.kdbxdatabases:https://github.com/amitjaju82/KeePassDX-bluetooth-keyboard
Your files keep their original package and licence headers, and there's a
LICENSES/BLUETOOTH-HID-PORT.mdrecording every change I made to them. Let me know if you'dlike the attribution done differently.