Program: 182100
Project: 182100
Buggy source:
WifiService(Context context,WifiStateTracker tracker){
  mContext=context;
  mWifiStateTracker=tracker;
  mWifiStateTracker.enableRssiPolling(true);
  mBatteryStats=BatteryStatsService.getService();
  IBinder b=ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
  nwService=INetworkManagementService.Stub.asInterface(b);
  mScanResultCache=new LinkedHashMap<String,ScanResult>(SCAN_RESULT_CACHE_SIZE,0.75f,true){
    public boolean removeEldestEntry(    Map.Entry eldest){
      return SCAN_RESULT_CACHE_SIZE < this.size();
    }
  }
;
  HandlerThread wifiThread=new HandlerThread("String_Node_Str");
  wifiThread.start();
  mWifiHandler=new WifiHandler(wifiThread.getLooper());
  mWifiStateTracker.setWifiState(WIFI_STATE_DISABLED);
  mWifiApState=WIFI_AP_STATE_DISABLED;
  mAlarmManager=(AlarmManager)mContext.getSystemService(Context.ALARM_SERVICE);
  Intent idleIntent=new Intent(ACTION_DEVICE_IDLE,null);
  mIdleIntent=PendingIntent.getBroadcast(mContext,IDLE_REQUEST,idleIntent,0);
  PowerManager powerManager=(PowerManager)mContext.getSystemService(Context.POWER_SERVICE);
  sWakeLock=powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,WAKELOCK_TAG);
  sDriverStopWakeLock=powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,WAKELOCK_TAG);
  mWifiStateTracker.setReleaseWakeLockCallback(new Runnable(){
    public void run(){
      mWifiHandler.removeMessages(MESSAGE_RELEASE_WAKELOCK);
synchronized (sDriverStopWakeLock) {
        if (sDriverStopWakeLock.isHeld()) {
          sDriverStopWakeLock.release();
        }
      }
    }
  }
);
  mContext.registerReceiver(new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      mAirplaneModeOverwridden=false;
      updateWifiState();
    }
  }
,new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED));
  mContext.registerReceiver(new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      ArrayList<String> available=intent.getStringArrayListExtra(ConnectivityManager.EXTRA_AVAILABLE_TETHER);
      ArrayList<String> active=intent.getStringArrayListExtra(ConnectivityManager.EXTRA_ACTIVE_TETHER);
      updateTetherState(available,active);
    }
  }
,new IntentFilter(ConnectivityManager.ACTION_TETHER_STATE_CHANGED));
}

Fixed version (ground truth):
WifiService(Context context,WifiStateTracker tracker){
  mContext=context;
  mWifiStateTracker=tracker;
  mWifiStateTracker.enableRssiPolling(true);
  mBatteryStats=BatteryStatsService.getService();
  IBinder b=ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
  nwService=INetworkManagementService.Stub.asInterface(b);
  mScanResultCache=new LinkedHashMap<String,ScanResult>(SCAN_RESULT_CACHE_SIZE,0.75f,true){
    public boolean removeEldestEntry(    Map.Entry eldest){
      return SCAN_RESULT_CACHE_SIZE < this.size();
    }
  }
;
  HandlerThread wifiThread=new HandlerThread("String_Node_Str");
  wifiThread.start();
  mWifiHandler=new WifiHandler(wifiThread.getLooper());
  mWifiStateTracker.setWifiState(WIFI_STATE_DISABLED);
  mWifiApState=WIFI_AP_STATE_DISABLED;
  mAlarmManager=(AlarmManager)mContext.getSystemService(Context.ALARM_SERVICE);
  Intent idleIntent=new Intent(ACTION_DEVICE_IDLE,null);
  mIdleIntent=PendingIntent.getBroadcast(mContext,IDLE_REQUEST,idleIntent,0);
  PowerManager powerManager=(PowerManager)mContext.getSystemService(Context.POWER_SERVICE);
  sWakeLock=powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,WAKELOCK_TAG);
  sDriverStopWakeLock=powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,WAKELOCK_TAG);
  mContext.registerReceiver(new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      mAirplaneModeOverwridden=false;
      updateWifiState();
    }
  }
,new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED));
  mContext.registerReceiver(new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      ArrayList<String> available=intent.getStringArrayListExtra(ConnectivityManager.EXTRA_AVAILABLE_TETHER);
      ArrayList<String> active=intent.getStringArrayListExtra(ConnectivityManager.EXTRA_ACTIVE_TETHER);
      updateTetherState(available,active);
    }
  }
,new IntentFilter(ConnectivityManager.ACTION_TETHER_STATE_CHANGED));
}