Thanks, I thought to look into AccessibilityManagerService, I just couldn't find anywhere where it was invoking the onKey/ onKeyEvent methods in the IAccessibility stubs. My issue isn't with receiving events, I get all events expected and am able to override their behaviors. I want to know where the KeyEvents are being passed to the AccessibilityService and if there's a way to receive these events while the screen is off.
On Sunday, July 13, 2014 11:21:54 AM UTC-5, Peter Teoh wrote: > > > > > On Sun, Jul 13, 2014 at 10:05 PM, Tom <[email protected] <javascript:>> > wrote: > >> Android API 18 introduced the onKey method AccessibilityService along >> with the necessary flags to enable filtering KeyEvents. What system >> service/ method deals with the delivery of these events, and *is it >> possible to register for key events when the screen is off*? >> >> I've noticed that hardware button events are not passed to >> AccessibilityService when the screen is off, which I'm guessing has to do >> with the dangers of overriding this behavior and preventing the device from >> unlocking. However, I'm interested in handling hardware buttons for the >> camera/ volume/ events other than the power button. Is this possible at >> present, or is such a feature being considered? If not, perhaps >> AccessibilityServiceInfo could include a list of KeyEvents the service >> wants to register for when the screen is off and have the service only send >> those? >> >> -- > > > > In framework/base/services/java/com/android/server/SystemServer.java: > > CountryDetectorService countryDetector = null; > TextServicesManagerService tsms = null; > > // Bring up services needed for UI. > if (factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) { > try { > Slog.i(TAG, "Input Method Service"); > imm = new InputMethodManagerService(context); > ServiceManager.addService(Context.INPUT_METHOD_SERVICE, > imm); > } catch (Throwable e) { > reportWtf("starting Input Manager Service", e); > } > > try { > Slog.i(TAG, "Accessibility Manager"); > ServiceManager.addService(Context.ACCESSIBILITY_SERVICE, > new AccessibilityManagerService(context)); > } catch (Throwable e) { > reportWtf("starting Accessibility Manager", e); > } > } > > try { > wm.displayReady(); > } catch (Throwable e) { > reportWtf("making display ready", e); > } > > > From above you can see that the AccessibilityManagerService comes in after > the InputMethod service is started. So my guess is that it should be > possible to register for the key event after that? Not sure. > > https://developer.android.com/training/keyboard-input/commands.html > http://stackoverflow.com/questions/5665832/android-register-keyboard-action > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

