Key Events receiver in Android Emulator

91 views
Skip to first unread message

Ashu

unread,
Dec 22, 2010, 11:47:36 AM12/22/10
to android-platform
Hi,

Suppose the screen of Android emulator is Locked, and User presses the
Menu key (F2) From keyboard to Unlock It. The screen will be unlocked
as F2 key is as good as pressing the menu on emulator skin.

My question is , which part of Android first receives this F2 Press
Key event? And which part of Android than performs the job of
unlocking the screen?

We want to invoke some native code in Android via Power manager
service using the key press.

For example, when user press ctrl+F9, I want to
invoke ,_my_function(), a native code written in C.
We have the JNI Interface already written, which will call this native
code from PM Service and the corresponding method in PM service as
well.

Also, what we want is no matter what application is running on
Emulator, this key press should work.

I already done the key mapping of Crtl+ F9 in QEMU code, so now I want
to know how this key will be identified in Android Framework.

I also checked the Blog post by Dianne Hackborn at
http://android-developers.blogspot.com/2009/12/back-and-other-hard-keys-three-stories.html.

But I am unable to use that information to implement the feature which
we want to implement.

Any comments?







Dianne Hackborn

unread,
Dec 22, 2010, 12:27:10 PM12/22/10
to android-...@googlegroups.com
Look at WindowManagerService and PhoneWindowManager.

What exactly you are going to do depends on exactly what you want -- if you want the key to execute regardless of whether the screen is on, you need to make it a wake key and then you can handle it in PhoneWindowManager or other parts of the low-level dispatching path.  If you want to do it only when the screen is on and the user is visible providing input to the lock screen you'll need to do it in the regular event dispatching views in the lock screen (sorry don't remember the class name for that but it is part of the policy implementation where PhoneWindowManager is).








--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.




--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

Reply all
Reply to author
Forward
0 new messages