blob: 8b47b555e5003e28388df090d09fcd94c971a75b [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.
28 */
29class PointerChoreographerPolicyInterface {
30public:
31 virtual ~PointerChoreographerPolicyInterface() = default;
32
33 /**
34 * A factory method for PointerController. The PointerController implementation has
35 * dependencies on a graphical library - libgui, used to draw icons on the screen - which
36 * isn't available for the host. Since we want libinputflinger and its test to be buildable
37 * for and runnable on the host, the PointerController implementation must be in a separate
38 * library, libinputservice, that has the additional dependencies. The PointerController
39 * will be mocked when testing PointerChoreographer.
40 */
Byoungho Jungda10dd32023-10-06 17:03:45 +090041 virtual std::shared_ptr<PointerControllerInterface> createPointerController(
42 PointerControllerInterface::ControllerType type) = 0;
43
Prabir Pradhan19767602023-11-03 16:53:31 +000044 /**
45 * Notifies the policy that the default pointer displayId has changed. PointerChoreographer is
46 * the single source of truth for all pointers on screen.
47 * @param displayId The updated display on which the mouse cursor is shown
48 * @param position The new position of the mouse cursor on the logical display
49 */
Byoungho Jungda10dd32023-10-06 17:03:45 +090050 virtual void notifyPointerDisplayIdChanged(int32_t displayId, const FloatPoint& position) = 0;
Prabir Pradhanb56e92c2023-06-09 23:40:37 +000051};
52
53} // namespace android