Fix issue where OnPreKeyEvent was cherry picked from a different branch, which had some WIP changes, fixed naming of `KeyType`