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.hardware.display.DisplayViewport; 21 import android.os.IBinder; 22 import android.view.InputEvent; 23 24 import java.util.List; 25 26 /** 27 * Input manager local system service interface. 28 * 29 * @hide Only for use within the system server. 30 */ 31 public abstract class InputManagerInternal { 32 /** 33 * Inject an input event. 34 * 35 * @param event The InputEvent to inject 36 * @param mode Synchronous or asynchronous mode 37 * @return True if injection has succeeded 38 */ injectInputEvent(InputEvent event, int mode)39 public abstract boolean injectInputEvent(InputEvent event, int mode); 40 41 /** 42 * Called by the display manager to set information about the displays as needed 43 * by the input system. The input system must copy this information to retain it. 44 */ setDisplayViewports(List<DisplayViewport> viewports)45 public abstract void setDisplayViewports(List<DisplayViewport> viewports); 46 47 /** 48 * Called by the power manager to tell the input manager whether it should start 49 * watching for wake events. 50 */ setInteractive(boolean interactive)51 public abstract void setInteractive(boolean interactive); 52 53 /** 54 * Toggles Caps Lock state for input device with specific id. 55 * 56 * @param deviceId The id of input device. 57 */ toggleCapsLock(int deviceId)58 public abstract void toggleCapsLock(int deviceId); 59 60 /** 61 * Set whether the input stack should deliver pulse gesture events when the device is asleep. 62 */ setPulseGestureEnabled(boolean enabled)63 public abstract void setPulseGestureEnabled(boolean enabled); 64 65 /** 66 * Atomically transfers touch focus from one window to another as identified by 67 * their input channels. It is possible for multiple windows to have 68 * touch focus if they support split touch dispatch 69 * {@link android.view.WindowManager.LayoutParams#FLAG_SPLIT_TOUCH} but this 70 * method only transfers touch focus of the specified window without affecting 71 * other windows that may also have touch focus at the same time. 72 * 73 * @param fromChannelToken The channel token of a window that currently has touch focus. 74 * @param toChannelToken The channel token of the window that should receive touch focus in 75 * place of the first. 76 * @return {@code true} if the transfer was successful. {@code false} if the window with the 77 * specified channel did not actually have touch focus at the time of the request. 78 */ transferTouchFocus(@onNull IBinder fromChannelToken, @NonNull IBinder toChannelToken)79 public abstract boolean transferTouchFocus(@NonNull IBinder fromChannelToken, 80 @NonNull IBinder toChannelToken); 81 } 82