blob: 906d7f25f2bbdcb9a9ebb48419a3bfb04d4a6e8f [file] [log] [blame]
Prabir Pradhanf93562f2018-11-29 12:13:37 -08001/*
Prabir Pradhan79a4f0c2019-01-09 11:24:01 -08002 * Copyright (C) 2019 The Android Open Source Project
Prabir Pradhanf93562f2018-11-29 12:13:37 -08003 *
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 Pradhan79a4f0c2019-01-09 11:24:01 -080017#ifndef _UI_INPUT_REPORTER_INTERFACE_H
18#define _UI_INPUT_REPORTER_INTERFACE_H
Prabir Pradhanf93562f2018-11-29 12:13:37 -080019
20#include <utils/RefBase.h>
21
22namespace 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 Pradhan79a4f0c2019-01-09 11:24:01 -080028class InputReporterInterface : public virtual RefBase {
Prabir Pradhanf93562f2018-11-29 12:13:37 -080029protected:
Prabir Pradhan79a4f0c2019-01-09 11:24:01 -080030 virtual ~InputReporterInterface() { }
Prabir Pradhanf93562f2018-11-29 12:13:37 -080031
32public:
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 Pradhan79a4f0c2019-01-09 11:24:01 -080038 virtual void reportUnhandledKey(uint32_t sequenceNum) = 0;
Prabir Pradhanf93562f2018-11-29 12:13:37 -080039
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 Pradhan79a4f0c2019-01-09 11:24:01 -080043 virtual void reportDroppedKey(uint32_t sequenceNum) = 0;
Prabir Pradhanf93562f2018-11-29 12:13:37 -080044};
45
46/*
47 * Factory method for InputReporter.
48 */
Prabir Pradhan79a4f0c2019-01-09 11:24:01 -080049sp<InputReporterInterface> createInputReporter();
Prabir Pradhanf93562f2018-11-29 12:13:37 -080050
51} // namespace android
52
Prabir Pradhan79a4f0c2019-01-09 11:24:01 -080053#endif // _UI_INPUT_REPORTER_INTERFACE_H