1 /* 2 * Copyright (C) 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 package android.companion.virtualnative; 18 19 /** 20 * Parallel implementation of certain VirtualDeviceManager APIs that need to be exposed to native 21 * code. 22 * 23 * <p>These APIs are a parallel definition to the APIs in VirtualDeviceManager and/or 24 * VirtualDeviceManagerInternal, so they can technically diverge. However, it's good practice to 25 * keep these APIs in sync with each other.</p> 26 * 27 * <p>Even though the name implies otherwise, the implementation is actually in Java. The 'native' 28 * suffix comes from the intended usage - native framework backends that need to communicate with 29 * VDM for some reason.</p> 30 * 31 * <p>Because these APIs are exposed to native code that runs in the app process, they may be 32 * accessed by apps directly, even though they're hidden. Care should be taken to avoid exposing 33 * sensitive data or potential security holes.</p> 34 * 35 * @hide 36 */ 37 interface IVirtualDeviceManagerNative { 38 /** 39 * Counterpart to VirtualDeviceParams#DevicePolicy. 40 */ 41 const int DEVICE_POLICY_DEFAULT = 0; 42 const int DEVICE_POLICY_CUSTOM = 1; 43 44 /** 45 * Counterpart to VirtualDeviceParams#PolicyType. 46 */ 47 const int POLICY_TYPE_SENSORS = 0; 48 const int POLICY_TYPE_AUDIO = 1; 49 const int POLICY_TYPE_RECENTS = 2; 50 const int POLICY_TYPE_ACTIVITY = 3; 51 const int POLICY_TYPE_CLIPBOARD = 4; 52 const int POLICY_TYPE_CAMERA = 5; 53 54 /** 55 * Returns the IDs for all VirtualDevices where an app with the given is running. 56 * 57 * Note that this returns only VirtualDevice IDs: if the app is not running on any virtual 58 * device, then an an empty array is returned. This does not include information about whether 59 * the app is running on the default device or not. 60 */ getDeviceIdsForUid(int uid)61 int[] getDeviceIdsForUid(int uid); 62 63 /** 64 * Returns the device policy for the given virtual device and policy type. 65 */ getDevicePolicy(int deviceId, int policyType)66 int getDevicePolicy(int deviceId, int policyType); 67 } 68