(bug 48335) Use more generic approach to filter out non-character key presses.

Change-Id: Ie00becf1162f145134f006b0b4514ba874de9c43
Merge "(bug 48335) Use more generic approach to filter out non-character key presses."