Program: 166855
Project: 166855
Buggy source:
private void handleTrack(final Intent intent){
  if (intent == null || !WAILSettings.isEnabled(this)) {
    Loggi.w("String_Node_Str");
    return;
  }
  final String player=intent.getStringExtra(CommonMusicAppReceiver.EXTRA_PLAYER_PACKAGE_NAME);
  AsyncTaskExecutor.executeConcurrently(new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... params){
      Loggi.i("String_Node_Str" + intent);
      mayBeCleanDB();
      final String extraAction=intent.getStringExtra(CommonMusicAppReceiver.EXTRA_ACTION);
      if (extraAction == null || extraAction.lastIndexOf('.') == -1) {
        Loggi.e("String_Node_Str");
        return null;
      }
      final boolean isCurrentTrackPlaying=intent.getBooleanExtra(CommonMusicAppReceiver.EXTRA_PLAYING,false);
      final Track currentTrack=CommonMusicAppReceiver.parseFromIntentExtras(intent);
      if (isCurrentTrackPlaying) {
        WAILSettings.setNowScrobblingTrack(getApplicationContext(),currentTrack);
        String applicationLabel=null;
        try {
          PackageManager packageManager=getApplication().getPackageManager();
          ApplicationInfo applicationInfo=packageManager.getApplicationInfo(player,0);
          applicationLabel=packageManager.getApplicationLabel(applicationInfo).toString();
        }
 catch (        PackageManager.NameNotFoundException e) {
          Loggi.w("String_Node_Str" + player);
        }
        WAILSettings.setNowScrobblingPlayerLabel(getApplicationContext(),applicationLabel);
        WAILSettings.setNowScrobblingPlayerPackageName(getApplicationContext(),player);
        StatusBarNotificationsManager.getInstance(getApplicationContext()).showTrackScrobblingStatusBarNotification(currentTrack);
        updateNowPlaying(currentTrack);
      }
 else {
        StatusBarNotificationsManager.getInstance(getApplicationContext()).hideTrackScrobblingStatusBarNotification();
        WAILSettings.setNowScrobblingTrack(getApplicationContext(),null);
        WAILSettings.setNowScrobblingPlayerPackageName(getApplicationContext(),null);
      }
      LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(new Intent(TracksDBHelper.INTENT_TRACKS_CHANGED));
      final LastCapturedTrackInfo mLastCapturedTrackInfo=WAILSettings.getLastCapturedTrackInfo(getApplicationContext());
      if (mLastCapturedTrackInfo == null) {
      }
 else {
        final long trackPlayingDurationInMillis=currentTrack.getTimestamp() - mLastCapturedTrackInfo.getTrack().getTimestamp();
        final long minTrackDurationInMillis=WAILSettings.getMinTrackDurationInSeconds(getApplicationContext()) * 1000;
        if ((!isCurrentTrackPlaying && mLastCapturedTrackInfo.isPlaying()) || mLastCapturedTrackInfo.isPlaying()) {
          Loggi.w("String_Node_Str" + trackPlayingDurationInMillis + "String_Node_Str"+ (WAILSettings.getMinTrackDurationInSeconds(getApplicationContext()) * 1000));
          long duration=mLastCapturedTrackInfo.getTrack().getDurationInMillis();
          if (duration != -1) {
            final int trackDurationInPercents=(int)(100 * trackPlayingDurationInMillis / (duration + 2500));
            int minTrackDurationInPercents=WAILSettings.getMinTrackDurationInPercents(getApplicationContext());
            if (trackDurationInPercents >= minTrackDurationInPercents) {
              Loggi.w("String_Node_Str" + trackPlayingDurationInMillis + "String_Node_Str"+ trackDurationInPercents+ "String_Node_Str"+ minTrackDurationInPercents);
              mLastCapturedTrackInfo.getTrack().setStateTimestamp(System.currentTimeMillis());
              addTrackToDB(mLastCapturedTrackInfo.getTrack());
            }
 else {
              Loggi.w("String_Node_Str" + trackPlayingDurationInMillis + "String_Node_Str"+ trackDurationInPercents+ "String_Node_Str"+ minTrackDurationInPercents);
              SoundNotificationsManager.getInstance(getApplicationContext()).playTrackSkippedSound();
            }
          }
 else {
            Loggi.w("String_Node_Str" + trackPlayingDurationInMillis + "String_Node_Str"+ minTrackDurationInMillis+ "String_Node_Str");
          }
        }
 else {
          Loggi.w("String_Node_Str");
        }
      }
      WAILSettings.setLastCapturedTrackInfo(getApplicationContext(),new LastCapturedTrackInfo(currentTrack,isCurrentTrackPlaying));
      return null;
    }
    @Override protected void onPostExecute(    Void aVoid){
      scrobblePendingTracks(false);
    }
  }
);
}

Fixed version (ground truth):
private void handleTrack(final Intent intent){
  if (intent == null || !WAILSettings.isEnabled(this)) {
    Loggi.w("String_Node_Str");
    return;
  }
  final String player=intent.getStringExtra(CommonMusicAppReceiver.EXTRA_PLAYER_PACKAGE_NAME);
  AsyncTaskExecutor.executeConcurrently(new AsyncTask<Void,Void,Void>(){
    @Override protected Void doInBackground(    Void... params){
      Loggi.i("String_Node_Str" + intent);
      mayBeCleanDB();
      final String extraAction=intent.getStringExtra(CommonMusicAppReceiver.EXTRA_ACTION);
      if (extraAction == null || extraAction.lastIndexOf('.') == -1) {
        Loggi.e("String_Node_Str");
        return null;
      }
      final boolean isCurrentTrackPlaying=intent.getBooleanExtra(CommonMusicAppReceiver.EXTRA_PLAYING,false);
      final Track currentTrack=CommonMusicAppReceiver.parseFromIntentExtras(intent);
      if (isCurrentTrackPlaying) {
        WAILSettings.setNowScrobblingTrack(getApplicationContext(),currentTrack);
        String applicationLabel=null;
        try {
          PackageManager packageManager=getApplication().getPackageManager();
          ApplicationInfo applicationInfo=packageManager.getApplicationInfo(player,0);
          applicationLabel=packageManager.getApplicationLabel(applicationInfo).toString();
        }
 catch (        PackageManager.NameNotFoundException e) {
          Loggi.w("String_Node_Str" + player);
        }
        WAILSettings.setNowScrobblingPlayerLabel(getApplicationContext(),applicationLabel);
        WAILSettings.setNowScrobblingPlayerPackageName(getApplicationContext(),player);
        StatusBarNotificationsManager.getInstance(getApplicationContext()).showTrackScrobblingStatusBarNotification(currentTrack);
        updateNowPlaying(currentTrack);
      }
 else {
        StatusBarNotificationsManager.getInstance(getApplicationContext()).hideTrackScrobblingStatusBarNotification();
        WAILSettings.setNowScrobblingTrack(getApplicationContext(),null);
        WAILSettings.setNowScrobblingPlayerPackageName(getApplicationContext(),null);
      }
      LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(new Intent(TracksDBHelper.INTENT_TRACKS_CHANGED));
      final LastCapturedTrackInfo mLastCapturedTrackInfo=WAILSettings.getLastCapturedTrackInfo(getApplicationContext());
      if (mLastCapturedTrackInfo != null) {
        final long trackPlayingDurationInMillis=currentTrack.getTimestamp() - mLastCapturedTrackInfo.getTrack().getTimestamp();
        final long minTrackDurationInMillis=WAILSettings.getMinTrackDurationInSeconds(getApplicationContext()) * 1000;
        final int minTrackDurationInPercents=WAILSettings.getMinTrackDurationInPercents(getApplicationContext());
        if ((!isCurrentTrackPlaying && mLastCapturedTrackInfo.isPlaying()) || mLastCapturedTrackInfo.isPlaying()) {
          long duration=mLastCapturedTrackInfo.getTrack().getDuration();
          if (duration != -1) {
            final int trackDurationInPercents=(int)(100 * trackPlayingDurationInMillis / (duration + 2500));
            if (trackDurationInPercents >= minTrackDurationInPercents && trackPlayingDurationInMillis >= minTrackDurationInMillis) {
              scrobble(mLastCapturedTrackInfo,trackPlayingDurationInMillis,minTrackDurationInMillis,duration,minTrackDurationInPercents);
            }
 else {
              skip(trackPlayingDurationInMillis,minTrackDurationInMillis,minTrackDurationInPercents,duration);
            }
          }
 else           if (trackPlayingDurationInMillis >= minTrackDurationInMillis) {
            Loggi.d("String_Node_Str");
            scrobble(mLastCapturedTrackInfo,trackPlayingDurationInMillis,minTrackDurationInMillis,duration,minTrackDurationInPercents);
          }
 else {
            skip(trackPlayingDurationInMillis,minTrackDurationInMillis,minTrackDurationInPercents,duration);
          }
        }
 else {
          Loggi.w("String_Node_Str");
        }
      }
      WAILSettings.setLastCapturedTrackInfo(getApplicationContext(),new LastCapturedTrackInfo(currentTrack,isCurrentTrackPlaying));
      return null;
    }
    @Override protected void onPostExecute(    Void aVoid){
      scrobblePendingTracks(false);
    }
    private void scrobble(    LastCapturedTrackInfo mLastCapturedTrackInfo,    long trackPlayingDurationInMillis,    long minTrackDurationInMillis,    long duration,    int minTrackDurationInPercents){
      Loggi.i(String.format("String_Node_Str" + "String_Node_Str",duration,trackPlayingDurationInMillis,minTrackDurationInMillis,minTrackDurationInPercents));
      addTrackToDB(mLastCapturedTrackInfo.getTrack());
      SoundNotificationsManager.getInstance(getApplicationContext()).playTrackMarkedAsScrobbledSound();
    }
    private void skip(    long trackPlayingDurationInMillis,    long minTrackDurationInMillis,    int minTrackDurationInPercents,    long duration){
      Loggi.i(String.format("String_Node_Str" + "String_Node_Str",duration,trackPlayingDurationInMillis,minTrackDurationInMillis,minTrackDurationInPercents));
      SoundNotificationsManager.getInstance(getApplicationContext()).playTrackSkippedSound();
    }
  }
);
}