From 188d00b07ef0b8968868b3489e80dd9f53d3bafa Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Wed, 23 Feb 2011 13:14:33 -0800 Subject: UsbManager: Remove redundant Intent extras from USB device and accessory broadcasts These extras are also accessable via the UsbDevice and UsbAccessory classes, which are also included as extras. Since you can't filter Intents based on extras there is no point in duplicating this information as separate extras. Change-Id: I4c8d1e70d66023a1800b3f8f06118898da6b37af Signed-off-by: Mike Lockwood --- .../src/com/android/camerabrowser/DeviceDisconnectedReceiver.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'media/tests') 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 -- cgit v1.1