blob: 551926c8c5e0455dec30cfdd695a09b16bedc672 [file] [log] [blame]
Mike Lockwood24236072010-06-23 17:36:36 -04001/*
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
Mike Lockwoodc4308f02011-03-01 08:04:54 -080018package android.hardware.usb;
Mike Lockwood24236072010-06-23 17:36:36 -040019
Mike Lockwood3a68b832011-03-08 10:08:59 -050020import android.app.PendingIntent;
21import android.content.Context;
Mike Lockwoode7d511e2010-12-30 13:39:37 -050022import android.os.Bundle;
23import android.os.ParcelFileDescriptor;
24import android.os.RemoteException;
Mike Lockwood02e45692011-06-14 15:43:51 -040025import android.os.SystemProperties;
Mike Lockwoode7d511e2010-12-30 13:39:37 -050026import android.util.Log;
27
Mike Lockwoode7d511e2010-12-30 13:39:37 -050028import java.util.HashMap;
Mike Lockwood08bff3b2010-08-31 13:27:05 -040029
Mike Lockwood24236072010-06-23 17:36:36 -040030/**
Mike Lockwood11dd5ae2011-04-01 14:00:08 -040031 * This class allows you to access the state of USB and communicate with USB devices.
32 * Currently only host mode is supported in the public API.
Mike Lockwoode7d511e2010-12-30 13:39:37 -050033 *
34 * <p>You can obtain an instance of this class by calling
35 * {@link android.content.Context#getSystemService(java.lang.String) Context.getSystemService()}.
36 *
37 * {@samplecode
38 * UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
39 * }
Mike Lockwood24236072010-06-23 17:36:36 -040040 */
Mike Lockwood770126a2010-12-09 22:30:37 -080041public class UsbManager {
Mike Lockwoode7d511e2010-12-30 13:39:37 -050042 private static final String TAG = "UsbManager";
43
Mike Lockwood24236072010-06-23 17:36:36 -040044 /**
Mike Lockwoode7d511e2010-12-30 13:39:37 -050045 * Broadcast Action: A sticky broadcast for USB state change events when in device mode.
Mike Lockwood709981e2010-06-28 09:58:58 -040046 *
Mike Lockwoodb92df0f2010-12-10 16:19:32 -080047 * This is a sticky broadcast for clients that includes USB connected/disconnected state,
Mike Lockwood9182d3c2011-02-15 09:50:22 -050048 * <ul>
49 * <li> {@link #USB_CONNECTED} boolean indicating whether USB is connected or disconnected.
Mike Lockwood02e45692011-06-14 15:43:51 -040050 * <li> {@link #USB_CONFIGURED} boolean indicating whether USB is configured.
Mike Lockwood9eb014a2011-06-08 09:17:45 -070051 * currently zero if not configured, one for configured.
52 * <li> {@link #USB_FUNCTION_MASS_STORAGE} boolean extra indicating whether the
53 * mass storage function is enabled
54 * <li> {@link #USB_FUNCTION_ADB} boolean extra indicating whether the
55 * adb function is enabled
56 * <li> {@link #USB_FUNCTION_RNDIS} boolean extra indicating whether the
57 * RNDIS ethernet function is enabled
58 * <li> {@link #USB_FUNCTION_MTP} boolean extra indicating whether the
59 * MTP function is enabled
60 * <li> {@link #USB_FUNCTION_PTP} boolean extra indicating whether the
61 * PTP function is enabled
62 * <li> {@link #USB_FUNCTION_PTP} boolean extra indicating whether the
63 * accessory function is enabled
Mike Lockwood9182d3c2011-02-15 09:50:22 -050064 * </ul>
Mike Lockwooda75075e12011-03-11 11:26:11 -050065 *
66 * {@hide}
Mike Lockwood709981e2010-06-28 09:58:58 -040067 */
68 public static final String ACTION_USB_STATE =
Mike Lockwoodc4308f02011-03-01 08:04:54 -080069 "android.hardware.usb.action.USB_STATE";
Mike Lockwood709981e2010-06-28 09:58:58 -040070
Mike Lockwoode7d511e2010-12-30 13:39:37 -050071 /**
72 * Broadcast Action: A broadcast for USB device attached event.
73 *
74 * This intent is sent when a USB device is attached to the USB bus when in host mode.
Mike Lockwood9182d3c2011-02-15 09:50:22 -050075 * <ul>
Mike Lockwoodc4308f02011-03-01 08:04:54 -080076 * <li> {@link #EXTRA_DEVICE} containing the {@link android.hardware.usb.UsbDevice}
Mike Lockwood9182d3c2011-02-15 09:50:22 -050077 * for the attached device
78 * </ul>
Mike Lockwoode7d511e2010-12-30 13:39:37 -050079 */
80 public static final String ACTION_USB_DEVICE_ATTACHED =
Mike Lockwoodc4308f02011-03-01 08:04:54 -080081 "android.hardware.usb.action.USB_DEVICE_ATTACHED";
Mike Lockwoode7d511e2010-12-30 13:39:37 -050082
83 /**
84 * Broadcast Action: A broadcast for USB device detached event.
85 *
86 * This intent is sent when a USB device is detached from the USB bus when in host mode.
Mike Lockwood9182d3c2011-02-15 09:50:22 -050087 * <ul>
Mike Lockwoodc4308f02011-03-01 08:04:54 -080088 * <li> {@link #EXTRA_DEVICE} containing the {@link android.hardware.usb.UsbDevice}
Mike Lockwood188d00b2011-02-23 13:14:33 -080089 * for the detached device
Mike Lockwood9182d3c2011-02-15 09:50:22 -050090 * </ul>
Mike Lockwoode7d511e2010-12-30 13:39:37 -050091 */
92 public static final String ACTION_USB_DEVICE_DETACHED =
Mike Lockwoodc4308f02011-03-01 08:04:54 -080093 "android.hardware.usb.action.USB_DEVICE_DETACHED";
Mike Lockwoode7d511e2010-12-30 13:39:37 -050094
Mike Lockwood9182d3c2011-02-15 09:50:22 -050095 /**
96 * Broadcast Action: A broadcast for USB accessory attached event.
97 *
98 * This intent is sent when a USB accessory is attached.
99 * <ul>
Mike Lockwoodc4308f02011-03-01 08:04:54 -0800100 * <li> {@link #EXTRA_ACCESSORY} containing the {@link android.hardware.usb.UsbAccessory}
Mike Lockwood9182d3c2011-02-15 09:50:22 -0500101 * for the attached accessory
102 * </ul>
103 */
104 public static final String ACTION_USB_ACCESSORY_ATTACHED =
Mike Lockwoodc4308f02011-03-01 08:04:54 -0800105 "android.hardware.usb.action.USB_ACCESSORY_ATTACHED";
Mike Lockwood9182d3c2011-02-15 09:50:22 -0500106
107 /**
108 * Broadcast Action: A broadcast for USB accessory detached event.
109 *
110 * This intent is sent when a USB accessory is detached.
111 * <ul>
Mike Lockwood980f0432011-03-09 15:49:13 -0500112 * <li> {@link #EXTRA_ACCESSORY} containing the {@link UsbAccessory}
Mike Lockwood9182d3c2011-02-15 09:50:22 -0500113 * for the attached accessory that was detached
114 * </ul>
115 */
116 public static final String ACTION_USB_ACCESSORY_DETACHED =
Mike Lockwoodc4308f02011-03-01 08:04:54 -0800117 "android.hardware.usb.action.USB_ACCESSORY_DETACHED";
Mike Lockwood9182d3c2011-02-15 09:50:22 -0500118
Mike Lockwood709981e2010-06-28 09:58:58 -0400119 /**
120 * Boolean extra indicating whether USB is connected or disconnected.
121 * Used in extras for the {@link #ACTION_USB_STATE} broadcast.
Mike Lockwooda75075e12011-03-11 11:26:11 -0500122 *
123 * {@hide}
Mike Lockwood709981e2010-06-28 09:58:58 -0400124 */
125 public static final String USB_CONNECTED = "connected";
Mike Lockwood24236072010-06-23 17:36:36 -0400126
127 /**
Mike Lockwood02e45692011-06-14 15:43:51 -0400128 * Boolean extra indicating whether USB is configured.
Mike Lockwoodb92df0f2010-12-10 16:19:32 -0800129 * Used in extras for the {@link #ACTION_USB_STATE} broadcast.
Mike Lockwooda75075e12011-03-11 11:26:11 -0500130 *
131 * {@hide}
Mike Lockwoodb92df0f2010-12-10 16:19:32 -0800132 */
Mike Lockwood02e45692011-06-14 15:43:51 -0400133 public static final String USB_CONFIGURED = "configured";
Mike Lockwoodb92df0f2010-12-10 16:19:32 -0800134
135 /**
Mike Lockwood24236072010-06-23 17:36:36 -0400136 * Name of the USB mass storage USB function.
Mike Lockwoodb92df0f2010-12-10 16:19:32 -0800137 * Used in extras for the {@link #ACTION_USB_STATE} broadcast
Mike Lockwooda75075e12011-03-11 11:26:11 -0500138 *
139 * {@hide}
Mike Lockwood24236072010-06-23 17:36:36 -0400140 */
141 public static final String USB_FUNCTION_MASS_STORAGE = "mass_storage";
142
143 /**
144 * Name of the adb USB function.
Mike Lockwoodb92df0f2010-12-10 16:19:32 -0800145 * Used in extras for the {@link #ACTION_USB_STATE} broadcast
Mike Lockwooda75075e12011-03-11 11:26:11 -0500146 *
147 * {@hide}
Mike Lockwood24236072010-06-23 17:36:36 -0400148 */
149 public static final String USB_FUNCTION_ADB = "adb";
150
151 /**
152 * Name of the RNDIS ethernet USB function.
Mike Lockwoodb92df0f2010-12-10 16:19:32 -0800153 * Used in extras for the {@link #ACTION_USB_STATE} broadcast
Mike Lockwooda75075e12011-03-11 11:26:11 -0500154 *
155 * {@hide}
Mike Lockwood24236072010-06-23 17:36:36 -0400156 */
157 public static final String USB_FUNCTION_RNDIS = "rndis";
158
159 /**
160 * Name of the MTP USB function.
Mike Lockwoodb92df0f2010-12-10 16:19:32 -0800161 * Used in extras for the {@link #ACTION_USB_STATE} broadcast
Mike Lockwooda75075e12011-03-11 11:26:11 -0500162 *
163 * {@hide}
Mike Lockwood24236072010-06-23 17:36:36 -0400164 */
165 public static final String USB_FUNCTION_MTP = "mtp";
166
167 /**
Mike Lockwood9eb014a2011-06-08 09:17:45 -0700168 * Name of the PTP USB function.
169 * Used in extras for the {@link #ACTION_USB_STATE} broadcast
170 *
171 * {@hide}
172 */
173 public static final String USB_FUNCTION_PTP = "ptp";
174
175 /**
Mike Lockwood9182d3c2011-02-15 09:50:22 -0500176 * Name of the Accessory USB function.
Mike Lockwoodb92df0f2010-12-10 16:19:32 -0800177 * Used in extras for the {@link #ACTION_USB_STATE} broadcast
Mike Lockwooda75075e12011-03-11 11:26:11 -0500178 *
179 * {@hide}
Mike Lockwood24236072010-06-23 17:36:36 -0400180 */
Mike Lockwood9182d3c2011-02-15 09:50:22 -0500181 public static final String USB_FUNCTION_ACCESSORY = "accessory";
182
183 /**
Mike Lockwoode7d511e2010-12-30 13:39:37 -0500184 * Name of extra for {@link #ACTION_USB_DEVICE_ATTACHED} and
Mike Lockwood02eb8742011-02-27 09:10:37 -0800185 * {@link #ACTION_USB_DEVICE_DETACHED} broadcasts
Mike Lockwoode7d511e2010-12-30 13:39:37 -0500186 * containing the UsbDevice object for the device.
187 */
Mike Lockwood9182d3c2011-02-15 09:50:22 -0500188
Mike Lockwoode7d511e2010-12-30 13:39:37 -0500189 public static final String EXTRA_DEVICE = "device";
190
Mike Lockwood9182d3c2011-02-15 09:50:22 -0500191 /**
Mike Lockwood02eb8742011-02-27 09:10:37 -0800192 * Name of extra for {@link #ACTION_USB_ACCESSORY_ATTACHED} and
193 * {@link #ACTION_USB_ACCESSORY_DETACHED} broadcasts
Mike Lockwood9182d3c2011-02-15 09:50:22 -0500194 * containing the UsbAccessory object for the accessory.
195 */
196 public static final String EXTRA_ACCESSORY = "accessory";
197
Mike Lockwood3a68b832011-03-08 10:08:59 -0500198 /**
199 * Name of extra added to the {@link android.app.PendingIntent}
Mike Lockwood980f0432011-03-09 15:49:13 -0500200 * passed into {@link #requestPermission(UsbDevice, PendingIntent)}
201 * or {@link #requestPermission(UsbAccessory, PendingIntent)}
Mike Lockwood3a68b832011-03-08 10:08:59 -0500202 * containing a boolean value indicating whether the user granted permission or not.
203 */
204 public static final String EXTRA_PERMISSION_GRANTED = "permission";
205
206 private final Context mContext;
207 private final IUsbManager mService;
Mike Lockwoode7d511e2010-12-30 13:39:37 -0500208
209 /**
210 * {@hide}
211 */
Mike Lockwood3a68b832011-03-08 10:08:59 -0500212 public UsbManager(Context context, IUsbManager service) {
213 mContext = context;
Mike Lockwoode7d511e2010-12-30 13:39:37 -0500214 mService = service;
215 }
216
217 /**
218 * Returns a HashMap containing all USB devices currently attached.
219 * USB device name is the key for the returned HashMap.
220 * The result will be empty if no devices are attached, or if
221 * USB host mode is inactive or unsupported.
222 *
223 * @return HashMap containing all connected USB devices.
224 */
225 public HashMap<String,UsbDevice> getDeviceList() {
226 Bundle bundle = new Bundle();
227 try {
228 mService.getDeviceList(bundle);
229 HashMap<String,UsbDevice> result = new HashMap<String,UsbDevice>();
230 for (String name : bundle.keySet()) {
231 result.put(name, (UsbDevice)bundle.get(name));
232 }
233 return result;
234 } catch (RemoteException e) {
235 Log.e(TAG, "RemoteException in getDeviceList", e);
236 return null;
237 }
238 }
239
240 /**
241 * Opens the device so it can be used to send and receive
Mike Lockwoodc4308f02011-03-01 08:04:54 -0800242 * data using {@link android.hardware.usb.UsbRequest}.
Mike Lockwoode7d511e2010-12-30 13:39:37 -0500243 *
244 * @param device the device to open
245 * @return true if we successfully opened the device
246 */
Mike Lockwoodacc29cc2011-03-11 08:18:08 -0500247 public UsbDeviceConnection openDevice(UsbDevice device) {
Mike Lockwoode7d511e2010-12-30 13:39:37 -0500248 try {
Mike Lockwoodacc29cc2011-03-11 08:18:08 -0500249 String deviceName = device.getDeviceName();
250 ParcelFileDescriptor pfd = mService.openDevice(deviceName);
251 if (pfd != null) {
252 UsbDeviceConnection connection = new UsbDeviceConnection(device);
253 boolean result = connection.open(deviceName, pfd);
254 pfd.close();
255 if (result) {
256 return connection;
257 }
Mike Lockwoode7d511e2010-12-30 13:39:37 -0500258 }
Mike Lockwoode7d511e2010-12-30 13:39:37 -0500259 } catch (Exception e) {
260 Log.e(TAG, "exception in UsbManager.openDevice", e);
Mike Lockwoode7d511e2010-12-30 13:39:37 -0500261 }
Mike Lockwoodacc29cc2011-03-11 08:18:08 -0500262 return null;
Mike Lockwoode7d511e2010-12-30 13:39:37 -0500263 }
264
Mike Lockwood9182d3c2011-02-15 09:50:22 -0500265 /**
266 * Returns a list of currently attached USB accessories.
267 * (in the current implementation there can be at most one)
268 *
269 * @return list of USB accessories, or null if none are attached.
270 */
271 public UsbAccessory[] getAccessoryList() {
272 try {
273 UsbAccessory accessory = mService.getCurrentAccessory();
274 if (accessory == null) {
275 return null;
276 } else {
277 return new UsbAccessory[] { accessory };
278 }
279 } catch (RemoteException e) {
Mike Lockwood3a68b832011-03-08 10:08:59 -0500280 Log.e(TAG, "RemoteException in getAccessoryList", e);
Mike Lockwood9182d3c2011-02-15 09:50:22 -0500281 return null;
282 }
283 }
284
285 /**
286 * Opens a file descriptor for reading and writing data to the USB accessory.
287 *
288 * @param accessory the USB accessory to open
289 * @return file descriptor, or null if the accessor could not be opened.
290 */
291 public ParcelFileDescriptor openAccessory(UsbAccessory accessory) {
292 try {
Mike Lockwood02eb8742011-02-27 09:10:37 -0800293 return mService.openAccessory(accessory);
Mike Lockwood9182d3c2011-02-15 09:50:22 -0500294 } catch (RemoteException e) {
Mike Lockwood3a68b832011-03-08 10:08:59 -0500295 Log.e(TAG, "RemoteException in openAccessory", e);
Mike Lockwood9182d3c2011-02-15 09:50:22 -0500296 return null;
297 }
298 }
299
Mike Lockwood3a68b832011-03-08 10:08:59 -0500300 /**
301 * Returns true if the caller has permission to access the device.
Mike Lockwoodc6f23e82011-03-09 12:05:20 -0500302 * Permission might have been granted temporarily via
Mike Lockwood980f0432011-03-09 15:49:13 -0500303 * {@link #requestPermission(UsbDevice, PendingIntent)} or
Mike Lockwoodc6f23e82011-03-09 12:05:20 -0500304 * by the user choosing the caller as the default application for the device.
Mike Lockwood3a68b832011-03-08 10:08:59 -0500305 *
306 * @param device to check permissions for
307 * @return true if caller has permission
308 */
309 public boolean hasPermission(UsbDevice device) {
310 try {
311 return mService.hasDevicePermission(device);
312 } catch (RemoteException e) {
313 Log.e(TAG, "RemoteException in hasPermission", e);
314 return false;
315 }
316 }
317
318 /**
319 * Returns true if the caller has permission to access the accessory.
Mike Lockwoodc6f23e82011-03-09 12:05:20 -0500320 * Permission might have been granted temporarily via
Mike Lockwood980f0432011-03-09 15:49:13 -0500321 * {@link #requestPermission(UsbAccessory, PendingIntent)} or
Mike Lockwoodc6f23e82011-03-09 12:05:20 -0500322 * by the user choosing the caller as the default application for the accessory.
Mike Lockwood3a68b832011-03-08 10:08:59 -0500323 *
324 * @param accessory to check permissions for
325 * @return true if caller has permission
326 */
327 public boolean hasPermission(UsbAccessory accessory) {
328 try {
329 return mService.hasAccessoryPermission(accessory);
330 } catch (RemoteException e) {
331 Log.e(TAG, "RemoteException in hasPermission", e);
332 return false;
333 }
334 }
335
336 /**
Mike Lockwoodc6f23e82011-03-09 12:05:20 -0500337 * Requests temporary permission for the given package to access the device.
Mike Lockwood3a68b832011-03-08 10:08:59 -0500338 * This may result in a system dialog being displayed to the user
339 * if permission had not already been granted.
340 * Success or failure is returned via the {@link android.app.PendingIntent} pi.
Mike Lockwoodc6f23e82011-03-09 12:05:20 -0500341 * If successful, this grants the caller permission to access the device only
342 * until the device is disconnected.
343 *
Mike Lockwood3a68b832011-03-08 10:08:59 -0500344 * The following extras will be added to pi:
345 * <ul>
346 * <li> {@link #EXTRA_DEVICE} containing the device passed into this call
347 * <li> {@link #EXTRA_PERMISSION_GRANTED} containing boolean indicating whether
348 * permission was granted by the user
349 * </ul>
350 *
351 * @param device to request permissions for
352 * @param pi PendingIntent for returning result
353 */
354 public void requestPermission(UsbDevice device, PendingIntent pi) {
355 try {
356 mService.requestDevicePermission(device, mContext.getPackageName(), pi);
357 } catch (RemoteException e) {
358 Log.e(TAG, "RemoteException in requestPermission", e);
359 }
360 }
361
362 /**
Mike Lockwoodc6f23e82011-03-09 12:05:20 -0500363 * Requests temporary permission for the given package to access the accessory.
Mike Lockwood3a68b832011-03-08 10:08:59 -0500364 * This may result in a system dialog being displayed to the user
365 * if permission had not already been granted.
366 * Success or failure is returned via the {@link android.app.PendingIntent} pi.
Mike Lockwood62cfeeb2011-03-11 18:39:03 -0500367 * If successful, this grants the caller permission to access the accessory only
Mike Lockwoodc6f23e82011-03-09 12:05:20 -0500368 * until the device is disconnected.
369 *
Mike Lockwood3a68b832011-03-08 10:08:59 -0500370 * The following extras will be added to pi:
371 * <ul>
372 * <li> {@link #EXTRA_ACCESSORY} containing the accessory passed into this call
373 * <li> {@link #EXTRA_PERMISSION_GRANTED} containing boolean indicating whether
374 * permission was granted by the user
375 * </ul>
376 *
377 * @param accessory to request permissions for
378 * @param pi PendingIntent for returning result
379 */
380 public void requestPermission(UsbAccessory accessory, PendingIntent pi) {
381 try {
382 mService.requestAccessoryPermission(accessory, mContext.getPackageName(), pi);
383 } catch (RemoteException e) {
384 Log.e(TAG, "RemoteException in requestPermission", e);
385 }
386 }
387
Mike Lockwood02e45692011-06-14 15:43:51 -0400388 private static boolean propertyContainsFunction(String property, String function) {
389 String functions = SystemProperties.get(property, "");
390 int index = functions.indexOf(function);
391 if (index < 0) return false;
392 if (index > 0 && functions.charAt(index - 1) != ',') return false;
393 int charAfter = index + function.length();
394 if (charAfter < functions.length() && functions.charAt(charAfter) != ',') return false;
395 return true;
Mike Lockwood08bff3b2010-08-31 13:27:05 -0400396 }
397
398 /**
399 * Returns true if the specified USB function is currently enabled.
Mike Lockwoode7d511e2010-12-30 13:39:37 -0500400 *
401 * @param function name of the USB function
402 * @return true if the USB function is enabled.
Mike Lockwooda75075e12011-03-11 11:26:11 -0500403 *
404 * {@hide}
Mike Lockwood08bff3b2010-08-31 13:27:05 -0400405 */
Mike Lockwood02e45692011-06-14 15:43:51 -0400406 public boolean isFunctionEnabled(String function) {
407 return propertyContainsFunction("sys.usb.config", function);
408 }
409
410 /**
Mike Lockwoode51099f2011-08-02 12:54:49 -0400411 * Returns the current default USB function.
412 *
413 * @return name of the default function.
414 *
415 * {@hide}
416 */
417 public String getDefaultFunction() {
418 String functions = SystemProperties.get("persist.sys.usb.config", "");
419 int commaIndex = functions.indexOf(',');
420 if (commaIndex > 0) {
421 return functions.substring(0, commaIndex);
422 } else {
423 return functions;
424 }
425 }
426
427 /**
Mike Lockwoodf59717d2011-06-22 15:19:33 -0400428 * Sets the current USB function.
Mike Lockwood875c24b2011-07-18 10:54:32 -0700429 * If function is null, then the current function is set to the default function.
Mike Lockwood02e45692011-06-14 15:43:51 -0400430 *
Mike Lockwood875c24b2011-07-18 10:54:32 -0700431 * @param function name of the USB function, or null to restore the default function
432 * @param makeDefault true if the function should be set as the new default function
Mike Lockwood02e45692011-06-14 15:43:51 -0400433 *
434 * {@hide}
435 */
Mike Lockwoodf59717d2011-06-22 15:19:33 -0400436 public void setCurrentFunction(String function, boolean makeDefault) {
Mike Lockwood08bff3b2010-08-31 13:27:05 -0400437 try {
Mike Lockwoodf59717d2011-06-22 15:19:33 -0400438 mService.setCurrentFunction(function, makeDefault);
Mike Lockwood02e45692011-06-14 15:43:51 -0400439 } catch (RemoteException e) {
Mike Lockwoodf59717d2011-06-22 15:19:33 -0400440 Log.e(TAG, "RemoteException in setCurrentFunction", e);
Mike Lockwood02e45692011-06-14 15:43:51 -0400441 }
442 }
443
444 /**
445 * Sets the file path for USB mass storage backing file.
446 *
447 * @param path backing file path
448 *
449 * {@hide}
450 */
451 public void setMassStorageBackingFile(String path) {
452 try {
453 mService.setMassStorageBackingFile(path);
454 } catch (RemoteException e) {
455 Log.e(TAG, "RemoteException in setDefaultFunction", e);
Mike Lockwood9182d3c2011-02-15 09:50:22 -0500456 }
457 }
Mike Lockwood24236072010-06-23 17:36:36 -0400458}