summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--services/usb/java/com/android/server/usb/UsbDeviceManager.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
index 3fecfb6..73a2ee6 100644
--- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -580,7 +580,13 @@ public class UsbDeviceManager {
if (mConfigured && enteringAccessoryMode) {
// successfully entered accessory mode
-
+ if (mCurrentAccessory != null) {
+ Slog.w(TAG, "USB accessory re-attached, detach was not announced!");
+ if (mBootCompleted) {
+ getCurrentSettings().accessoryDetached(mCurrentAccessory);
+ }
+ mCurrentAccessory = null;
+ }
if (mAccessoryStrings != null) {
mCurrentAccessory = new UsbAccessory(mAccessoryStrings);
Slog.d(TAG, "entering USB accessory mode: " + mCurrentAccessory);