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 #pragma once 18 19 #include <utils/RefBase.h> 20 21 namespace android { 22 23 /* 24 * The interface used by the InputDispatcher to report information about input events after 25 * it is sent to the application, such as if a key is unhandled or dropped. 26 */ 27 class InputReporterInterface : public virtual RefBase { 28 protected: ~InputReporterInterface()29 virtual ~InputReporterInterface() {} 30 31 public: 32 // Report a key that was not handled by the system or apps. 33 // A key event is unhandled if: 34 // - The event was not handled and there is no fallback key; or 35 // - The event was not handled and it has a fallback key, 36 // but the fallback key was not handled. 37 virtual void reportUnhandledKey(uint32_t sequenceNum) = 0; 38 39 // Report a key that was dropped by InputDispatcher. 40 // A key can be dropped for several reasons. See the enum 41 // InputDispatcher::DropReason for details. 42 virtual void reportDroppedKey(uint32_t sequenceNum) = 0; 43 }; 44 45 /* 46 * Factory method for InputReporter. 47 */ 48 sp<InputReporterInterface> createInputReporter(); 49 50 } // namespace android 51