Home | History | Annotate | Download | only in hardware
      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 
     18 package android.hardware;
     19 
     20 /**
     21  * Class for accessing USB state information.
     22  * @hide
     23  */
     24 public class Usb {
     25    /**
     26      * Broadcast Action:  A broadcast for USB connected events.
     27      *
     28      * The extras bundle will name/value pairs with the name of the function
     29      * and a value of either {@link #USB_FUNCTION_ENABLED} or {@link #USB_FUNCTION_DISABLED}.
     30      * Possible USB function names include {@link #USB_FUNCTION_MASS_STORAGE},
     31      * {@link #USB_FUNCTION_ADB}, {@link #USB_FUNCTION_RNDIS} and {@link #USB_FUNCTION_MTP}.
     32      */
     33     public static final String ACTION_USB_CONNECTED =
     34             "android.hardware.action.USB_CONNECTED";
     35 
     36    /**
     37      * Broadcast Action:  A broadcast for USB disconnected events.
     38      */
     39     public static final String ACTION_USB_DISCONNECTED =
     40             "android.hardware.action.USB_DISCONNECTED";
     41 
     42    /**
     43      * Broadcast Action:  A sticky broadcast for USB state change events.
     44      *
     45      * This is a sticky broadcast for clients that are interested in both USB connect and
     46      * disconnect events.  If you are only concerned with one or the other, you can use
     47      * {@link #ACTION_USB_CONNECTED} or {@link #ACTION_USB_DISCONNECTED} to avoid receiving
     48      * unnecessary broadcasts.  The boolean {@link #USB_CONNECTED} extra indicates whether
     49      * USB is connected or disconnected.
     50      * The extras bundle will also contain name/value pairs with the name of the function
     51      * and a value of either {@link #USB_FUNCTION_ENABLED} or {@link #USB_FUNCTION_DISABLED}.
     52      * Possible USB function names include {@link #USB_FUNCTION_MASS_STORAGE},
     53      * {@link #USB_FUNCTION_ADB}, {@link #USB_FUNCTION_RNDIS} and {@link #USB_FUNCTION_MTP}.
     54      */
     55     public static final String ACTION_USB_STATE =
     56             "android.hardware.action.USB_STATE";
     57 
     58     /**
     59      * Boolean extra indicating whether USB is connected or disconnected.
     60      * Used in extras for the {@link #ACTION_USB_STATE} broadcast.
     61      */
     62     public static final String USB_CONNECTED = "connected";
     63 
     64     /**
     65      * Name of the USB mass storage USB function.
     66      * Used in extras for the {@link #ACTION_USB_CONNECTED} broadcast
     67      */
     68     public static final String USB_FUNCTION_MASS_STORAGE = "mass_storage";
     69 
     70     /**
     71      * Name of the adb USB function.
     72      * Used in extras for the {@link #ACTION_USB_CONNECTED} broadcast
     73      */
     74     public static final String USB_FUNCTION_ADB = "adb";
     75 
     76     /**
     77      * Name of the RNDIS ethernet USB function.
     78      * Used in extras for the {@link #ACTION_USB_CONNECTED} broadcast
     79      */
     80     public static final String USB_FUNCTION_RNDIS = "rndis";
     81 
     82     /**
     83      * Name of the MTP USB function.
     84      * Used in extras for the {@link #ACTION_USB_CONNECTED} broadcast
     85      */
     86     public static final String USB_FUNCTION_MTP = "mtp";
     87 
     88     /**
     89      * Value indicating that a USB function is enabled.
     90      * Used in extras for the {@link #ACTION_USB_CONNECTED} broadcast
     91      */
     92     public static final String USB_FUNCTION_ENABLED = "enabled";
     93 
     94     /**
     95      * Value indicating that a USB function is disabled.
     96      * Used in extras for the {@link #ACTION_USB_CONNECTED} broadcast
     97      */
     98     public static final String USB_FUNCTION_DISABLED = "disabled";
     99 }
    100