We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4892

Summary: Android backspace key not working on Pixel 3 native keyboard
Product: SDL Reporter: MatD <mat.draper>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: NEW --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sylvain.becker
Version: 2.0.8   
Hardware: ARM   
OS: Android (All)   

Description MatD 2019-12-09 16:10:34 UTC
We’re not getting any events from the backspace key on the Android soft keyboard, for quite a few newer Android devices (eg. Google Pixel 3).
Comment 1 Sylvain 2019-12-10 09:24:01 UTC
I'd say, put some trace in the SDLActivity.java file, in onBackPressed()
Comment 2 MatD 2019-12-10 11:32:19 UTC
Hi Sylvain, thanks for the quick reply.

I can confirm (from using breakpoints in SDLActivity.java) that...

On A Nexus 7 running Android 6.0.1, the soft-keyboard delete key triggers:

sendKeyEvent (line 1592) followed by
dispatchKeyEvent (line 375) followed by 
onKey (line 1537)

But on a Google Pixel 3a with Android 10, the delete key triggers sendKeyEvent then dispatchKeyEvent but *not* onKey.

Does this help?
Kind regards
-Mat
Comment 3 MatD 2019-12-10 12:12:30 UTC
(In reply to MatD from comment #2)
> Hi Sylvain, thanks for the quick reply.
> 
> I can confirm (from using breakpoints in SDLActivity.java) that...
> 
> On A Nexus 7 running Android 6.0.1, the soft-keyboard delete key triggers:
> 
> sendKeyEvent (line 1592) followed by
> dispatchKeyEvent (line 375) followed by 
> onKey (line 1537)
> 
> But on a Google Pixel 3a with Android 10, the delete key triggers
> sendKeyEvent then dispatchKeyEvent but *not* onKey.
> 
> Does this help?
> Kind regards
> -Mat


As a workaround, we have added the following to dispatchKeyEvent:

        if(keyCode == KeyEvent.KEYCODE_DEL)
        {
            if(event.getAction() == KeyEvent.ACTION_DOWN)
                SDLActivity.onNativeKeyDown(keyCode);
            else
                SDLActivity.onNativeKeyUp(keyCode);
        }
Comment 4 Sylvain 2019-12-10 12:50:33 UTC
Hi Mat, 

Not sure about the lines numbers. Which version is this ?
Anyway, I would advice to try the head SDL version!

There are two onKey() methods: the normal one, another one in DummyEdit, which is triggered if you make the soft keyboard appears with  SDL_StartTextInput();

On the pixel 3a, how the backspace behave compared to another key ?
Comment 5 Sylvain 2019-12-10 12:51:54 UTC
( I tried on a recent phone with android 10 and the soft-keyboard backspace appears in the onKey on DummyEdit )
Comment 6 MatD 2019-12-10 13:15:30 UTC
Thanks for trying that.

We are currently on 2.0.8, we will look at moving to the latest version.
Regards
-Mat
Comment 7 Sylvain 2019-12-19 13:07:15 UTC
maybe an issue with focus when hiddin the keyboard
see bug 4906
Comment 8 Sylvain 2020-10-07 07:10:22 UTC
Do you have more information ?