tags:

views:

110

answers:

0

My activity comes into play at screen off. I have logging for anytime it gains or lose focus. I have no indication that it has lost focus, however, I am seeing key events fall on the floor, and in the log the window manager reports- No focus window, dropping: KeyEvent (all the verbose details of what key it was).

This is only occasionally, so that is making it hard for me to pinpoint a cause. Because this is an event we expect to come in after an indefinite time asleep, I don't want to hold a partial wakelock. Most times everything works correctly.

Right after the failed key event, my activity does onResume and then the screen on broadcast comes in, and we are simply awake on the activity that's not normally supposed to be sitting on screen, because the key event fell on the floor.

I am trying to figure out why this happens even when at onCreate I use the TakeKeyEvents(true) which claims that it lets your activity get key events even when it is not the view with focus. I tried moving the command to onPause since issue seems to only appear when I am paused but I very quickly reduplicated the issue after trying that.

My source for this activity is here: http://code.google.com/p/mylockforandroid/source/browse/trunk/myLock/src/i4nc4mp/myLock/Lockscreen.java