Loading services/java/com/android/server/usb/UsbService.java +11 −6 Original line number Diff line number Diff line Loading @@ -561,11 +561,14 @@ public class UsbService extends IUsbManager.Stub { case MSG_UPDATE_STATE: if (mConnected != mLastConnected || mConfiguration != mLastConfiguration) { if (mConnected == 0) { if (UsbManager.isFunctionEnabled( UsbManager.USB_FUNCTION_ACCESSORY)) { // make sure accessory mode is off, and restore default functions if (mCurrentAccessory != null && UsbManager.setFunctionEnabled( UsbManager.USB_FUNCTION_ACCESSORY, false)) { Log.d(TAG, "exited USB accessory mode"); if (!UsbManager.setFunctionEnabled (UsbManager.USB_FUNCTION_ACCESSORY, false)) { Log.e(TAG, "could not disable accessory function"); } int count = mDefaultFunctions.size(); for (int i = 0; i < count; i++) { String function = mDefaultFunctions.get(i); Loading @@ -574,10 +577,12 @@ public class UsbService extends IUsbManager.Stub { } } if (mCurrentAccessory != null) { mDeviceManager.accessoryDetached(mCurrentAccessory); mCurrentAccessory = null; } } } final ContentResolver cr = mContext.getContentResolver(); if (Settings.Secure.getInt(cr, Loading Loading
services/java/com/android/server/usb/UsbService.java +11 −6 Original line number Diff line number Diff line Loading @@ -561,11 +561,14 @@ public class UsbService extends IUsbManager.Stub { case MSG_UPDATE_STATE: if (mConnected != mLastConnected || mConfiguration != mLastConfiguration) { if (mConnected == 0) { if (UsbManager.isFunctionEnabled( UsbManager.USB_FUNCTION_ACCESSORY)) { // make sure accessory mode is off, and restore default functions if (mCurrentAccessory != null && UsbManager.setFunctionEnabled( UsbManager.USB_FUNCTION_ACCESSORY, false)) { Log.d(TAG, "exited USB accessory mode"); if (!UsbManager.setFunctionEnabled (UsbManager.USB_FUNCTION_ACCESSORY, false)) { Log.e(TAG, "could not disable accessory function"); } int count = mDefaultFunctions.size(); for (int i = 0; i < count; i++) { String function = mDefaultFunctions.get(i); Loading @@ -574,10 +577,12 @@ public class UsbService extends IUsbManager.Stub { } } if (mCurrentAccessory != null) { mDeviceManager.accessoryDetached(mCurrentAccessory); mCurrentAccessory = null; } } } final ContentResolver cr = mContext.getContentResolver(); if (Settings.Secure.getInt(cr, Loading