Skip to content

Commit

Permalink
FIX: Avoid cases on Android where keys can get stuck set as pressed (…
Browse files Browse the repository at this point in the history
…ISXB-475). (#1896)
  • Loading branch information
graham-huws authored Apr 10, 2024
1 parent f769315 commit a064203
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ however, it has to be formatted properly to pass verification tests.
## [Unreleased] - YYYY-MM-DD

### Fixed
- 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).
- 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).

## [1.8.1] - 2024-03-14
Expand Down
8 changes: 8 additions & 0 deletions Packages/com.unity.inputsystem/InputSystem/InputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3343,6 +3343,14 @@ private unsafe void OnUpdate(InputUpdateType updateType, ref InputEventBuffer ev
{
#if UNITY_EDITOR
m_Diagnostics?.OnEventTimestampOutdated(new InputEventPtr(currentEventReadPtr), device);
#elif UNITY_ANDROID
// Android keyboards can send events out of order: Holding down a key will send multiple
// presses after a short time, like on most platforms. Unfortunately, on Android, the
// last of these "presses" can be timestamped to be after the event of the key release.
// If that happens, we'd skip the keyUp here, and the device state will have the key
// "stuck" pressed. So, special case here to not skip keyboard events on Android. ISXB-475
// N.B. Android seems to have similar issues with touch input (OnStateEvent, Touchscreen.cs)
if (!(device is Keyboard))
#endif
break;
}
Expand Down

0 comments on commit a064203

Please sign in to comment.