Program: 13550
Project: 13550
Buggy source:
private void setupPlansUI(){
  if (mAvailablePlans == null || mAvailablePlans.length == 0) {
    ToastUtils.showToast(PlansActivity.this,R.string.plans_loading_error,ToastUtils.Duration.LONG);
    finish();
    return;
  }
  hideProgress();
  mViewPager.setAdapter(getPageAdapter());
  int normalColor=ContextCompat.getColor(this,R.color.blue_light);
  int selectedColor=ContextCompat.getColor(this,R.color.white);
  mTabLayout.setTabTextColors(normalColor,selectedColor);
  mTabLayout.setupWithViewPager(mViewPager);
  mTabLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      mTabLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
      if (mTabLayout.getChildCount() > 0) {
        int tabLayoutWidth=0;
        LinearLayout tabFirstChild=(LinearLayout)mTabLayout.getChildAt(0);
        for (int i=0; i < mTabLayout.getTabCount(); i++) {
          LinearLayout tabView=(LinearLayout)(tabFirstChild.getChildAt(i));
          tabLayoutWidth+=(tabView.getMeasuredWidth() + tabView.getPaddingLeft() + tabView.getPaddingRight());
        }
        int displayWidth=DisplayUtils.getDisplayPixelWidth(PlansActivity.this);
        if (tabLayoutWidth < displayWidth) {
          mTabLayout.setTabMode(TabLayout.MODE_FIXED);
          mTabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
        }
      }
    }
  }
);
  if (mViewPager.getVisibility() != View.VISIBLE) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      revealViewPager();
    }
 else {
      mViewPager.setVisibility(View.VISIBLE);
      mTabLayout.setVisibility(View.VISIBLE);
      showManageBar();
    }
  }
}

Fixed version (ground truth):
private void setupPlansUI(){
  if (mAvailablePlans == null || mAvailablePlans.length == 0) {
    ToastUtils.showToast(PlansActivity.this,R.string.plans_loading_error,ToastUtils.Duration.LONG);
    finish();
    return;
  }
  hideProgress();
  mViewPager.setAdapter(getPageAdapter());
  int normalColor=ContextCompat.getColor(this,R.color.blue_light);
  int selectedColor=ContextCompat.getColor(this,R.color.white);
  mTabLayout.setTabTextColors(normalColor,selectedColor);
  mTabLayout.setupWithViewPager(mViewPager);
  mTabLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      mTabLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
      if (mTabLayout.getChildCount() > 0) {
        int tabLayoutWidth=0;
        LinearLayout tabFirstChild=(LinearLayout)mTabLayout.getChildAt(0);
        for (int i=0; i < mTabLayout.getTabCount(); i++) {
          LinearLayout tabView=(LinearLayout)(tabFirstChild.getChildAt(i));
          tabLayoutWidth+=(tabView.getMeasuredWidth() + ViewCompat.getPaddingStart(tabView) + ViewCompat.getPaddingEnd(tabView));
        }
        int displayWidth=DisplayUtils.getDisplayPixelWidth(PlansActivity.this);
        if (tabLayoutWidth < displayWidth) {
          mTabLayout.setTabMode(TabLayout.MODE_FIXED);
          mTabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
        }
      }
    }
  }
);
  if (mViewPager.getVisibility() != View.VISIBLE) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      revealViewPager();
    }
 else {
      mViewPager.setVisibility(View.VISIBLE);
      mTabLayout.setVisibility(View.VISIBLE);
      showManageBar();
    }
  }
}