1 /*
2  * Copyright (C) 2019 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_INTERFACE_H
18 #define _UI_INPUT_REPORTER_INTERFACE_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 InputReporterInterface : public virtual RefBase {
29 protected:
~InputReporterInterface()30     virtual ~InputReporterInterface() {}
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) = 0;
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) = 0;
44 };
45 
46 /*
47  * Factory method for InputReporter.
48  */
49 sp<InputReporterInterface> createInputReporter();
50 
51 } // namespace android
52 
53 #endif // _UI_INPUT_REPORTER_INTERFACE_H
54