Buggy code:
private static final String ACTION_USBLAN_DOWN = "com.motorola.intent.action.USBLANDOWN" ; private static final String ACTION_USB_RECONFIGURED = "com.android.internal.usb.reconfigured" ; public static final String EXTRA_MODE_SWITCH_MODE = "USB_MODE_INDEX" ; public static final String EXTRA_ERROR_MODE_STRING = "USB_MODE_STRING" ; public static final String EXTRA_TETHERING_STATE = "state" ; private static final String EXTRA_RECONFIGURE_CONNECTED = "connected" ; private static class ModeInfo { String name ; String mode ; String adbMode ; public ModeInfo ( String name , String mode , String adbMode ) { } } private static final HashMap < Integer , UsbService . ModeInfo > sModes = new HashMap < Integer , UsbService . ModeInfo > ( ) ; public static final int USB_MODE_NGP = 0 ; public static final int USB_MODE_MTP = 1 ; public static final int USB_MODE_MSC = 2 ; public static final int USB_MODE_RNDIS = 3 ; public static final int USB_MODE_MODEM = 4 ; public static final int USB_MODE_NONE = 5 ; public static final int USB_STATE_IDLE = 0 ; public static final int USB_STATE_WAIT_ENUM = 1 ; public static final int USB_STATE_SERVICE_STARTUP = 2 ; public static final int USB_STATE_SWITCH_DEVNOD_CLOSE = 3 ; public static final int USB_STATE_DETACH_DEVNOD_CLOSE = 4 ; public static final int USB_STATE_ATTACH_DEVNOD_CLOSE = 5 ; public static final int USB_SWITCH_FROM_IDLE = - 1 ; public static final int USB_SWITCH_FROM_UI = 0 ; public static final int USB_SWITCH_FROM_AT_CMD = 1 ; public static final int USB_SWITCH_FROM_ADB = 2 ; public static final int USB_SWITCH_FROM_USBD = 3 ; private static final int EVENT_CABLE_INSERTED = 0 ; private static final int EVENT_ENUMERATED = 1 ; private static final int EVENT_ENUMERATION_OK = 2 ; private static final int EVENT_ENUMERATION_FAILED = 3 ; private static final int EVENT_CABLE_REMOVED = 4 ; private static final int EVENT_START_SERVICE = 5 ; private static final int EVENT_DEVNODE_CLOSED = 6 ; private static final int EVENT_SWITCH = 7 ; public static final int MSG_CABLE_ATTACHED = 1 ; public static final int MSG_CABLE_DETACHED = 2 ; public static final int MSG_ENUMERATED = 3 ; public static final int MSG_GET_DESCRIPTOR = 4 ; public static final int MSG_ADB_CHANGE = 5 ; public static final int MSG_START_SERVICE = 6 ; public static final int MSG_USBD_MODE_SWITCH = 7 ; public static final int MSG_MODE_SWITCH_COMPLETE = 8 ; private int mUsbState = UsbService . USB_STATE_IDLE ; private int mIsSwitchFrom = UsbService . USB_SWITCH_FROM_IDLE ; private int mNewUsbMode = UsbService . USB_MODE_NONE ; private boolean mUsbCableAttached = false ; private boolean mUsbLanIntentSent = false ; private boolean mADBEnabled = false ; private boolean mAtCmdServiceStopped = false ; private boolean mMtpServiceStopped = false ; private boolean mRndisServiceStopped = false ; private int mADBStatusChangeMissedNumber = 0 ; private boolean mMediaMountedReceiverRegistered = false ; private boolean mPreparingUms = false ; private UsbListener mUsbListener ; private File mCurrentStateFile ; private Notification mNotification ; private PendingIntent mModeSelectionIntent ; private Timer mWaitForDevCloseTimer ; private ITelephony mPhoneService ; private StorageManager mStorageManager ; private NotificationManager mNotifManager ; private HandlerThread mStorageThread ; private Handler mStorageHandler ; private Toast mConnectedToast ; private Handler mHandler = new Handler ( ) { @ Override public void handleMessage ( Message msg ) { } } ; private BroadcastReceiver mUsbServiceReceiver = new BroadcastReceiver ( ) { @ Override public void onReceive ( Context context , Intent intent ) { } } ; private StorageEventListener mStorageListener = new StorageEventListener ( ) { @ Override public void onStorageStateChanged ( String path , String oldState , String newState ) { } } ; private BroadcastReceiver mMediaMountedReceiver = new BroadcastReceiver ( ) { @ Override public void onReceive ( Context context , Intent intent ) { } } ; private UEventObserver mUEventObserver = new UEventObserver ( ) { @ Override public void onUEvent ( UEvent uevent ) { } } ; @ Override public IBinder onBind ( Intent paramIntent ) { } @ Override public void onCreate ( ) { } @ Override public void onDestroy ( ) { } private synchronized void handleUsbEvent ( int event ) { } private void deviceEnumPreAction ( ) { } private void deviceEnumPostAction ( ) { } private void startAtCmdService ( ) { } private void stopAtCmdService ( ) { } private void startMtpService ( ) { } private void stopMtpService ( ) { } private void startRndisService ( ) { } private void stopRndisService ( ) { } private void sendUsblanDownIntent ( ) { } private void sendUsblanUpIntent ( ) { } private void startWaitDevNodeClosedTimer ( ) { } private void stopWaitDevNodeClosedTimer ( ) { } private void usbModeSwitchFail ( ) { } private void handleAtCmdMtpDevClosed ( ) { } private int getCurrentUsbMode ( ) { } private String getSwitchCommand ( int mode ) { } private int getStringResForMode ( int mode ) { } private void changeMassStorageMode ( final boolean enable ) { } private void enableInternalDataConnectivity ( boolean enable ) { Log . d ( UsbService . TAG , ( "enableInternalDataConnectivity():<seq2seq4repair_space>" + enable ) ) ; try { if ( enable ) { mPhoneService . enableDataConnectivity ( ) ; } else { mPhoneService . disableDataConnectivity ( ) ; } <START_BUG> } catch ( RemoteException e ) { <END_BUG> Log . d ( UsbService . TAG , "Switching<seq2seq4repair_space>data<seq2seq4repair_space>connectivity<seq2seq4repair_space>failed" , e ) ; } } private String getUsbModeString ( int mode ) { } private void setUsbConnectionNotificationVisibility ( boolean visible , boolean forceDefaultSound ) { } private void emitReconfigurationIntent ( boolean connected ) { } private void updateUsbStateFile ( boolean connected , int mode ) { } private void setUsbModeFromAtCmd ( int mode ) { } private void showConnectedToast ( int mode ) { } private void setUsbModeFromUI ( int mode ) { } public void handleAdbStateChange ( boolean enable ) { } public void handleGetDescriptor ( ) { } public void handleStartService ( String event ) { } public void handleUsbCableDetachment ( ) { } public void handleUsbModeSwitchFromUsbd ( String message ) { } private void handleUsbTetheringToggled ( boolean enabled ) { } private void updateModeMapOverrides ( ) { } private String readUsbStateFile ( ) { } private void setInitialModeFromState ( String state ) { } }

Fix:
} catch ( Exception e ) {