Closed Bug 618352 Opened 14 years ago Closed 13 years ago

Shift and Fn keys not working on HTC Desire Z with hardware keyboard

Categories

(Firefox for Android Graveyard :: General, defect)

ARM
Android
defect
Not set
normal

Tracking

(fennec2.0+)

VERIFIED FIXED
fennec2.0b4
Tracking Status
fennec 2.0+ ---

People

(Reporter: tero.koskinen, Assigned: mwu)

References

Details

Attachments

(4 files, 2 obsolete files)

User-Agent:       Mozilla/5.0 (X11; U; OpenBSD amd64; en-US; rv:1.9.2.8) Gecko/20100810 Firefox/3.6.8
Build Identifier: Mozilla/5.0 (Android; Linux armv7l; rv:2. 0b8pre) Gecko/20101210 Firefox/4.0b8pre Fennec/4.0b3pre

On HTC Desire Z Shift and Fn keys are not working when the hardware keyboard is used.



Reproducible: Always

Steps to Reproduce:
1. Open hardware keyboard
2. Start Fennec
3. Open a new tab
4. Click on the address bar and try to type "ABOUT:CONFIG" using the hardware keyboard. Use Fn + . to get : character and Shift + letter to get uppercase character.


Actual Results:  
Text "about.config" is entered.

Expected Results:  
Text "ABOUT:CONFIG" is entered.


It does not matter do you type Fn and . at the same time or Fn first and then .

Shift and Fn work as expected if you first close the hardware keyboard and start typing with the virtual keyboard:
1. Close hardware keyboard
2. Tap on the address bar
3. Press Shift from the virtual keyboard
4. Press A from the virtual keyboard
5. Open the hardware keyboard (virtual keyboard disappears automatically)
6. Type BOUT:CONFIG normally. Shift and Fn work as expected!

The HTC Desire Z is the scandinavian (Finnish) model with åäö keys and Android 2.2.
tracking-fennec: --- → ?
OS: Linux → Android
Hardware: Other → ARM
confirmed with German HTC Desire Z, Android 2.2

Mozilla/5.0 (Android; Linux armv71; rv:2.0b8pre) Gecko/20101210 
Firefox/4.0b8pre Fennec/4.0b3pre
this is working for me on the droid 2
I can't reproduce this on a T-Mobile G2, which is a US version of the Desire Z.  Unlike the Desire Z, the G2 does not have the HTC Sense custom UI.  Possibly related to bug 618252, which involves another Sense device (HTC Incredible).
Also confirming with German HTC Desire Z (Android 2.2 + Firefox 4.0b2): FN + keys and SHIFT + keys don't work with hardware keyboard.
Assignee: nobody → blassey.bugs
tracking-fennec: ? → 2.0+
is anyone who is seeing this in Mountain View this week?
I did some debugging with the latest sources, here is a log snippet. It seems that Java code at least sees the Fn and Shift presses.
Attached patch Logging.Splinter Review
Here are my used logging statements. I tried turn on also logging in nsWindow.cpp, but I couldn't figure out how to enable it.
I wonder if the patch in bug 619519 will fix this...
Depends on: 619519
(In reply to comment #8)
> I wonder if the patch in bug 619519 will fix this...

Nope, it didn't fix this. Shift and Fn keys are still ignored.

However, I noticed that if I press Home and restart Fennec from the application list, the Shift and Fn keys are working:
0. Open hardware keyboard
1. Start Fennec
2. Click on the address bar
3. Try to type something (Shift and Fn not working)
4. Press Home button to get the default view
5. Start Fennec again (from the application list or from the recent list)
6. Continue typing without touching the screen, Shift and Fn work as expected

Shift and Fn stop working again, if I let the device go idle and the screen goes blank.

This sounds like some platform related issue, but on the other hand, Shift and Fn keys are working fine in other apps (the default browser on the device, ConnectBot from Android Market, etc.).
No longer depends on: 619519
Confirmed with HTC Desire Z, with latest Firefox Mobile available on the market.
Doesn't work either with 4.0b4 build of today.
This change fixes some possibly similar issues in the "connectbot" SSH app:

http://code.google.com/p/connectbot/issues/detail?id=396

https://github.com/iiuusit/connectbot/commit/fcf930ee87dfef5ad1819a3dfb601b14f06aec34

...but it looks like that bug was limited only to certain key combinations, rather than all shift/fn combos.  It also relies on setting a pref to enable the quirks for this specific device.  (Thanks to @bcpk on Twitter for the link.)
Bug confirmed with 4.0b3 from Market on Russian HTC Desire Z. Also can confirm that restarting procedure described by Tero Koskinen in comment #9 temporary helps.
Status: UNCONFIRMED → NEW
Ever confirmed: true
I noticed that the attached patch allows Fn and Shift keys to work on Desire Z. With the patch, upper case and special characters are correctly entered.

However, as a side-effect, long pressing keys no longer works (instead, the pressed key is repeated). There might be some other unwanted behaviour with the patch, I did only some light testing.

Note: I am not familiar with Android development, attached patch was just a lucky guess (after I did some debugging with jdb).
Assignee: blassey.bugs → mwu
(In reply to comment #15)
> Created attachment 502815 [details] [diff] [review]
> Work-around for Fn and Shift keys, long press is disabled as a side-effect
> 
Some ideas to try:

Does this continue to work if you make it:

if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU)
return super.onKeyPreIme(keyCode, event);

or


if (mIMEState != IME_STATE_DISABLED || keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU)
return false;
> Does this continue to work if you make it:
>
> if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU)
>     return super.onKeyPreIme(keyCode, event);

This allowed long press to work and fixed also the Shift and Fn keys. Thanks!
Patch attached.

> or
> 
> if (mIMEState != IME_STATE_DISABLED || keyCode == KeyEvent.KEYCODE_BACK ||
>   keyCode == KeyEvent.KEYCODE_MENU)
>     return false;

With this, Shift and Fn keys didn't work.
Attachment #502815 - Attachment is obsolete: true
Tero, can you check this patch and make sure it works for you? This basically the same patch, except we use isSystem() to check for back and menu and all other keys that the system should be responsible for handling. I had to sit and think for a while about whether getting rid of the mIMEState check is correct. Fairly convinced that it is now.
Attachment #506599 - Flags: review?
Attachment #506599 - Flags: feedback?
Attachment #506599 - Flags: review?(crowderbt)
Attachment #506599 - Flags: review?
Attachment #506599 - Flags: feedback?(tero.koskinen)
Attachment #506599 - Flags: feedback?
Comment on attachment 506599 [details] [diff] [review]
Handle all key events in onKeyPreIme when possible

The patch fixes the Shift and Fn keys. Long-press also works as expected. (This comment is written using the latest m-c + m-b + the patch on my Desire Z.)

For some reason (lacking some permission bits?), I couldn't give feedback+.
Not yet commited ?
Comment on attachment 506599 [details] [diff] [review]
Handle all key events in onKeyPreIme when possible

Might this fix bug 624334?
Attachment #506599 - Flags: review?(crowderbt) → review+
(In reply to comment #21)
> Comment on attachment 506599 [details] [diff] [review]
> Handle all key events in onKeyPreIme when possible
> 
> Might this fix bug 624334?

I wouldn't count on it, but I guess it's worth checking after this patch lands.
Attachment #506599 - Flags: feedback?(tero.koskinen)
Attachment #503051 - Attachment is obsolete: true
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/f1c061dec937
Status: NEW → RESOLVED
Closed: 13 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → fennec2.0b4
Verified using G2/Desire Z Mozilla/5.0 (Android; Linux armv7l; rv:2.0b13pre)
Gecko/20110315 Firefox/4.0b13pre Fennec/4.0b6pre ID:20110315035936
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: