I want to reassign event, when user send KEYEVENT_SEARCH. Now it just start search activities in applications and if you press it second time - it doesn't do anything. I have to redefine the event so that the first click opens the search, and the next time it closes. Where can I find android push responses? I try edit it in frameworks/base/core/java/com/android/internal/policy/PhoneFallbackEventHandler.java
, but it doesn't works.
Asked
Active
Viewed 112 times
1

Ayaz Hadoken
- 11
- 1
1 Answers
0
Android keys are processed in the following sequence:
- PhoneWindowManager:
- interceptKeyBeforeQueueing
- interceptKeyBeforeDispatching
- Activity: onKeyDown/onKeyUp. App can override the function to handle keys.
- PhoneFallbackEventHandler: onKeyDown/onKeyUp
Currently, the search key is handled in 2. When handling search key in onKeyUp, firstly check whether the search dialog is launched, then choose to startSearch or closeSearch.

Yong
- 1,529
- 12
- 21
-
Way 2 does not fit. I cannot change the code of every application. I need to make a default reaction for all applications at once in my android assembly – Ayaz Hadoken Aug 16 '21 at 13:13
-
You can change frameworks/base/core/java/android/app/Activity.java. Then it will take effect for all apps. And some apps will intend to override Activity.onKeyDown to handle search key by itself. – Yong Aug 17 '21 at 02:09