| Prabir Pradhan | f93562f | 2018-11-29 12:13:37 -0800 | [diff] [blame] | 1 | /* | 
| Prabir Pradhan | 79a4f0c | 2019-01-09 11:24:01 -0800 | [diff] [blame] | 2 |  * Copyright (C) 2019 The Android Open Source Project | 
| Prabir Pradhan | f93562f | 2018-11-29 12:13:37 -0800 | [diff] [blame] | 3 |  * | 
 | 4 |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
 | 5 |  * you may not use this file except in compliance with the License. | 
 | 6 |  * You may obtain a copy of the License at | 
 | 7 |  * | 
 | 8 |  *      http://www.apache.org/licenses/LICENSE-2.0 | 
 | 9 |  * | 
 | 10 |  * Unless required by applicable law or agreed to in writing, software | 
 | 11 |  * distributed under the License is distributed on an "AS IS" BASIS, | 
 | 12 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
 | 13 |  * See the License for the specific language governing permissions and | 
 | 14 |  * limitations under the License. | 
 | 15 |  */ | 
 | 16 |  | 
| Prabir Pradhan | 79a4f0c | 2019-01-09 11:24:01 -0800 | [diff] [blame] | 17 | #ifndef _UI_INPUT_REPORTER_INTERFACE_H | 
 | 18 | #define _UI_INPUT_REPORTER_INTERFACE_H | 
| Prabir Pradhan | f93562f | 2018-11-29 12:13:37 -0800 | [diff] [blame] | 19 |  | 
 | 20 | #include <utils/RefBase.h> | 
 | 21 |  | 
 | 22 | namespace android { | 
 | 23 |  | 
 | 24 | /* | 
 | 25 |  * The interface used by the InputDispatcher to report information about input events after | 
 | 26 |  * it is sent to the application, such as if a key is unhandled or dropped. | 
 | 27 |  */ | 
| Prabir Pradhan | 79a4f0c | 2019-01-09 11:24:01 -0800 | [diff] [blame] | 28 | class InputReporterInterface : public virtual RefBase { | 
| Prabir Pradhan | f93562f | 2018-11-29 12:13:37 -0800 | [diff] [blame] | 29 | protected: | 
| Prabir Pradhan | 79a4f0c | 2019-01-09 11:24:01 -0800 | [diff] [blame] | 30 |     virtual ~InputReporterInterface() { } | 
| Prabir Pradhan | f93562f | 2018-11-29 12:13:37 -0800 | [diff] [blame] | 31 |  | 
 | 32 | public: | 
 | 33 |     // Report a key that was not handled by the system or apps. | 
 | 34 |     // A key event is unhandled if: | 
 | 35 |     //   - The event was not handled and there is no fallback key; or | 
 | 36 |     //   - The event was not handled and it has a fallback key, | 
 | 37 |     //       but the fallback key was not handled. | 
| Prabir Pradhan | 79a4f0c | 2019-01-09 11:24:01 -0800 | [diff] [blame] | 38 |     virtual void reportUnhandledKey(uint32_t sequenceNum) = 0; | 
| Prabir Pradhan | f93562f | 2018-11-29 12:13:37 -0800 | [diff] [blame] | 39 |  | 
 | 40 |     // Report a key that was dropped by InputDispatcher. | 
 | 41 |     // A key can be dropped for several reasons. See the enum | 
 | 42 |     // InputDispatcher::DropReason for details. | 
| Prabir Pradhan | 79a4f0c | 2019-01-09 11:24:01 -0800 | [diff] [blame] | 43 |     virtual void reportDroppedKey(uint32_t sequenceNum) = 0; | 
| Prabir Pradhan | f93562f | 2018-11-29 12:13:37 -0800 | [diff] [blame] | 44 | }; | 
 | 45 |  | 
 | 46 | /* | 
 | 47 |  * Factory method for InputReporter. | 
 | 48 |  */ | 
| Prabir Pradhan | 79a4f0c | 2019-01-09 11:24:01 -0800 | [diff] [blame] | 49 | sp<InputReporterInterface> createInputReporter(); | 
| Prabir Pradhan | f93562f | 2018-11-29 12:13:37 -0800 | [diff] [blame] | 50 |  | 
 | 51 | } // namespace android | 
 | 52 |  | 
| Prabir Pradhan | 79a4f0c | 2019-01-09 11:24:01 -0800 | [diff] [blame] | 53 | #endif // _UI_INPUT_REPORTER_INTERFACE_H |