Prabir Pradhan | f93562f | 2018-11-29 12:13:37 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2018 The Android Open Source Project |
| 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 | |
| 17 | #ifndef _UI_INPUT_REPORTER_H |
| 18 | #define _UI_INPUT_REPORTER_H |
| 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 | */ |
| 28 | class InputReporter: public virtual RefBase { |
| 29 | protected: |
| 30 | virtual ~InputReporter() { } |
| 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. |
| 38 | virtual void reportUnhandledKey(uint32_t sequenceNum); |
| 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. |
| 43 | virtual void reportDroppedKey(uint32_t sequenceNum); |
| 44 | }; |
| 45 | |
| 46 | /* |
| 47 | * Factory method for InputReporter. |
| 48 | */ |
| 49 | sp<InputReporter> createInputReporter(); |
| 50 | |
| 51 | } // namespace android |
| 52 | |
| 53 | #endif // _UI_INPUT_REPORTER_H |