blob: e1f8fdaaa07bac073ba6b0727900bba7a79e50c6 [file] [log] [blame]
Prabir Pradhanb56e92c2023-06-09 23:40:37 +00001/*
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
21namespace 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.
Prabir Pradhan5a51a222024-03-05 03:54:00 +000028 *
29 * NOTE: In general, the PointerChoreographer must not interact with the policy while
30 * holding any locks.
Prabir Pradhanb56e92c2023-06-09 23:40:37 +000031 */
32class PointerChoreographerPolicyInterface {
33public:
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.
Prabir Pradhan5a51a222024-03-05 03:54:00 +000043 *
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.
Prabir Pradhanb56e92c2023-06-09 23:40:37 +000046 */
Byoungho Jungda10dd32023-10-06 17:03:45 +090047 virtual std::shared_ptr<PointerControllerInterface> createPointerController(
48 PointerControllerInterface::ControllerType type) = 0;
49
Prabir Pradhan19767602023-11-03 16:53:31 +000050 /**
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 */
Linnan Li13bf76a2024-05-05 19:18:02 +080056 virtual void notifyPointerDisplayIdChanged(ui::LogicalDisplayId displayId,
57 const FloatPoint& position) = 0;
Arpit Singhb65e2bd2024-06-03 09:48:16 +000058
59 /* Returns true if any InputConnection is currently active. */
60 virtual bool isInputMethodConnectionActive() = 0;
Arpit Singh849beb42024-06-06 07:14:17 +000061
62 /* Notifies that mouse cursor faded due to typing. */
63 virtual void notifyMouseCursorFadedOnTyping() = 0;
Prabir Pradhanb56e92c2023-06-09 23:40:37 +000064};
65
66} // namespace android