Skip to content

Commit a064203

Browse files
authored
FIX: Avoid cases on Android where keys can get stuck set as pressed (ISXB-475). (#1896)
1 parent f769315 commit a064203

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ however, it has to be formatted properly to pass verification tests.
1111
## [Unreleased] - YYYY-MM-DD
1212

1313
### Fixed
14+
- Physical keyboards used on Android/ChromeOS could have keys "stuck" reporting as pressed after a long press and release [ISXB-475](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-475).
1415
- NullReferenceException thrown when right-clicking an empty Action Map list in Input Actions Editor windows [ISXB-833](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-833).
1516

1617
## [1.8.1] - 2024-03-14

Packages/com.unity.inputsystem/InputSystem/InputManager.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3343,6 +3343,14 @@ private unsafe void OnUpdate(InputUpdateType updateType, ref InputEventBuffer ev
33433343
{
33443344
#if UNITY_EDITOR
33453345
m_Diagnostics?.OnEventTimestampOutdated(new InputEventPtr(currentEventReadPtr), device);
3346+
#elif UNITY_ANDROID
3347+
// Android keyboards can send events out of order: Holding down a key will send multiple
3348+
// presses after a short time, like on most platforms. Unfortunately, on Android, the
3349+
// last of these "presses" can be timestamped to be after the event of the key release.
3350+
// If that happens, we'd skip the keyUp here, and the device state will have the key
3351+
// "stuck" pressed. So, special case here to not skip keyboard events on Android. ISXB-475
3352+
// N.B. Android seems to have similar issues with touch input (OnStateEvent, Touchscreen.cs)
3353+
if (!(device is Keyboard))
33463354
#endif
33473355
break;
33483356
}

0 commit comments

Comments
 (0)