Buggy code:
public class Tethering extends BaseNetworkObserver { private Context mContext ; private static final String TAG = "Tethering" ; private static final boolean DBG = true ; private static final boolean VDBG = false ; public static final String UPSTREAM_IFACE_CHANGED_ACTION = "com.android.server.connectivity.UPSTREAM_IFACE_CHANGED" ; public static final String EXTRA_UPSTREAM_IFACE = "tetheringUpstreamIface" ; public static final String EXTRA_TETHERED_IFACE = "tetheredClientIface" ; public static final String EXTRA_UPSTREAM_IP_TYPE = "tetheringUpstreamIpType" ; public static final String EXTRA_UPSTREAM_UPDATE_TYPE = "tetheringUpstreamUpdateType" ; public static final int EXTRA_UPSTREAM_INFO_DEFAULT = - 1 ; private enum UpstreamInfoUpdateType { UPSTREAM_IFACE_REMOVED , UPSTREAM_IFACE_ADDED ; } private String [ ] mTetherableUsbRegexs ; private String [ ] mTetherableWifiRegexs ; private String [ ] mTetherableBluetoothRegexs ; private Collection < Integer > mUpstreamIfaceTypes ; private Object mPublicSync ; private static final Integer MOBILE_TYPE = new Integer ( ConnectivityManager . TYPE_MOBILE ) ; private static final Integer HIPRI_TYPE = new Integer ( ConnectivityManager . TYPE_MOBILE_HIPRI ) ; private static final Integer DUN_TYPE = new Integer ( ConnectivityManager . TYPE_MOBILE_DUN ) ; private int mPreferredUpstreamMobileApn = ConnectivityManager . TYPE_NONE ; private final INetworkManagementService mNMService ; private final INetworkStatsService mStatsService ; private Looper mLooper ; private HashMap < String , Tethering . TetherInterfaceSM > mIfaces ; private BroadcastReceiver mStateReceiver ; private static final String USB_NEAR_IFACE_ADDR = "192.168.42.129" ; private static final int USB_PREFIX_LENGTH = 24 ; private String [ ] mDhcpRange ; private static final String [ ] DHCP_DEFAULT_RANGE = new String [ ] { "192.168.42.2" , "192.168.42.254" , "192.168.43.2" , "192.168.43.254" , "192.168.44.2" , "192.168.44.254" , "192.168.45.2" , "192.168.45.254" , "192.168.46.2" , "192.168.46.254" , "192.168.47.2" , "192.168.47.254" , "192.168.48.2" , "192.168.48.254" , "192.168.49.2" , "192.168.49.254" } ; private String [ ] mDefaultDnsServers ; private static final String DNS_DEFAULT_SERVER1 = "8.8.8.8" ; private static final String DNS_DEFAULT_SERVER2 = "8.8.4.4" ; private static final String ACTION_TURN_WIFI_AP_OFF = "com.android.server.ACTION_TURN_WIFI_AP_OFF" ; private static Tethering . NotificationBroadcastReciever mNotificationBroadcastReceiver = null ; private StateMachine mTetherMasterSM ; private Notification mTetheredNotification ; private boolean mRndisEnabled ; private boolean mUsbTetherRequested ; private HashMap < String , WifiDevice > mL2ConnectedDeviceMap = new HashMap < String , WifiDevice > ( ) ; private HashMap < String , WifiDevice > mConnectedDeviceMap = new HashMap < String , WifiDevice > ( ) ; private static final String dhcpLocation = "//data//misc//dhcp//dnsmasq.leases" ; private static final int DNSMASQ_POLLING_INTERVAL = 1000 ; private static final int DNSMASQ_POLLING_MAX_TIMES = 10 ; public Tethering ( Context context , INetworkManagementService nmService , INetworkStatsService statsService , Looper looper ) { } private ConnectivityManager getConnectivityManager ( ) { } void updateConfiguration ( ) { } public void interfaceStatusChanged ( String iface , boolean up ) { if ( Tethering . VDBG ) Log . d ( Tethering . TAG , ( ( ( "interfaceStatusChanged<seq2seq4repair_space>" + iface ) + ",<seq2seq4repair_space>" ) + up ) ) ; boolean found = false ; boolean usb = false ; synchronized ( mPublicSync ) { if ( isWifi ( iface ) ) { found = true ; } else if ( isUsb ( iface ) ) { found = true ; usb = true ; } else if ( isBluetooth ( iface ) ) { found = true ; } if ( found == false ) return ; Tethering . TetherInterfaceSM sm = mIfaces . get ( iface ) ; if ( up ) { if ( sm == null ) { sm = new Tethering . TetherInterfaceSM ( iface , mLooper , usb ) ; mIfaces . put ( iface , sm ) ; sm . start ( ) ; } } else { <START_BUG> if ( isUsb ( iface ) ) { <END_BUG> if ( Tethering . VDBG ) Log . d ( Tethering . TAG , ( "ignore<seq2seq4repair_space>interface<seq2seq4repair_space>down<seq2seq4repair_space>for<seq2seq4repair_space>" + iface ) ) ; } else if ( sm != null ) { sm . sendMessage ( Tethering . TetherInterfaceSM . CMD_INTERFACE_DOWN ) ; mIfaces . remove ( iface ) ; } } } } public void interfaceLinkStateChanged ( String iface , boolean up ) { } private boolean isUsb ( String iface ) { } public boolean isWifi ( String iface ) { } public boolean isBluetooth ( String iface ) { } public void interfaceAdded ( String iface ) { } public void interfaceRemoved ( String iface ) { } public List < WifiDevice > getTetherConnectedSta ( ) { } private void sendTetherConnectStateChangedBroadcast ( ) { } private boolean readDeviceInfoFromDnsmasq ( WifiDevice device ) { } private static class DnsmasqThread extends Thread { private final Tethering mTethering ; private int mInterval ; private int mMaxTimes ; private WifiDevice mDevice ; public DnsmasqThread ( Tethering tethering , WifiDevice device , int interval , int maxTimes ) { } public void run ( ) { } } public void interfaceMessageRecevied ( String message ) { } public int tether ( String iface ) { } public int untether ( String iface ) { } public int getLastTetherError ( String iface ) { } private void sendTetherStateChangedBroadcast ( ) { } private void sendUpstreamIfaceChangeBroadcast ( String upstreamIface , String tetheredIface , int ip_type , Tethering . UpstreamInfoUpdateType update_type ) { } private void showTetheredNotification ( int icon ) { } private void clearTetheredNotification ( ) { } private class StateReceiver extends BroadcastReceiver { @ Override public void onReceive ( Context content , Intent intent ) { } } private void tetherUsb ( boolean enable ) { } private boolean configureUsbIface ( boolean enabled ) { } public String [ ] getTetherableUsbRegexs ( ) { } public String [ ] getTetherableWifiRegexs ( ) { } public String [ ] getTetherableBluetoothRegexs ( ) { } public int setUsbTethering ( boolean enable ) { } public int [ ] getUpstreamIfaceTypes ( ) { } public void checkDunRequired ( ) { } public String [ ] getTetheredIfaces ( ) { } public String [ ] getTetherableIfaces ( ) { } public String [ ] getTetheredDhcpRanges ( ) { } public String [ ] getErroredIfaces ( ) { } class TetherInterfaceSM extends StateMachine { static final int CMD_TETHER_MODE_DEAD = 1 ; static final int CMD_TETHER_REQUESTED = 2 ;

Fix:
if ( ( isUsb ( iface ) ) || ( isBluetooth ( iface ) ) ) {