Debian Codegraph @

core/java/android/hardware/usb/IUsbManager.aidl

raw
1 /*
2 * Copyright (C) 2010 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.usb;
18
19 import android.app.PendingIntent;
20 import android.content.ComponentName;
21 import android.hardware.usb.IUsbOperationInternal;
22 import android.hardware.usb.UsbAccessory;
23 import android.hardware.usb.UsbDevice;
24 import android.hardware.usb.ParcelableUsbPort;
25 import android.hardware.usb.UsbPortStatus;
26 import android.os.Bundle;
27 import android.os.ParcelFileDescriptor;
28 import android.os.UserHandle;
29
30 /** @hide */
31 interface IUsbManager
32 {
33 /* Returns a list of all currently attached USB devices */
34 void getDeviceList(out Bundle devices);
35
36 /* Returns a file descriptor for communicating with the USB device.
37 * The native fd can be passed to usb_device_new() in libusbhost.
38 */
39 ParcelFileDescriptor openDevice(String deviceName, String packageName);
40
41 /* Returns the currently attached USB accessory */
42 UsbAccessory getCurrentAccessory();
43
44 /* Returns a file descriptor for communicating with the USB accessory.
45 * This file descriptor can be used with standard Java file operations.
46 */
47 ParcelFileDescriptor openAccessory(in UsbAccessory accessory);
48
49 /* Sets the default package for a USB device
50 * (or clears it if the package name is null)
51 */
52 void setDevicePackage(in UsbDevice device, String packageName, int userId);
53
54 /* Sets the default package for a USB accessory
55 * (or clears it if the package name is null)
56 */
57 void setAccessoryPackage(in UsbAccessory accessory, String packageName, int userId);
58
59 /* Adds packages to the set of "denied and don't ask again" launch preferences for a device */
60 void addDevicePackagesToPreferenceDenied(in UsbDevice device, in String[] packageNames, in UserHandle user);
61
62 /* Adds packages to the set of "denied and don't ask again" launch preferences for an accessory */
63 void addAccessoryPackagesToPreferenceDenied(in UsbAccessory accessory, in String[] packageNames, in UserHandle user);
64
65 /* Removes packages from the set of "denied and don't ask again" launch preferences for a device */
66 void removeDevicePackagesFromPreferenceDenied(in UsbDevice device, in String[] packageNames, in UserHandle user);
67
68 /* Removes packages from the set of "denied and don't ask again" launch preferences for an accessory */
69 void removeAccessoryPackagesFromPreferenceDenied(in UsbAccessory device, in String[] packageNames, in UserHandle user);
70
71 /* Sets the persistent permission granted state for USB device
72 */
73 void setDevicePersistentPermission(in UsbDevice device, int uid, in UserHandle user, boolean shouldBeGranted);
74
75 /* Sets the persistent permission granted state for USB accessory
76 */
77 void setAccessoryPersistentPermission(in UsbAccessory accessory, int uid, in UserHandle user, boolean shouldBeGranted);
78
79 /* Returns true if the caller has permission to access the device. */
80 boolean hasDevicePermission(in UsbDevice device, String packageName);
81
82 /* Returns true if the caller has permission to access the accessory. */
83 boolean hasAccessoryPermission(in UsbAccessory accessory);
84
85 /* Requests permission for the given package to access the device.
86 * Will display a system dialog to query the user if permission
87 * had not already been given.
88 */
89 void requestDevicePermission(in UsbDevice device, String packageName, in PendingIntent pi);
90
91 /* Requests permission for the given package to access the accessory.
92 * Will display a system dialog to query the user if permission
93 * had not already been given. Result is returned via pi.
94 */
95 void requestAccessoryPermission(in UsbAccessory accessory, String packageName,
96 in PendingIntent pi);
97
98 /* Grants permission for the given UID to access the device */
99 void grantDevicePermission(in UsbDevice device, int uid);
100
101 /* Grants permission for the given UID to access the accessory */
102 void grantAccessoryPermission(in UsbAccessory accessory, int uid);
103
104 /* Returns true if the USB manager has default preferences or permissions for the package */
105 boolean hasDefaults(String packageName, int userId);
106
107 /* Clears default preferences and permissions for the package */
108 void clearDefaults(String packageName, int userId);
109
110 /* Returns true if the specified USB function is enabled. */
111 boolean isFunctionEnabled(String function);
112
113 /* Sets the current USB function. */
114 void setCurrentFunctions(long functions, int operationId);
115
116 /* Compatibility version of setCurrentFunctions(long). */
117 void setCurrentFunction(String function, boolean usbDataUnlocked, int operationId);
118
119 /* Gets the current USB functions. */
120 long getCurrentFunctions();
121
122 /* Gets the current USB Speed. */
123 int getCurrentUsbSpeed();
124
125 /* Gets the Gadget Hal Version. */
126 int getGadgetHalVersion();
127
128 /* Sets the screen unlocked USB function(s), which will be set automatically
129 * when the screen is unlocked.
130 */
131 void setScreenUnlockedFunctions(long functions);
132
133 /* Gets the current screen unlocked functions. */
134 long getScreenUnlockedFunctions();
135
136 /* Resets the USB gadget. */
137 void resetUsbGadget();
138
139 /* Resets the USB port. */
140 void resetUsbPort(in String portId, int operationId, in IUsbOperationInternal callback);
141
142 /* Set USB data on or off */
143 boolean enableUsbData(in String portId, boolean enable, int operationId, in IUsbOperationInternal callback);
144
145 /* Enable USB data when disabled due to docking event */
146 void enableUsbDataWhileDocked(in String portId, int operationId, in IUsbOperationInternal callback);
147
148 /* Gets the USB Hal Version. */
149 int getUsbHalVersion();
150
151 /* Get the functionfs control handle for the given function. Usb
152 * descriptors will already be written, and the handle will be
153 * ready to use.
154 */
155 ParcelFileDescriptor getControlFd(long function);
156
157 /* Gets the list of USB ports. */
158 List<ParcelableUsbPort> getPorts();
159
160 /* Gets the status of the specified USB port. */
161 UsbPortStatus getPortStatus(in String portId);
162
163 /* Sets the port's current role. */
164 void setPortRoles(in String portId, int powerRole, int dataRole);
165
166 /* Limit power transfer in & out of the port within the allowed limit by the USB
167 * specification.
168 */
169 void enableLimitPowerTransfer(in String portId, boolean limit, int operationId, in IUsbOperationInternal callback);
170
171 /* Enable/disable contaminant detection */
172 void enableContaminantDetection(in String portId, boolean enable);
173
174 /* Sets USB device connection handler. */
175 void setUsbDeviceConnectionHandler(in ComponentName usbDeviceConnectionHandler);
176 }