Debian Codegraph @

core/java/android/hardware/input/InputManagerInternal.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2014 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 package android.hardware.input;
18
19 import android.annotation.NonNull;
20 import android.graphics.PointF;
21 import android.hardware.display.DisplayViewport;
22 import android.os.IBinder;
23 import android.view.InputChannel;
24
25 import java.util.List;
26
27 /**
28 * Input manager local system service interface.
29 *
30 * @hide Only for use within the system server.
31 */
32 public abstract class InputManagerInternal {
33
34 /**
35 * Called by the display manager to set information about the displays as needed
36 * by the input system. The input system must copy this information to retain it.
37 */
38 public abstract void setDisplayViewports(List<DisplayViewport> viewports);
39
40 /**
41 * Called by the power manager to tell the input manager whether it should start
42 * watching for wake events.
43 */
44 public abstract void setInteractive(boolean interactive);
45
46 /**
47 * Toggles Caps Lock state for input device with specific id.
48 *
49 * @param deviceId The id of input device.
50 */
51 public abstract void toggleCapsLock(int deviceId);
52
53 /**
54 * Set whether the input stack should deliver pulse gesture events when the device is asleep.
55 */
56 public abstract void setPulseGestureEnabled(boolean enabled);
57
58 /**
59 * Atomically transfers touch focus from one window to another as identified by
60 * their input channels. It is possible for multiple windows to have
61 * touch focus if they support split touch dispatch
62 * {@link android.view.WindowManager.LayoutParams#FLAG_SPLIT_TOUCH} but this
63 * method only transfers touch focus of the specified window without affecting
64 * other windows that may also have touch focus at the same time.
65 *
66 * @param fromChannelToken The channel token of a window that currently has touch focus.
67 * @param toChannelToken The channel token of the window that should receive touch focus in
68 * place of the first.
69 * @return {@code true} if the transfer was successful. {@code false} if the window with the
70 * specified channel did not actually have touch focus at the time of the request.
71 */
72 public abstract boolean transferTouchFocus(@NonNull IBinder fromChannelToken,
73 @NonNull IBinder toChannelToken);
74
75 /**
76 * Sets the display id that the MouseCursorController will be forced to target. Pass
77 * {@link android.view.Display#INVALID_DISPLAY} to clear the override.
78 *
79 * Note: This method generally blocks until the pointer display override has propagated.
80 * When setting a new override, the caller should ensure that an input device that can control
81 * the mouse pointer is connected. If a new override is set when no such input device is
82 * connected, the caller may be blocked for an arbitrary period of time.
83 *
84 * @return true if the pointer displayId was set successfully, or false if it fails.
85 */
86 public abstract boolean setVirtualMousePointerDisplayId(int pointerDisplayId);
87
88 /**
89 * Gets the display id that the MouseCursorController is being forced to target. Returns
90 * {@link android.view.Display#INVALID_DISPLAY} if there is no override
91 */
92 public abstract int getVirtualMousePointerDisplayId();
93
94 /** Gets the current position of the mouse cursor. */
95 public abstract PointF getCursorPosition();
96
97 /**
98 * Sets the pointer acceleration.
99 * See {@code frameworks/native/include/input/VelocityControl.h#VelocityControlParameters}.
100 */
101 public abstract void setPointerAcceleration(float acceleration, int displayId);
102
103 /**
104 * Sets the eligibility of windows on a given display for pointer capture. If a display is
105 * marked ineligible, requests to enable pointer capture for windows on that display will be
106 * ignored.
107 */
108 public abstract void setDisplayEligibilityForPointerCapture(int displayId, boolean isEligible);
109
110 /** Sets the visibility of the cursor. */
111 public abstract void setPointerIconVisible(boolean visible, int displayId);
112
113 /** Registers the {@link LidSwitchCallback} to begin receiving notifications. */
114 public abstract void registerLidSwitchCallback(@NonNull LidSwitchCallback callbacks);
115
116 /**
117 * Unregisters a {@link LidSwitchCallback callback} previously registered with
118 * {@link #registerLidSwitchCallback(LidSwitchCallback)}.
119 */
120 public abstract void unregisterLidSwitchCallback(@NonNull LidSwitchCallback callbacks);
121
122 /** Callback interface for notifications relating to the lid switch. */
123 public interface LidSwitchCallback {
124 /**
125 * This callback is invoked when the lid switch changes state. Will be triggered once on
126 * registration of the callback with a {@code whenNanos} of 0 and then on every subsequent
127 * change in lid switch state.
128 *
129 * @param whenNanos the time when the change occurred
130 * @param lidOpen true if the lid is open
131 */
132 void notifyLidSwitchChanged(long whenNanos, boolean lidOpen);
133 }
134
135 /** Create an {@link InputChannel} that is registered to InputDispatcher. */
136 public abstract InputChannel createInputChannel(String inputChannelName);
137
138 /**
139 * Pilfer pointers from the input channel with the given token so that ongoing gestures are
140 * canceled for all other channels.
141 */
142 public abstract void pilferPointers(IBinder token);
143 }