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.companion.virtual.IVirtualDevice; 20 import android.companion.virtual.IVirtualDeviceActivityListener; 21 import android.companion.virtual.VirtualDeviceParams; 22 import android.hardware.display.IVirtualDisplayCallback; 23 import android.hardware.display.VirtualDisplayConfig; 24 25 /** 26 * Interface for communication between VirtualDeviceManager and VirtualDeviceManagerService. 27 * 28 * @hide 29 */ 30 interface IVirtualDeviceManager { 31 32 /** 33 * Creates a virtual device that can be used to create virtual displays and stream contents. 34 * 35 * @param token The binder token created by the caller of this API. 36 * @param packageName The package name of the caller. Implementation of this method must verify 37 * that this belongs to the calling UID. 38 * @param associationId The association ID as returned by {@link AssociationInfo#getId()} from 39 * CDM. Virtual devices must have a corresponding association with CDM in order to be created. 40 * @param params The parameters for creating this virtual device. See {@link 41 * VirtualDeviceManager.VirtualDeviceParams}. 42 * @param activityListener The listener to listen for activity changes in a virtual device. 43 */ createVirtualDevice( in IBinder token, String packageName, int associationId, in VirtualDeviceParams params, in IVirtualDeviceActivityListener activityListener)44 IVirtualDevice createVirtualDevice( 45 in IBinder token, String packageName, int associationId, 46 in VirtualDeviceParams params, in IVirtualDeviceActivityListener activityListener); 47 48 /** 49 * Creates a virtual display owned by a particular virtual device. 50 * 51 * @param virtualDisplayConfig The configuration used in creating the display 52 * @param callback A callback that receives display lifecycle events 53 * @param virtualDevice The device that will own this display 54 * @param packageName The package name of the calling app 55 */ createVirtualDisplay(in VirtualDisplayConfig virtualDisplayConfig, in IVirtualDisplayCallback callback, in IVirtualDevice virtualDevice, String packageName)56 int createVirtualDisplay(in VirtualDisplayConfig virtualDisplayConfig, 57 in IVirtualDisplayCallback callback, in IVirtualDevice virtualDevice, 58 String packageName); 59 } 60