diff options
| author | 2017-07-11 16:34:41 -0700 | |
|---|---|---|
| committer | 2017-07-12 18:47:07 +0000 | |
| commit | 6276bb899e810655fab9083393c7f4d2a494b7d7 (patch) | |
| tree | 38d6964075253793fff2dc1b755546f3a4a240b4 /services/usb/java | |
| parent | f922271d4e1a6532e38748b666db8ed4f3059e17 (diff) | |
Clear mCurrentAccessory if accessory function is no longer enabled
Accessory mode implements debounce timeout ACCESSORY_REQUEST_TIMEOUT
within which when a disconnect is seen, the accessory function would
be removed from the usb configuration but mCurrentAccessory would
not be set to NULL until the timeout expires.
Also, setEnabledFunctions(null, false, false) does not force an
additional disconnect when accessory function has already been
removed from usb configuration.
BUG: 62241238
Change-Id: I25973475fb02d613e11396bcad5e88656ad8940a
Diffstat (limited to 'services/usb/java')
| -rw-r--r-- | services/usb/java/com/android/server/usb/UsbDeviceManager.java | 4 |
1 files changed, 3 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 a7180c989a6e..a5797c01691f 100644 --- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java +++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java @@ -1032,7 +1032,9 @@ public class UsbDeviceManager { if (DEBUG) { Slog.v(TAG, "Accessory mode enter timeout: " + mConnected); } - if (!mConnected) { + if (!mConnected || !UsbManager.containsFunction( + mCurrentFunctions, + UsbManager.USB_FUNCTION_ACCESSORY)) { notifyAccessoryModeExit(); } break; |