| 1 |
/* |
| 2 |
* Copyright (C) 2021 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.companion.virtual; |
| 18 |
|
| 19 |
import android.app.PendingIntent; |
| 20 |
import android.companion.virtual.audio.IAudioConfigChangedCallback; |
| 21 |
import android.companion.virtual.audio.IAudioRoutingCallback; |
| 22 |
import android.graphics.Point; |
| 23 |
import android.graphics.PointF; |
| 24 |
import android.hardware.input.VirtualKeyEvent; |
| 25 |
import android.hardware.input.VirtualMouseButtonEvent; |
| 26 |
import android.hardware.input.VirtualMouseRelativeEvent; |
| 27 |
import android.hardware.input.VirtualMouseScrollEvent; |
| 28 |
import android.hardware.input.VirtualTouchEvent; |
| 29 |
import android.os.ResultReceiver; |
| 30 |
|
| 31 |
/** |
| 32 |
* Interface for a virtual device. |
| 33 |
* |
| 34 |
* @hide |
| 35 |
*/ |
| 36 |
interface IVirtualDevice { |
| 37 |
|
| 38 |
/** |
| 39 |
* Returns the association ID for this virtual device. |
| 40 |
* |
| 41 |
* @see AssociationInfo#getId() |
| 42 |
*/ |
| 43 |
int getAssociationId(); |
| 44 |
|
| 45 |
/** |
| 46 |
* Closes the virtual device and frees all associated resources. |
| 47 |
*/ |
| 48 |
void close(); |
| 49 |
|
| 50 |
/** |
| 51 |
* Notifies of an audio session being started. |
| 52 |
*/ |
| 53 |
void onAudioSessionStarting( |
| 54 |
int displayId, |
| 55 |
IAudioRoutingCallback routingCallback, |
| 56 |
IAudioConfigChangedCallback configChangedCallback); |
| 57 |
|
| 58 |
void onAudioSessionEnded(); |
| 59 |
|
| 60 |
void createVirtualKeyboard( |
| 61 |
int displayId, |
| 62 |
String inputDeviceName, |
| 63 |
int vendorId, |
| 64 |
int productId, |
| 65 |
IBinder token); |
| 66 |
void createVirtualMouse( |
| 67 |
int displayId, |
| 68 |
String inputDeviceName, |
| 69 |
int vendorId, |
| 70 |
int productId, |
| 71 |
IBinder token); |
| 72 |
void createVirtualTouchscreen( |
| 73 |
int displayId, |
| 74 |
String inputDeviceName, |
| 75 |
int vendorId, |
| 76 |
int productId, |
| 77 |
IBinder token, |
| 78 |
in Point screenSize); |
| 79 |
void unregisterInputDevice(IBinder token); |
| 80 |
boolean sendKeyEvent(IBinder token, in VirtualKeyEvent event); |
| 81 |
boolean sendButtonEvent(IBinder token, in VirtualMouseButtonEvent event); |
| 82 |
boolean sendRelativeEvent(IBinder token, in VirtualMouseRelativeEvent event); |
| 83 |
boolean sendScrollEvent(IBinder token, in VirtualMouseScrollEvent event); |
| 84 |
boolean sendTouchEvent(IBinder token, in VirtualTouchEvent event); |
| 85 |
|
| 86 |
/** |
| 87 |
* Launches a pending intent on the given display that is owned by this virtual device. |
| 88 |
*/ |
| 89 |
void launchPendingIntent( |
| 90 |
int displayId, in PendingIntent pendingIntent, in ResultReceiver resultReceiver); |
| 91 |
PointF getCursorPosition(IBinder token); |
| 92 |
|
| 93 |
/** Sets whether to show or hide the cursor while this virtual device is active. */ |
| 94 |
void setShowPointerIcon(boolean showPointerIcon); |
| 95 |
} |