summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.xml110
-rw-r--r--core/java/android/hardware/UsbManager.java75
-rw-r--r--media/java/android/mtp/MtpClient.java5
-rw-r--r--media/tests/CameraBrowser/src/com/android/camerabrowser/DeviceDisconnectedReceiver.java4
-rw-r--r--services/java/com/android/server/UsbService.java21
5 files changed, 9 insertions, 206 deletions
diff --git a/api/current.xml b/api/current.xml
index c4fc0e4..18b9f6e 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -95368,50 +95368,6 @@
visibility="public"
>
</field>
-<field name="EXTRA_ACCESSORY_MANUFACTURER"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value="&quot;accessory-manufacturer&quot;"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="EXTRA_ACCESSORY_PRODUCT"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value="&quot;accessory-product&quot;"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="EXTRA_ACCESSORY_TYPE"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value="&quot;accessory-type&quot;"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="EXTRA_ACCESSORY_VERSION"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value="&quot;accessory-version&quot;"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="EXTRA_DEVICE"
type="java.lang.String"
transient="false"
@@ -95423,72 +95379,6 @@
visibility="public"
>
</field>
-<field name="EXTRA_DEVICE_CLASS"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value="&quot;device_class&quot;"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="EXTRA_DEVICE_NAME"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value="&quot;device_name&quot;"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="EXTRA_DEVICE_PROTOCOL"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value="&quot;device_protocol&quot;"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="EXTRA_DEVICE_SUBCLASS"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value="&quot;device_subclass&quot;"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="EXTRA_PRODUCT_ID"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value="&quot;product_id&quot;"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="EXTRA_VENDOR_ID"
- type="java.lang.String"
- transient="false"
- volatile="false"
- value="&quot;vendor_id&quot;"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
<field name="USB_CONFIGURATION"
type="java.lang.String"
transient="false"
diff --git a/core/java/android/hardware/UsbManager.java b/core/java/android/hardware/UsbManager.java
index 0f616ff..dcfdcf4 100644
--- a/core/java/android/hardware/UsbManager.java
+++ b/core/java/android/hardware/UsbManager.java
@@ -62,12 +62,6 @@ public class UsbManager {
*
* This intent is sent when a USB device is attached to the USB bus when in host mode.
* <ul>
- * <li> {@link #EXTRA_DEVICE_NAME} containing the device's name (String)
- * <li> {@link #EXTRA_VENDOR_ID} containing the device's vendor ID (Integer)
- * <li> {@link #EXTRA_PRODUCT_ID} containing the device's product ID (Integer)
- * <li> {@link #EXTRA_DEVICE_CLASS} } containing the device class (Integer)
- * <li> {@link #EXTRA_DEVICE_SUBCLASS} containing the device subclass (Integer)
- * <li> {@link #EXTRA_DEVICE_PROTOCOL} containing the device protocol (Integer)
* <li> {@link #EXTRA_DEVICE} containing the {@link android.hardware.UsbDevice}
* for the attached device
* </ul>
@@ -80,7 +74,8 @@ public class UsbManager {
*
* This intent is sent when a USB device is detached from the USB bus when in host mode.
* <ul>
- * <li> {@link #EXTRA_DEVICE_NAME} containing the device's name (String)
+ * <li> {@link #EXTRA_DEVICE} containing the {@link android.hardware.UsbDevice}
+ * for the detached device
* </ul>
*/
public static final String ACTION_USB_DEVICE_DETACHED =
@@ -91,10 +86,6 @@ public class UsbManager {
*
* This intent is sent when a USB accessory is attached.
* <ul>
- * <li> {@link #EXTRA_ACCESSORY_MANUFACTURER} containing the accessory's manufacturer (String)
- * <li> {@link #EXTRA_ACCESSORY_PRODUCT} containing the accessory's product name (String)
- * <li> {@link #EXTRA_ACCESSORY_TYPE} containing the accessory's type (String)
- * <li> {@link #EXTRA_ACCESSORY_VERSION} containing the accessory's version (String)
* <li> {@link #EXTRA_ACCESSORY} containing the {@link android.hardware.UsbAccessory}
* for the attached accessory
* </ul>
@@ -172,43 +163,7 @@ public class UsbManager {
/**
* Name of extra for {@link #ACTION_USB_DEVICE_ATTACHED} and
- * {@link #ACTION_USB_DEVICE_DETACHED} broadcasts
- * containing the device's ID (String).
- */
- public static final String EXTRA_DEVICE_NAME = "device_name";
-
- /**
- * Name of extra for {@link #ACTION_USB_DEVICE_ATTACHED} broadcast
- * containing the device's vendor ID (int).
- */
- public static final String EXTRA_VENDOR_ID = "vendor_id";
-
- /**
- * Name of extra for {@link #ACTION_USB_DEVICE_ATTACHED} broadcast
- * containing the device's product ID (int).
- */
- public static final String EXTRA_PRODUCT_ID = "product_id";
-
- /**
- * Name of extra for {@link #ACTION_USB_DEVICE_ATTACHED} broadcast
- * containing the device's class (int).
- */
- public static final String EXTRA_DEVICE_CLASS = "device_class";
-
- /**
- * Name of extra for {@link #ACTION_USB_DEVICE_ATTACHED} broadcast
- * containing the device's class (int).
- */
- public static final String EXTRA_DEVICE_SUBCLASS = "device_subclass";
-
- /**
- * Name of extra for {@link #ACTION_USB_DEVICE_ATTACHED} broadcast
- * containing the device's class (int).
- */
- public static final String EXTRA_DEVICE_PROTOCOL = "device_protocol";
-
- /**
- * Name of extra for {@link #ACTION_USB_DEVICE_ATTACHED} broadcast
+ * {@link #ACTION_USB_DEVICE_DETACHED} broadcasts.
* containing the UsbDevice object for the device.
*/
@@ -220,30 +175,6 @@ public class UsbManager {
*/
public static final String EXTRA_ACCESSORY = "accessory";
- /**
- * Name of extra for {@link #ACTION_USB_ACCESSORY_ATTACHED} broadcast
- * containing the accessory's manufacturer name.
- */
- public static final String EXTRA_ACCESSORY_MANUFACTURER = "accessory-manufacturer";
-
- /**
- * Name of extra for {@link #ACTION_USB_ACCESSORY_ATTACHED} broadcast
- * containing the accessory's product name.
- */
- public static final String EXTRA_ACCESSORY_PRODUCT = "accessory-product";
-
- /**
- * Name of extra for {@link #ACTION_USB_ACCESSORY_ATTACHED} broadcast
- * containing the accessory's type.
- */
- public static final String EXTRA_ACCESSORY_TYPE = "accessory-type";
-
- /**
- * Name of extra for {@link #ACTION_USB_ACCESSORY_ATTACHED} broadcast
- * containing the accessory's version.
- */
- public static final String EXTRA_ACCESSORY_VERSION = "accessory-version";
-
private IUsbManager mService;
/**
diff --git a/media/java/android/mtp/MtpClient.java b/media/java/android/mtp/MtpClient.java
index 568ac94..a5ee77c 100644
--- a/media/java/android/mtp/MtpClient.java
+++ b/media/java/android/mtp/MtpClient.java
@@ -48,15 +48,14 @@ public class MtpClient {
private final BroadcastReceiver mUsbReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- String deviceName = intent.getStringExtra(UsbManager.EXTRA_DEVICE_NAME);
+ UsbDevice usbDevice = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
+ String deviceName = usbDevice.getDeviceName();
synchronized (mDeviceList) {
MtpDevice mtpDevice = getDeviceLocked(deviceName);
if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(intent.getAction())) {
if (mtpDevice == null) {
- UsbDevice usbDevice =
- (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
mtpDevice = openDevice(usbDevice);
}
if (mtpDevice != null) {
diff --git a/media/tests/CameraBrowser/src/com/android/camerabrowser/DeviceDisconnectedReceiver.java b/media/tests/CameraBrowser/src/com/android/camerabrowser/DeviceDisconnectedReceiver.java
index 736af1f..1155807 100644
--- a/media/tests/CameraBrowser/src/com/android/camerabrowser/DeviceDisconnectedReceiver.java
+++ b/media/tests/CameraBrowser/src/com/android/camerabrowser/DeviceDisconnectedReceiver.java
@@ -21,6 +21,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.hardware.UsbDevice;
import android.hardware.UsbManager;
import android.util.Log;
@@ -41,7 +42,8 @@ public class DeviceDisconnectedReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
- String deviceName = intent.getStringExtra(UsbManager.EXTRA_DEVICE_NAME);
+ UsbDevice device = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
+ String deviceName = device.getDeviceName();
Log.d(TAG, "ACTION_USB_DEVICE_DETACHED " + deviceName);
// close our activity if the device it is displaying is disconnected
diff --git a/services/java/com/android/server/UsbService.java b/services/java/com/android/server/UsbService.java
index 1bc203e..2f84713 100644
--- a/services/java/com/android/server/UsbService.java
+++ b/services/java/com/android/server/UsbService.java
@@ -143,19 +143,6 @@ class UsbService extends IUsbManager.Stub {
mCurrentAccessory = new UsbAccessory(strings);
Intent intent = new Intent(UsbManager.ACTION_USB_ACCESSORY_ATTACHED);
intent.putExtra(UsbManager.EXTRA_ACCESSORY, mCurrentAccessory);
- // add strings as separate extras to allow filtering
- if (strings[0] != null) {
- intent.putExtra(UsbManager.EXTRA_ACCESSORY_MANUFACTURER, strings[0]);
- }
- if (strings[1] != null) {
- intent.putExtra(UsbManager.EXTRA_ACCESSORY_PRODUCT, strings[1]);
- }
- if (strings[2] != null) {
- intent.putExtra(UsbManager.EXTRA_ACCESSORY_TYPE, strings[2]);
- }
- if (strings[3] != null) {
- intent.putExtra(UsbManager.EXTRA_ACCESSORY_VERSION, strings[3]);
- }
mContext.sendBroadcast(intent);
} else {
Log.e(TAG, "nativeGetAccessoryStrings failed");
@@ -360,12 +347,6 @@ class UsbService extends IUsbManager.Stub {
mDevices.put(deviceName, device);
Intent intent = new Intent(UsbManager.ACTION_USB_DEVICE_ATTACHED);
- intent.putExtra(UsbManager.EXTRA_DEVICE_NAME, deviceName);
- intent.putExtra(UsbManager.EXTRA_VENDOR_ID, vendorID);
- intent.putExtra(UsbManager.EXTRA_PRODUCT_ID, productID);
- intent.putExtra(UsbManager.EXTRA_DEVICE_CLASS, deviceClass);
- intent.putExtra(UsbManager.EXTRA_DEVICE_SUBCLASS, deviceSubclass);
- intent.putExtra(UsbManager.EXTRA_DEVICE_PROTOCOL, deviceProtocol);
intent.putExtra(UsbManager.EXTRA_DEVICE, device);
Log.d(TAG, "usbDeviceAdded, sending " + intent);
mContext.sendBroadcast(intent);
@@ -378,7 +359,7 @@ class UsbService extends IUsbManager.Stub {
UsbDevice device = mDevices.remove(deviceName);
if (device != null) {
Intent intent = new Intent(UsbManager.ACTION_USB_DEVICE_DETACHED);
- intent.putExtra(UsbManager.EXTRA_DEVICE_NAME, deviceName);
+ intent.putExtra(UsbManager.EXTRA_DEVICE, device);
Log.d(TAG, "usbDeviceRemoved, sending " + intent);
mContext.sendBroadcast(intent);
}