Program: 86964
Project: 86964
Buggy source:
private void setNotificationCard(LockScreenNotification lockScreenNotification){
  if (notificationCardsLayout == null) {
    return;
  }
  final LockScreenNotification lsn=lockScreenNotification;
  final CardView cardView=(CardView)inflater.inflate(R.layout.list_item_notification,notificationCardsLayout,false);
  TextView titleTextView=(TextView)cardView.findViewById(R.id.notification_card_title);
  TextView subTextTextView=(TextView)cardView.findViewById(R.id.notification_card_subtext);
  ImageView notificationImageView=(ImageView)cardView.findViewById(R.id.image_view_notification);
  final boolean isClearable=lsn.isClearable();
  final Notification mNotification=lsn.getNotification();
  final Bundle extras=mNotification.extras;
  titleTextView.setText(extras.getString(KEY_NOTIFICATION_TITLE));
  CharSequence charSequence=(CharSequence)extras.getCharSequence(KEY_NOTIFICATION_TEXT);
  if (charSequence != null) {
    subTextTextView.setText(charSequence.toString());
  }
  try {
    int icon=mNotification.icon;
    Bitmap img=(Bitmap)mNotification.extras.get(Notification.EXTRA_LARGE_ICON);
    if (img == null) {
      Drawable app_icon=context.getPackageManager().getApplicationIcon(lsn.getPackageName());
      img=((BitmapDrawable)app_icon).getBitmap();
    }
    notificationImageView.setImageBitmap(Picture.getCroppedBitmap(img,Color.DKGRAY));
  }
 catch (  Exception e) {
    Log.e(LOG_TAG,e.toString());
  }
  cardView.setMaxCardElevation(CARD_NORMAL_ELEVATION);
  cardView.setCardElevation(CARD_NORMAL_ELEVATION);
  cardView.getBackground().setAlpha(CARD_VIEW_NORMAL_ALPHA);
  cardView.setOnClickListener(new View.OnClickListener(){
    boolean isClicked=false;
    @Override public void onClick(    View v){
      if (isClicked) {
        try {
          mNotification.contentIntent.send();
          lockScreenDismiss(DEFAULT_START_ANIMATION_VELOCITY);
        }
 catch (        Exception e) {
          Log.e(LOG_TAG,e.toString());
        }
        cardView.setMaxCardElevation(CARD_NORMAL_ELEVATION);
        cardView.setCardElevation(CARD_NORMAL_ELEVATION);
        cardView.getBackground().setAlpha(CARD_VIEW_NORMAL_ALPHA);
      }
 else {
        isClicked=true;
        cardView.setMaxCardElevation(CARD_TOUCHED_ELEVATION);
        cardView.setCardElevation(CARD_TOUCHED_ELEVATION);
        cardView.getBackground().setAlpha(CARD_VIEW_SELECTED_ALPHA);
        CountDownTimer cdt=new CountDownTimer((long)2000,(long)2000){
          @Override public void onTick(          long millisUntilFinished){
          }
          @Override public void onFinish(){
            isClicked=false;
            cardView.setMaxCardElevation(CARD_NORMAL_ELEVATION);
            cardView.setCardElevation(CARD_NORMAL_ELEVATION);
            cardView.getBackground().setAlpha(CARD_VIEW_NORMAL_ALPHA);
          }
        }
.start();
      }
    }
  }
);
  cardView.setOnTouchListener(new CustomFlingListener(context){
    @Override public void onRightToLeft(    float endVelocity){
      Log.d(LOG_TAG,"String_Node_Str");
      if (isClearable) {
        cardView.animate().translationX(-cardView.getWidth()).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).alpha(0f);
        lsn.dismiss(context);
        notificationCardsLayout.removeView(cardView);
      }
 else {
        cardView.animate().translationX(0).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).alpha(1f);
      }
    }
    @Override public void onLeftToRight(    float endVelocity){
      Log.d(LOG_TAG,"String_Node_Str");
      if (isClearable) {
        cardView.animate().translationX(cardView.getWidth()).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).alpha(0f);
        lsn.dismiss(context);
        notificationCardsLayout.removeView(cardView);
      }
 else {
        cardView.animate().translationX(0).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).alpha(1f);
      }
    }
    @Override public void onTopToBottom(    float endVelocity){
      lockScreenDismiss(CustomFlingListener.DIRECTION_DOWN,endVelocity);
      NotificationAreaHelper.expand(context);
    }
    @Override public void onBottomToTop(    float endVelocity){
      lockScreenDismiss(CustomFlingListener.DIRECTION_UP,endVelocity);
    }
    @Override public void onMove(    MotionEvent event,    int direction,    float downRawX,    float downRawY){
      if (direction == CustomFlingListener.DIRECTION_LEFT || direction == CustomFlingListener.DIRECTION_RIGHT) {
        Log.d(LOG_TAG,"String_Node_Str" + downRawX + "String_Node_Str"+ event.getRawX());
        cardView.setTranslationX(event.getRawX() - downRawX);
      }
 else       if (direction == CustomFlingListener.DIRECTION_UP || direction == CustomFlingListener.DIRECTION_DOWN) {
        float deltaY=event.getRawY() - downRawY;
        layout.setTranslationY(deltaY);
      }
    }
    @Override public void onDirectionUnknown(){
      cardView.callOnClick();
    }
    @Override public void onSwipeFail(){
      cardView.animate().translationX(0).start();
      layout.animate().translationY(0).start();
    }
  }
);
  lsn.setCardView(cardView);
  lsn.setShown(true);
  notificationCardsLayout.addView(cardView);
}

Fixed version (ground truth):
private void setNotificationCard(LockScreenNotification lockScreenNotification){
  if (notificationCardsLayout == null) {
    return;
  }
  final LockScreenNotification lsn=lockScreenNotification;
  final CardView cardView=(CardView)inflater.inflate(R.layout.list_item_notification,notificationCardsLayout,false);
  TextView titleTextView=(TextView)cardView.findViewById(R.id.notification_card_title);
  TextView subTextTextView=(TextView)cardView.findViewById(R.id.notification_card_subtext);
  ImageView notificationImageView=(ImageView)cardView.findViewById(R.id.image_view_notification);
  final boolean isOngoing=lsn.isOngoing();
  final Notification mNotification=lsn.getNotification();
  final Bundle extras=mNotification.extras;
  titleTextView.setText(extras.getString(KEY_NOTIFICATION_TITLE));
  CharSequence charSequence=(CharSequence)extras.getCharSequence(KEY_NOTIFICATION_TEXT);
  if (charSequence != null) {
    subTextTextView.setText(charSequence.toString());
  }
  try {
    int icon=mNotification.icon;
    Bitmap img=(Bitmap)mNotification.extras.get(Notification.EXTRA_LARGE_ICON);
    if (img == null) {
      Drawable app_icon=context.getPackageManager().getApplicationIcon(lsn.getPackageName());
      img=((BitmapDrawable)app_icon).getBitmap();
    }
    notificationImageView.setImageBitmap(Picture.getCroppedBitmap(img,Color.DKGRAY));
  }
 catch (  Exception e) {
    Log.e(LOG_TAG,e.toString());
  }
  cardView.setMaxCardElevation(CARD_NORMAL_ELEVATION);
  cardView.setCardElevation(CARD_NORMAL_ELEVATION);
  cardView.getBackground().setAlpha(CARD_VIEW_NORMAL_ALPHA);
  cardView.setOnClickListener(new View.OnClickListener(){
    boolean isClicked=false;
    @Override public void onClick(    View v){
      if (isClicked) {
        try {
          mNotification.contentIntent.send();
          lockScreenDismiss(DEFAULT_START_ANIMATION_VELOCITY);
        }
 catch (        Exception e) {
          Log.e(LOG_TAG,e.toString());
        }
        cardView.setMaxCardElevation(CARD_NORMAL_ELEVATION);
        cardView.setCardElevation(CARD_NORMAL_ELEVATION);
        cardView.getBackground().setAlpha(CARD_VIEW_NORMAL_ALPHA);
      }
 else {
        isClicked=true;
        cardView.setMaxCardElevation(CARD_TOUCHED_ELEVATION);
        cardView.setCardElevation(CARD_TOUCHED_ELEVATION);
        cardView.getBackground().setAlpha(CARD_VIEW_SELECTED_ALPHA);
        CountDownTimer cdt=new CountDownTimer((long)2000,(long)2000){
          @Override public void onTick(          long millisUntilFinished){
          }
          @Override public void onFinish(){
            isClicked=false;
            cardView.setMaxCardElevation(CARD_NORMAL_ELEVATION);
            cardView.setCardElevation(CARD_NORMAL_ELEVATION);
            cardView.getBackground().setAlpha(CARD_VIEW_NORMAL_ALPHA);
          }
        }
.start();
      }
    }
  }
);
  cardView.setOnTouchListener(new CustomFlingListener(context){
    @Override public void onRightToLeft(    float endVelocity){
      Log.d(LOG_TAG,"String_Node_Str");
      if (!isOngoing) {
        cardView.animate().translationX(-cardView.getWidth()).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).alpha(0f);
        lsn.dismiss(context);
        notificationCardsLayout.removeView(cardView);
      }
 else {
        cardView.animate().translationX(0).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).alpha(1f);
      }
    }
    @Override public void onLeftToRight(    float endVelocity){
      Log.d(LOG_TAG,"String_Node_Str");
      if (!isOngoing) {
        cardView.animate().translationX(cardView.getWidth()).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).alpha(0f);
        lsn.dismiss(context);
        notificationCardsLayout.removeView(cardView);
      }
 else {
        cardView.animate().translationX(0).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).alpha(1f);
      }
    }
    @Override public void onTopToBottom(    float endVelocity){
      lockScreenDismiss(CustomFlingListener.DIRECTION_DOWN,endVelocity);
      NotificationAreaHelper.expand(context);
    }
    @Override public void onBottomToTop(    float endVelocity){
      lockScreenDismiss(CustomFlingListener.DIRECTION_UP,endVelocity);
    }
    @Override public void onMove(    MotionEvent event,    int direction,    float downRawX,    float downRawY){
      if (direction == CustomFlingListener.DIRECTION_LEFT || direction == CustomFlingListener.DIRECTION_RIGHT) {
        Log.d(LOG_TAG,"String_Node_Str" + downRawX + "String_Node_Str"+ event.getRawX());
        cardView.setTranslationX(event.getRawX() - downRawX);
      }
 else       if (direction == CustomFlingListener.DIRECTION_UP || direction == CustomFlingListener.DIRECTION_DOWN) {
        float deltaY=event.getRawY() - downRawY;
        layout.setTranslationY(deltaY);
      }
    }
    @Override public void onDirectionUnknown(){
      cardView.callOnClick();
    }
    @Override public void onSwipeFail(){
      cardView.animate().translationX(0).start();
      layout.animate().translationY(0).start();
    }
  }
);
  lsn.setCardView(cardView);
  lsn.setShown(true);
  notificationCardsLayout.addView(cardView);
}