Program: 62853
Project: 62853
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  int state=intent.getIntExtra("String_Node_Str",0);
  if (mLibVLC == null) {
    Log.w(TAG,"String_Node_Str");
    return;
  }
  if (action.equalsIgnoreCase(VLCAppWidgetProvider.ACTION_WIDGET_PLAY)) {
    if (mLibVLC.isPlaying() && mCurrentMedia != null) {
      pause();
    }
 else     if (!mLibVLC.isPlaying() && mCurrentMedia != null) {
      play();
    }
 else {
      Intent iVlc=new Intent(context,AudioPlayerActivity.class);
      iVlc.putExtra(START_FROM_NOTIFICATION,true);
      iVlc.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      context.startActivity(iVlc);
    }
  }
 else   if (action.equalsIgnoreCase(VLCAppWidgetProvider.ACTION_WIDGET_BACKWARD)) {
    previous();
  }
 else   if (action.equalsIgnoreCase(VLCAppWidgetProvider.ACTION_WIDGET_STOP)) {
    stop();
  }
 else   if (action.equalsIgnoreCase(VLCAppWidgetProvider.ACTION_WIDGET_FORWARD)) {
    next();
  }
 else   if (action.equalsIgnoreCase(Intent.ACTION_MEDIA_BUTTON)) {
    KeyEvent event=(KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
    TelephonyManager telManager=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
    if (event == null || telManager.getCallState() != TelephonyManager.CALL_STATE_IDLE)     return;
    if (mCurrentMedia == null) {
      abortBroadcast();
      return;
    }
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_HEADSETHOOK:
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
      long time=SystemClock.uptimeMillis();
switch (event.getAction()) {
case KeyEvent.ACTION_DOWN:
      if (event.getRepeatCount() > 0)       break;
    mHeadsetDownTime=time;
  break;
case KeyEvent.ACTION_UP:
if (time - mHeadsetDownTime >= 1000) {
  previous();
  time=0;
}
 else if (time - mHeadsetUpTime <= 500) {
  next();
}
 else {
  if (mLibVLC.isPlaying())   pause();
 else   play();
}
mHeadsetUpTime=time;
break;
}
break;
case KeyEvent.KEYCODE_MEDIA_PLAY:
play();
break;
case KeyEvent.KEYCODE_MEDIA_PAUSE:
pause();
break;
case KeyEvent.KEYCODE_MEDIA_STOP:
stop();
break;
case KeyEvent.KEYCODE_MEDIA_NEXT:
next();
break;
case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
previous();
break;
}
abortBroadcast();
}
if (mDetectHeadset) {
if (action.equalsIgnoreCase(AudioManager.ACTION_AUDIO_BECOMING_NOISY)) {
Log.i(TAG,"String_Node_Str");
if (mLibVLC.isPlaying() && mCurrentMedia != null) pause();
}
 else if (action.equalsIgnoreCase(Intent.ACTION_HEADSET_PLUG) && state != 0) {
Log.i(TAG,"String_Node_Str");
if (!mLibVLC.isPlaying() && mCurrentMedia != null) play();
}
}
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  int state=intent.getIntExtra("String_Node_Str",0);
  if (mLibVLC == null) {
    Log.w(TAG,"String_Node_Str");
    return;
  }
  if (action.equalsIgnoreCase(VLCAppWidgetProvider.ACTION_WIDGET_PLAY)) {
    if (mLibVLC.isPlaying() && mCurrentMedia != null) {
      pause();
    }
 else     if (!mLibVLC.isPlaying() && mCurrentMedia != null) {
      play();
    }
 else {
      Intent iVlc=new Intent(context,MainActivity.class);
      iVlc.putExtra(START_FROM_NOTIFICATION,true);
      iVlc.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      context.startActivity(iVlc);
    }
  }
 else   if (action.equalsIgnoreCase(VLCAppWidgetProvider.ACTION_WIDGET_BACKWARD)) {
    previous();
  }
 else   if (action.equalsIgnoreCase(VLCAppWidgetProvider.ACTION_WIDGET_STOP)) {
    stop();
  }
 else   if (action.equalsIgnoreCase(VLCAppWidgetProvider.ACTION_WIDGET_FORWARD)) {
    next();
  }
 else   if (action.equalsIgnoreCase(Intent.ACTION_MEDIA_BUTTON)) {
    KeyEvent event=(KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
    TelephonyManager telManager=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
    if (event == null || telManager.getCallState() != TelephonyManager.CALL_STATE_IDLE)     return;
    if (mCurrentMedia == null) {
      abortBroadcast();
      return;
    }
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_HEADSETHOOK:
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
      long time=SystemClock.uptimeMillis();
switch (event.getAction()) {
case KeyEvent.ACTION_DOWN:
      if (event.getRepeatCount() > 0)       break;
    mHeadsetDownTime=time;
  break;
case KeyEvent.ACTION_UP:
if (time - mHeadsetDownTime >= 1000) {
  previous();
  time=0;
}
 else if (time - mHeadsetUpTime <= 500) {
  next();
}
 else {
  if (mLibVLC.isPlaying())   pause();
 else   play();
}
mHeadsetUpTime=time;
break;
}
break;
case KeyEvent.KEYCODE_MEDIA_PLAY:
play();
break;
case KeyEvent.KEYCODE_MEDIA_PAUSE:
pause();
break;
case KeyEvent.KEYCODE_MEDIA_STOP:
stop();
break;
case KeyEvent.KEYCODE_MEDIA_NEXT:
next();
break;
case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
previous();
break;
}
abortBroadcast();
}
if (mDetectHeadset) {
if (action.equalsIgnoreCase(AudioManager.ACTION_AUDIO_BECOMING_NOISY)) {
Log.i(TAG,"String_Node_Str");
if (mLibVLC.isPlaying() && mCurrentMedia != null) pause();
}
 else if (action.equalsIgnoreCase(Intent.ACTION_HEADSET_PLUG) && state != 0) {
Log.i(TAG,"String_Node_Str");
if (!mLibVLC.isPlaying() && mCurrentMedia != null) play();
}
}
}