1 /* 2 * Copyright 2023 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 "PointerControllerInterface.h" 20 21 namespace android { 22 23 /** 24 * The PointerChoreographer policy interface. 25 * 26 * This is the interface that PointerChoreographer uses to talk to Window Manager and other 27 * system components. 28 * 29 * NOTE: In general, the PointerChoreographer must not interact with the policy while 30 * holding any locks. 31 */ 32 class PointerChoreographerPolicyInterface { 33 public: 34 virtual ~PointerChoreographerPolicyInterface() = default; 35 36 /** 37 * A factory method for PointerController. The PointerController implementation has 38 * dependencies on a graphical library - libgui, used to draw icons on the screen - which 39 * isn't available for the host. Since we want libinputflinger and its test to be buildable 40 * for and runnable on the host, the PointerController implementation must be in a separate 41 * library, libinputservice, that has the additional dependencies. The PointerController 42 * will be mocked when testing PointerChoreographer. 43 * 44 * Since this is a factory method used to work around dependencies, it will not interact with 45 * other input components and may be called with the PointerChoreographer lock held. 46 */ 47 virtual std::shared_ptr<PointerControllerInterface> createPointerController( 48 PointerControllerInterface::ControllerType type) = 0; 49 50 /** 51 * Notifies the policy that the default pointer displayId has changed. PointerChoreographer is 52 * the single source of truth for all pointers on screen. 53 * @param displayId The updated display on which the mouse cursor is shown 54 * @param position The new position of the mouse cursor on the logical display 55 */ 56 virtual void notifyPointerDisplayIdChanged(ui::LogicalDisplayId displayId, 57 const FloatPoint& position) = 0; 58 59 /* Returns true if any InputConnection is currently active. */ 60 virtual bool isInputMethodConnectionActive() = 0; 61 }; 62 63 } // namespace android 64