Program: 104949
Project: 104949
Buggy source:
@Override protected void openUrlInBubble(String url,long startTime){
  if (mDraggables.size() < Config.MAX_BUBBLES) {
    int x, targetX, y, targetY;
    float time;
    int bubbleIndex=mDraggables.size();
    if (mCurrentState == STATE_ContentView) {
      x=(int)Config.getContentViewX(bubbleIndex,getBubbleCount() + 1);
      y=(int)-Config.mBubbleHeight;
      targetX=x;
      targetY=Config.mContentViewBubbleY;
      time=0.4f;
    }
 else {
      if (bubbleIndex == 0) {
        x=(int)(Config.mBubbleSnapLeftX - Config.mBubbleWidth);
        y=Config.BUBBLE_HOME_Y;
        targetX=Config.BUBBLE_HOME_X;
        targetY=y;
        time=0.4f;
      }
 else {
        x=Config.BUBBLE_HOME_X;
        y=Config.BUBBLE_HOME_Y;
        targetX=x;
        targetY=y;
        time=0.0f;
      }
    }
    Draggable draggable=null;
    BubbleLegacyView bubble;
    try {
      LayoutInflater inflater=LayoutInflater.from(mContext);
      bubble=(BubbleLegacyView)inflater.inflate(R.layout.view_bubble_legacy,null);
      draggable=bubble;
      bubble.configure(url,x,y,targetX,targetY,time,startTime,new BubbleLegacyView.EventHandler(){
        @Override public void onMotionEvent_Touch(        BubbleLegacyView sender,        DraggableHelper.TouchEvent e){
          mCurrentState.onTouchActionDown(sender,e);
        }
        @Override public void onMotionEvent_Move(        BubbleLegacyView sender,        DraggableHelper.MoveEvent e){
          mCurrentState.onTouchActionMove(sender,e);
        }
        @Override public void onMotionEvent_Release(        BubbleLegacyView sender,        DraggableHelper.ReleaseEvent e){
          mCurrentState.onTouchActionRelease(sender,e);
        }
        @Override public void onDestroyDraggable(        Draggable sender){
          if (mDraggables.size() > 1) {
            BubbleLegacyView bubbleView=sender.getBubbleLegacyView();
            int bubbleIndex=bubbleView.getBubbleIndex();
            destroyBubble(sender,Config.BubbleAction.Destroy);
            int nextBubbleIndex=Util.clamp(0,bubbleIndex,mDraggables.size() - 1);
            Draggable nextBubble=mDraggables.get(nextBubbleIndex);
            STATE_ContentView.setActiveBubble(nextBubble);
          }
 else {
            STATE_KillBubble.init(sender);
            switchState(STATE_KillBubble);
          }
        }
        @Override public void onMinimizeBubbles(){
          if (mCurrentState != null && mCurrentState instanceof State_AnimateToBubbleView == false) {
            switchState(STATE_AnimateToBubbleView);
          }
        }
      }
);
    }
 catch (    MalformedURLException e) {
      return;
    }
    mCurrentState.onNewDraggable(draggable);
    mDraggables.add(draggable);
    mBubbles.add(bubble);
    ++mBubblesLoaded;
    for (int i=0; i < mBubbles.size(); ++i) {
      mBubbles.get(i).setBubbleIndex(i);
    }
    Settings.get().saveCurrentBubblesLegacy(mBubbles);
    mBadgeView.attach(bubble);
    mBadgeView.setBubbleCount(mBubbles.size());
    int draggableCount=mDraggables.size();
    if (mCurrentState == STATE_ContentView) {
      draggable.getDraggableView().setVisibility(View.VISIBLE);
      for (int i=0; i < draggableCount; ++i) {
        Draggable draggableItem=mDraggables.get(i);
        if (draggableItem != bubble) {
          draggableItem.getDraggableHelper().setTargetPos((int)Config.getContentViewX(draggableItem.getBubbleLegacyView().getBubbleIndex(),getBubbleCount()),draggableItem.getDraggableHelper().getYPos(),0.2f,false);
        }
      }
    }
 else {
      mFrontDraggable=bubble;
      for (int i=0; i < draggableCount; ++i) {
        Draggable draggableItem=mDraggables.get(i);
        int vis=View.VISIBLE;
        if (draggableItem != mFrontDraggable) {
          vis=View.GONE;
        }
        draggableItem.getDraggableView().setVisibility(vis);
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void openUrlInBubble(String url,long startTime){
  if (mDraggables.size() < Config.MAX_BUBBLES) {
    int x, targetX, y, targetY;
    float time;
    int bubbleIndex=mDraggables.size();
    if (mCurrentState == STATE_ContentView) {
      x=(int)Config.getContentViewX(bubbleIndex,getBubbleCount() + 1);
      y=(int)-Config.mBubbleHeight;
      targetX=x;
      targetY=Config.mContentViewBubbleY;
      time=0.4f;
    }
 else {
      if (bubbleIndex == 0) {
        x=(int)(Config.mBubbleSnapLeftX - Config.mBubbleWidth);
        y=Config.BUBBLE_HOME_Y;
        targetX=Config.BUBBLE_HOME_X;
        targetY=y;
        time=0.4f;
      }
 else {
        x=Config.BUBBLE_HOME_X;
        y=Config.BUBBLE_HOME_Y;
        targetX=x;
        targetY=y;
        time=0.0f;
      }
    }
    Draggable draggable=null;
    BubbleLegacyView bubble;
    try {
      LayoutInflater inflater=LayoutInflater.from(mContext);
      bubble=(BubbleLegacyView)inflater.inflate(R.layout.view_bubble_legacy,null);
      draggable=bubble;
      bubble.configure(url,x,y,targetX,targetY,time,startTime,new BubbleLegacyView.EventHandler(){
        @Override public void onMotionEvent_Touch(        BubbleLegacyView sender,        DraggableHelper.TouchEvent e){
          mCurrentState.onTouchActionDown(sender,e);
        }
        @Override public void onMotionEvent_Move(        BubbleLegacyView sender,        DraggableHelper.MoveEvent e){
          mCurrentState.onTouchActionMove(sender,e);
        }
        @Override public void onMotionEvent_Release(        BubbleLegacyView sender,        DraggableHelper.ReleaseEvent e){
          mCurrentState.onTouchActionRelease(sender,e);
        }
        @Override public void onDestroyDraggable(        Draggable sender){
          if (mDraggables.size() > 1) {
            BubbleLegacyView bubbleView=sender.getBubbleLegacyView();
            int bubbleIndex=bubbleView.getBubbleIndex();
            destroyBubble(sender,Config.BubbleAction.Destroy);
            int nextBubbleIndex=Util.clamp(0,bubbleIndex,mDraggables.size() - 1);
            Draggable nextBubble=mDraggables.get(nextBubbleIndex);
            if (mCurrentState == STATE_ContentView) {
              STATE_ContentView.setActiveBubble(nextBubble);
            }
          }
 else {
            STATE_KillBubble.init(sender);
            switchState(STATE_KillBubble);
          }
        }
        @Override public void onMinimizeBubbles(){
          if (mCurrentState != null && mCurrentState instanceof State_AnimateToBubbleView == false) {
            switchState(STATE_AnimateToBubbleView);
          }
        }
      }
);
    }
 catch (    MalformedURLException e) {
      return;
    }
    mCurrentState.onNewDraggable(draggable);
    mDraggables.add(draggable);
    mBubbles.add(bubble);
    ++mBubblesLoaded;
    for (int i=0; i < mBubbles.size(); ++i) {
      mBubbles.get(i).setBubbleIndex(i);
    }
    Settings.get().saveCurrentBubblesLegacy(mBubbles);
    mBadgeView.attach(bubble);
    mBadgeView.setBubbleCount(mBubbles.size());
    int draggableCount=mDraggables.size();
    if (mCurrentState == STATE_ContentView) {
      draggable.getDraggableView().setVisibility(View.VISIBLE);
      for (int i=0; i < draggableCount; ++i) {
        Draggable draggableItem=mDraggables.get(i);
        if (draggableItem != bubble) {
          draggableItem.getDraggableHelper().setTargetPos((int)Config.getContentViewX(draggableItem.getBubbleLegacyView().getBubbleIndex(),getBubbleCount()),draggableItem.getDraggableHelper().getYPos(),0.2f,false);
        }
      }
    }
 else {
      mFrontDraggable=bubble;
      for (int i=0; i < draggableCount; ++i) {
        Draggable draggableItem=mDraggables.get(i);
        int vis=View.VISIBLE;
        if (draggableItem != mFrontDraggable) {
          vis=View.GONE;
        }
        draggableItem.getDraggableView().setVisibility(vis);
      }
    }
  }
}