nus-yam/ex-repair huggingface dataset:
Program: 197882
Project: 197882
Buggy source:
public void updateDismissView(boolean visible){
  int oldVisibility=mDismissView.willBeGone() ? GONE : mDismissView.getVisibility();
  int newVisibility=visible ? VISIBLE : GONE;
  if (oldVisibility != newVisibility) {
    if (oldVisibility == GONE) {
      if (mDismissView.willBeGone()) {
        mDismissView.cancelAnimation();
      }
 else {
        mDismissView.setInvisible();
        mDismissView.setVisibility(newVisibility);
      }
      mDismissView.setWillBeGone(false);
      updateContentHeight();
    }
 else {
      mDismissView.setWillBeGone(true);
      mDismissView.performVisibilityAnimation(false,new Runnable(){
        @Override public void run(){
          mDismissView.setVisibility(GONE);
          mDismissView.setWillBeGone(false);
          updateContentHeight();
        }
      }
);
    }
  }
}

Fixed version (ground truth):
public void updateDismissView(boolean visible){
  int oldVisibility=mDismissView.willBeGone() ? GONE : mDismissView.getVisibility();
  int newVisibility=visible ? VISIBLE : GONE;
  if (oldVisibility != newVisibility) {
    if (newVisibility != GONE) {
      if (mDismissView.willBeGone()) {
        mDismissView.cancelAnimation();
      }
 else {
        mDismissView.setInvisible();
      }
      mDismissView.setVisibility(newVisibility);
      mDismissView.setWillBeGone(false);
      updateContentHeight();
      notifyHeightChangeListener(mDismissView);
    }
 else {
      mDismissView.setWillBeGone(true);
      mDismissView.performVisibilityAnimation(false,new Runnable(){
        @Override public void run(){
          mDismissView.setVisibility(GONE);
          mDismissView.setWillBeGone(false);
          updateContentHeight();
          notifyHeightChangeListener(mDismissView);
        }
      }
);
    }
  }
}
Program: 197883
Project: 197883
Buggy source:
public void updateEmptyShadeView(boolean visible){
  int oldVisibility=mEmptyShadeView.willBeGone() ? GONE : mEmptyShadeView.getVisibility();
  int newVisibility=visible ? VISIBLE : GONE;
  if (oldVisibility != newVisibility) {
    if (oldVisibility == GONE) {
      if (mEmptyShadeView.willBeGone()) {
        mEmptyShadeView.cancelAnimation();
      }
 else {
        mEmptyShadeView.setInvisible();
        mEmptyShadeView.setVisibility(newVisibility);
      }
      mEmptyShadeView.setWillBeGone(false);
      updateContentHeight();
    }
 else {
      mEmptyShadeView.setWillBeGone(true);
      mEmptyShadeView.performVisibilityAnimation(false,new Runnable(){
        @Override public void run(){
          mEmptyShadeView.setVisibility(GONE);
          mEmptyShadeView.setWillBeGone(false);
          updateContentHeight();
        }
      }
);
    }
  }
}

Fixed version (ground truth):
public void updateEmptyShadeView(boolean visible){
  int oldVisibility=mEmptyShadeView.willBeGone() ? GONE : mEmptyShadeView.getVisibility();
  int newVisibility=visible ? VISIBLE : GONE;
  if (oldVisibility != newVisibility) {
    if (newVisibility != GONE) {
      if (mEmptyShadeView.willBeGone()) {
        mEmptyShadeView.cancelAnimation();
      }
 else {
        mEmptyShadeView.setInvisible();
      }
      mEmptyShadeView.setVisibility(newVisibility);
      mEmptyShadeView.setWillBeGone(false);
      updateContentHeight();
      notifyHeightChangeListener(mDismissView);
    }
 else {
      mEmptyShadeView.setWillBeGone(true);
      mEmptyShadeView.performVisibilityAnimation(false,new Runnable(){
        @Override public void run(){
          mEmptyShadeView.setVisibility(GONE);
          mEmptyShadeView.setWillBeGone(false);
          updateContentHeight();
          notifyHeightChangeListener(mDismissView);
        }
      }
);
    }
  }
}
Program: 197885
Project: 197885
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  boolean updateExpandHeight=mMaxExpandHeight == 0 && !mWasReset;
  mMaxExpandHeight=mPrivateLayout.getMaxHeight();
  if (updateExpandHeight) {
    applyExpansionToLayout();
  }
  mWasReset=false;
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  boolean updateExpandHeight=mMaxExpandHeight == 0 && !mWasReset;
  updateMaxExpandHeight();
  if (updateExpandHeight) {
    applyExpansionToLayout();
  }
  mWasReset=false;
}
Program: 197886
Project: 197886
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  if (!mActualHeightInitialized && mActualHeight == 0) {
    setActualHeight(getInitialHeight());
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  if (!mActualHeightInitialized && mActualHeight == 0) {
    int initialHeight=getInitialHeight();
    if (initialHeight != 0) {
      setActualHeight(initialHeight);
    }
  }
}
Program: 197887
Project: 197887
Buggy source:
@Override public void run(){
  mDismissView.setVisibility(GONE);
  mDismissView.setWillBeGone(false);
  updateContentHeight();
}

Fixed version (ground truth):
@Override public void run(){
  mDismissView.setVisibility(GONE);
  mDismissView.setWillBeGone(false);
  updateContentHeight();
  notifyHeightChangeListener(mDismissView);
}
Program: 197888
Project: 197888
Buggy source:
public void updateDismissView(boolean visible){
  int oldVisibility=mDismissView.willBeGone() ? GONE : mDismissView.getVisibility();
  int newVisibility=visible ? VISIBLE : GONE;
  if (oldVisibility != newVisibility) {
    if (oldVisibility == GONE) {
      if (mDismissView.willBeGone()) {
        mDismissView.cancelAnimation();
      }
 else {
        mDismissView.setInvisible();
        mDismissView.setVisibility(newVisibility);
      }
      mDismissView.setWillBeGone(false);
      updateContentHeight();
    }
 else {
      mDismissView.setWillBeGone(true);
      mDismissView.performVisibilityAnimation(false,new Runnable(){
        @Override public void run(){
          mDismissView.setVisibility(GONE);
          mDismissView.setWillBeGone(false);
          updateContentHeight();
        }
      }
);
    }
  }
}

Fixed version (ground truth):
public void updateDismissView(boolean visible){
  int oldVisibility=mDismissView.willBeGone() ? GONE : mDismissView.getVisibility();
  int newVisibility=visible ? VISIBLE : GONE;
  if (oldVisibility != newVisibility) {
    if (newVisibility != GONE) {
      if (mDismissView.willBeGone()) {
        mDismissView.cancelAnimation();
      }
 else {
        mDismissView.setInvisible();
      }
      mDismissView.setVisibility(newVisibility);
      mDismissView.setWillBeGone(false);
      updateContentHeight();
      notifyHeightChangeListener(mDismissView);
    }
 else {
      mDismissView.setWillBeGone(true);
      mDismissView.performVisibilityAnimation(false,new Runnable(){
        @Override public void run(){
          mDismissView.setVisibility(GONE);
          mDismissView.setWillBeGone(false);
          updateContentHeight();
          notifyHeightChangeListener(mDismissView);
        }
      }
);
    }
  }
}
Program: 197889
Project: 197889
Buggy source:
public void updateEmptyShadeView(boolean visible){
  int oldVisibility=mEmptyShadeView.willBeGone() ? GONE : mEmptyShadeView.getVisibility();
  int newVisibility=visible ? VISIBLE : GONE;
  if (oldVisibility != newVisibility) {
    if (oldVisibility == GONE) {
      if (mEmptyShadeView.willBeGone()) {
        mEmptyShadeView.cancelAnimation();
      }
 else {
        mEmptyShadeView.setInvisible();
        mEmptyShadeView.setVisibility(newVisibility);
      }
      mEmptyShadeView.setWillBeGone(false);
      updateContentHeight();
    }
 else {
      mEmptyShadeView.setWillBeGone(true);
      mEmptyShadeView.performVisibilityAnimation(false,new Runnable(){
        @Override public void run(){
          mEmptyShadeView.setVisibility(GONE);
          mEmptyShadeView.setWillBeGone(false);
          updateContentHeight();
        }
      }
);
    }
  }
}

Fixed version (ground truth):
public void updateEmptyShadeView(boolean visible){
  int oldVisibility=mEmptyShadeView.willBeGone() ? GONE : mEmptyShadeView.getVisibility();
  int newVisibility=visible ? VISIBLE : GONE;
  if (oldVisibility != newVisibility) {
    if (newVisibility != GONE) {
      if (mEmptyShadeView.willBeGone()) {
        mEmptyShadeView.cancelAnimation();
      }
 else {
        mEmptyShadeView.setInvisible();
      }
      mEmptyShadeView.setVisibility(newVisibility);
      mEmptyShadeView.setWillBeGone(false);
      updateContentHeight();
      notifyHeightChangeListener(mDismissView);
    }
 else {
      mEmptyShadeView.setWillBeGone(true);
      mEmptyShadeView.performVisibilityAnimation(false,new Runnable(){
        @Override public void run(){
          mEmptyShadeView.setVisibility(GONE);
          mEmptyShadeView.setWillBeGone(false);
          updateContentHeight();
          notifyHeightChangeListener(mDismissView);
        }
      }
);
    }
  }
}
Program: 197901
Project: 197901
Buggy source:
/** 
 * Logic to find out whether the notification is going to have three lines in the contracted layout. This is used to adjust the top padding.
 * @return true if the notification is going to have three lines; false if the notificationis going to have one or two lines
 */
private boolean hasThreeLines(){
  boolean hasLine3=mContentText != null || mContentInfo != null || mNumber > 0;
  boolean hasLine2=(mSubText != null && mContentText != null) || (mSubText == null && (mProgressMax != 0 || mProgressIndeterminate));
  return hasLine2 && hasLine3;
}

Fixed version (ground truth):
/** 
 * Logic to find out whether the notification is going to have three lines in the contracted layout. This is used to adjust the top padding.
 * @return true if the notification is going to have three lines; false if the notificationis going to have one or two lines
 */
private boolean hasThreeLines(){
  boolean contentTextInLine2=mSubText != null && mContentText != null;
  boolean badgeInLine3=getProfileBadgeDrawable() != null && !contentTextInLine2;
  boolean hasLine3=mContentText != null || mContentInfo != null || mNumber > 0 || badgeInLine3;
  boolean hasLine2=(mSubText != null && mContentText != null) || (mSubText == null && (mProgressMax != 0 || mProgressIndeterminate));
  return hasLine2 && hasLine3;
}
Program: 197902
Project: 197902
Buggy source:
/** 
 * Rebuilds the notification passed in to the rebuild-constructor  {@link #Builder(Context,Notification)}. <p> Throws IllegalStateException when invoked on a Builder that isn't in rebuild mode.
 * @hide
 */
private Notification rebuild(){
  if (mRebuildNotification == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  Bundle extras=mRebuildNotification.extras;
  if (extras.getBoolean(EXTRA_REBUILD_LARGE_ICON)) {
    mRebuildNotification.largeIcon=extras.getParcelable(EXTRA_LARGE_ICON);
  }
  extras.remove(EXTRA_REBUILD_LARGE_ICON);
  if (extras.getBoolean(EXTRA_REBUILD_CONTENT_VIEW)) {
    setBuilderContentView(mRebuildNotification,makeContentView());
    if (mStyle != null) {
      mStyle.populateContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_BIG_CONTENT_VIEW)) {
    setBuilderBigContentView(mRebuildNotification,makeBigContentView());
    if (mStyle != null) {
      mStyle.populateBigContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_BIG_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW)) {
    setBuilderHeadsUpContentView(mRebuildNotification,makeHeadsUpContentView());
    if (mStyle != null) {
      mStyle.populateHeadsUpContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW);
  return mRebuildNotification;
}

Fixed version (ground truth):
/** 
 * Rebuilds the notification passed in to the rebuild-constructor  {@link #Builder(Context,Notification)}. <p> Throws IllegalStateException when invoked on a Builder that isn't in rebuild mode.
 * @hide
 */
private Notification rebuild(){
  if (mRebuildNotification == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  mHasThreeLines=hasThreeLines();
  Bundle extras=mRebuildNotification.extras;
  if (extras.getBoolean(EXTRA_REBUILD_LARGE_ICON)) {
    mRebuildNotification.largeIcon=extras.getParcelable(EXTRA_LARGE_ICON);
  }
  extras.remove(EXTRA_REBUILD_LARGE_ICON);
  if (extras.getBoolean(EXTRA_REBUILD_CONTENT_VIEW)) {
    setBuilderContentView(mRebuildNotification,makeContentView());
    if (mStyle != null) {
      mStyle.populateContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_BIG_CONTENT_VIEW)) {
    setBuilderBigContentView(mRebuildNotification,makeBigContentView());
    if (mStyle != null) {
      mStyle.populateBigContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_BIG_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW)) {
    setBuilderHeadsUpContentView(mRebuildNotification,makeHeadsUpContentView());
    if (mStyle != null) {
      mStyle.populateHeadsUpContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW);
  mHasThreeLines=false;
  return mRebuildNotification;
}
Program: 197903
Project: 197903
Buggy source:
private RemoteViews makeBigContentView(){
  CharSequence oldBuilderContentText=mBuilder.mContentText;
  mBuilder.mContentText=null;
  RemoteViews contentView=getStandardView(mBuilder.getInboxLayoutResource());
  mBuilder.mContentText=oldBuilderContentText;
  contentView.setViewVisibility(R.id.text2,View.GONE);
  int[] rowIds={R.id.inbox_text0,R.id.inbox_text1,R.id.inbox_text2,R.id.inbox_text3,R.id.inbox_text4,R.id.inbox_text5,R.id.inbox_text6};
  for (  int rowId : rowIds) {
    contentView.setViewVisibility(rowId,View.GONE);
  }
  final boolean largeText=mBuilder.mContext.getResources().getConfiguration().fontScale > 1f;
  final float subTextSize=mBuilder.mContext.getResources().getDimensionPixelSize(R.dimen.notification_subtext_size);
  int i=0;
  while (i < mTexts.size() && i < rowIds.length) {
    CharSequence str=mTexts.get(i);
    if (str != null && !str.equals("String_Node_Str")) {
      contentView.setViewVisibility(rowIds[i],View.VISIBLE);
      contentView.setTextViewText(rowIds[i],mBuilder.processLegacyText(str));
      if (largeText) {
        contentView.setTextViewTextSize(rowIds[i],TypedValue.COMPLEX_UNIT_PX,subTextSize);
      }
    }
    i++;
  }
  contentView.setViewVisibility(R.id.inbox_end_pad,mTexts.size() > 0 ? View.VISIBLE : View.GONE);
  contentView.setViewVisibility(R.id.inbox_more,mTexts.size() > rowIds.length ? View.VISIBLE : View.GONE);
  applyTopPadding(contentView);
  mBuilder.addProfileBadge(contentView,R.id.profile_badge_large_template);
  return contentView;
}

Fixed version (ground truth):
private RemoteViews makeBigContentView(){
  CharSequence oldBuilderContentText=mBuilder.mContentText;
  mBuilder.mContentText=null;
  RemoteViews contentView=getStandardView(mBuilder.getInboxLayoutResource());
  mBuilder.mContentText=oldBuilderContentText;
  contentView.setViewVisibility(R.id.text2,View.GONE);
  int[] rowIds={R.id.inbox_text0,R.id.inbox_text1,R.id.inbox_text2,R.id.inbox_text3,R.id.inbox_text4,R.id.inbox_text5,R.id.inbox_text6};
  for (  int rowId : rowIds) {
    contentView.setViewVisibility(rowId,View.GONE);
  }
  final boolean largeText=mBuilder.mContext.getResources().getConfiguration().fontScale > 1f;
  final float subTextSize=mBuilder.mContext.getResources().getDimensionPixelSize(R.dimen.notification_subtext_size);
  int i=0;
  while (i < mTexts.size() && i < rowIds.length) {
    CharSequence str=mTexts.get(i);
    if (str != null && !str.equals("String_Node_Str")) {
      contentView.setViewVisibility(rowIds[i],View.VISIBLE);
      contentView.setTextViewText(rowIds[i],mBuilder.processLegacyText(str));
      if (largeText) {
        contentView.setTextViewTextSize(rowIds[i],TypedValue.COMPLEX_UNIT_PX,subTextSize);
      }
    }
    i++;
  }
  contentView.setViewVisibility(R.id.inbox_end_pad,mTexts.size() > 0 ? View.VISIBLE : View.GONE);
  contentView.setViewVisibility(R.id.inbox_more,mTexts.size() > rowIds.length ? View.VISIBLE : View.GONE);
  applyTopPadding(contentView);
  mBuilder.shrinkLine3Text(contentView);
  mBuilder.addProfileBadge(contentView,R.id.profile_badge_large_template);
  return contentView;
}
Program: 197904
Project: 197904
Buggy source:
private Bitmap getProfileBadge(){
  UserManager userManager=(UserManager)mContext.getSystemService(Context.USER_SERVICE);
  Drawable badge=userManager.getBadgeForUser(new UserHandle(mOriginatingUserId),0);
  if (badge == null) {
    return null;
  }
  final int width=badge.getIntrinsicWidth();
  final int height=badge.getIntrinsicHeight();
  Bitmap bitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  Canvas canvas=new Canvas(bitmap);
  badge.setBounds(0,0,width,height);
  badge.draw(canvas);
  return bitmap;
}

Fixed version (ground truth):
private Bitmap getProfileBadge(){
  Drawable badge=getProfileBadgeDrawable();
  if (badge == null) {
    return null;
  }
  final int size=mContext.getResources().getDimensionPixelSize(R.dimen.notification_badge_size);
  Bitmap bitmap=Bitmap.createBitmap(size,size,Bitmap.Config.ARGB_8888);
  Canvas canvas=new Canvas(bitmap);
  badge.setBounds(0,0,size,size);
  badge.draw(canvas);
  return bitmap;
}
Program: 197905
Project: 197905
Buggy source:
/** 
 * Changes the padding of the first line such that the big and small content view have the same top padding.
 * @hide
 */
protected void applyTopPadding(RemoteViews contentView){
  int topPadding=Builder.calculateTopPadding(mBuilder.mContext,mBuilder.hasThreeLines(),mBuilder.mContext.getResources().getConfiguration().fontScale);
  contentView.setViewPadding(R.id.line1,0,topPadding,0,0);
}

Fixed version (ground truth):
/** 
 * Changes the padding of the first line such that the big and small content view have the same top padding.
 * @hide
 */
protected void applyTopPadding(RemoteViews contentView){
  int topPadding=Builder.calculateTopPadding(mBuilder.mContext,mBuilder.mHasThreeLines,mBuilder.mContext.getResources().getConfiguration().fontScale);
  contentView.setViewPadding(R.id.line1,0,topPadding,0,0);
}
Program: 197907
Project: 197907
Buggy source:
/** 
 * Logic to find out whether the notification is going to have three lines in the contracted layout. This is used to adjust the top padding.
 * @return true if the notification is going to have three lines; false if the notificationis going to have one or two lines
 */
private boolean hasThreeLines(){
  boolean hasLine3=mContentText != null || mContentInfo != null || mNumber > 0;
  boolean hasLine2=(mSubText != null && mContentText != null) || (mSubText == null && (mProgressMax != 0 || mProgressIndeterminate));
  return hasLine2 && hasLine3;
}

Fixed version (ground truth):
/** 
 * Logic to find out whether the notification is going to have three lines in the contracted layout. This is used to adjust the top padding.
 * @return true if the notification is going to have three lines; false if the notificationis going to have one or two lines
 */
private boolean hasThreeLines(){
  boolean contentTextInLine2=mSubText != null && mContentText != null;
  boolean badgeInLine3=getProfileBadgeDrawable() != null && !contentTextInLine2;
  boolean hasLine3=mContentText != null || mContentInfo != null || mNumber > 0 || badgeInLine3;
  boolean hasLine2=(mSubText != null && mContentText != null) || (mSubText == null && (mProgressMax != 0 || mProgressIndeterminate));
  return hasLine2 && hasLine3;
}
Program: 197908
Project: 197908
Buggy source:
/** 
 * Rebuilds the notification passed in to the rebuild-constructor  {@link #Builder(Context,Notification)}. <p> Throws IllegalStateException when invoked on a Builder that isn't in rebuild mode.
 * @hide
 */
private Notification rebuild(){
  if (mRebuildNotification == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  Bundle extras=mRebuildNotification.extras;
  if (extras.getBoolean(EXTRA_REBUILD_LARGE_ICON)) {
    mRebuildNotification.largeIcon=extras.getParcelable(EXTRA_LARGE_ICON);
  }
  extras.remove(EXTRA_REBUILD_LARGE_ICON);
  if (extras.getBoolean(EXTRA_REBUILD_CONTENT_VIEW)) {
    setBuilderContentView(mRebuildNotification,makeContentView());
    if (mStyle != null) {
      mStyle.populateContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_BIG_CONTENT_VIEW)) {
    setBuilderBigContentView(mRebuildNotification,makeBigContentView());
    if (mStyle != null) {
      mStyle.populateBigContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_BIG_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW)) {
    setBuilderHeadsUpContentView(mRebuildNotification,makeHeadsUpContentView());
    if (mStyle != null) {
      mStyle.populateHeadsUpContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW);
  return mRebuildNotification;
}

Fixed version (ground truth):
/** 
 * Rebuilds the notification passed in to the rebuild-constructor  {@link #Builder(Context,Notification)}. <p> Throws IllegalStateException when invoked on a Builder that isn't in rebuild mode.
 * @hide
 */
private Notification rebuild(){
  if (mRebuildNotification == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  mHasThreeLines=hasThreeLines();
  Bundle extras=mRebuildNotification.extras;
  if (extras.getBoolean(EXTRA_REBUILD_LARGE_ICON)) {
    mRebuildNotification.largeIcon=extras.getParcelable(EXTRA_LARGE_ICON);
  }
  extras.remove(EXTRA_REBUILD_LARGE_ICON);
  if (extras.getBoolean(EXTRA_REBUILD_CONTENT_VIEW)) {
    setBuilderContentView(mRebuildNotification,makeContentView());
    if (mStyle != null) {
      mStyle.populateContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_BIG_CONTENT_VIEW)) {
    setBuilderBigContentView(mRebuildNotification,makeBigContentView());
    if (mStyle != null) {
      mStyle.populateBigContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_BIG_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW)) {
    setBuilderHeadsUpContentView(mRebuildNotification,makeHeadsUpContentView());
    if (mStyle != null) {
      mStyle.populateHeadsUpContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW);
  mHasThreeLines=false;
  return mRebuildNotification;
}
Program: 197909
Project: 197909
Buggy source:
private RemoteViews makeBigContentView(){
  CharSequence oldBuilderContentText=mBuilder.mContentText;
  mBuilder.mContentText=null;
  RemoteViews contentView=getStandardView(mBuilder.getInboxLayoutResource());
  mBuilder.mContentText=oldBuilderContentText;
  contentView.setViewVisibility(R.id.text2,View.GONE);
  int[] rowIds={R.id.inbox_text0,R.id.inbox_text1,R.id.inbox_text2,R.id.inbox_text3,R.id.inbox_text4,R.id.inbox_text5,R.id.inbox_text6};
  for (  int rowId : rowIds) {
    contentView.setViewVisibility(rowId,View.GONE);
  }
  final boolean largeText=mBuilder.mContext.getResources().getConfiguration().fontScale > 1f;
  final float subTextSize=mBuilder.mContext.getResources().getDimensionPixelSize(R.dimen.notification_subtext_size);
  int i=0;
  while (i < mTexts.size() && i < rowIds.length) {
    CharSequence str=mTexts.get(i);
    if (str != null && !str.equals("String_Node_Str")) {
      contentView.setViewVisibility(rowIds[i],View.VISIBLE);
      contentView.setTextViewText(rowIds[i],mBuilder.processLegacyText(str));
      if (largeText) {
        contentView.setTextViewTextSize(rowIds[i],TypedValue.COMPLEX_UNIT_PX,subTextSize);
      }
    }
    i++;
  }
  contentView.setViewVisibility(R.id.inbox_end_pad,mTexts.size() > 0 ? View.VISIBLE : View.GONE);
  contentView.setViewVisibility(R.id.inbox_more,mTexts.size() > rowIds.length ? View.VISIBLE : View.GONE);
  applyTopPadding(contentView);
  mBuilder.addProfileBadge(contentView,R.id.profile_badge_large_template);
  return contentView;
}

Fixed version (ground truth):
private RemoteViews makeBigContentView(){
  CharSequence oldBuilderContentText=mBuilder.mContentText;
  mBuilder.mContentText=null;
  RemoteViews contentView=getStandardView(mBuilder.getInboxLayoutResource());
  mBuilder.mContentText=oldBuilderContentText;
  contentView.setViewVisibility(R.id.text2,View.GONE);
  int[] rowIds={R.id.inbox_text0,R.id.inbox_text1,R.id.inbox_text2,R.id.inbox_text3,R.id.inbox_text4,R.id.inbox_text5,R.id.inbox_text6};
  for (  int rowId : rowIds) {
    contentView.setViewVisibility(rowId,View.GONE);
  }
  final boolean largeText=mBuilder.mContext.getResources().getConfiguration().fontScale > 1f;
  final float subTextSize=mBuilder.mContext.getResources().getDimensionPixelSize(R.dimen.notification_subtext_size);
  int i=0;
  while (i < mTexts.size() && i < rowIds.length) {
    CharSequence str=mTexts.get(i);
    if (str != null && !str.equals("String_Node_Str")) {
      contentView.setViewVisibility(rowIds[i],View.VISIBLE);
      contentView.setTextViewText(rowIds[i],mBuilder.processLegacyText(str));
      if (largeText) {
        contentView.setTextViewTextSize(rowIds[i],TypedValue.COMPLEX_UNIT_PX,subTextSize);
      }
    }
    i++;
  }
  contentView.setViewVisibility(R.id.inbox_end_pad,mTexts.size() > 0 ? View.VISIBLE : View.GONE);
  contentView.setViewVisibility(R.id.inbox_more,mTexts.size() > rowIds.length ? View.VISIBLE : View.GONE);
  applyTopPadding(contentView);
  mBuilder.shrinkLine3Text(contentView);
  mBuilder.addProfileBadge(contentView,R.id.profile_badge_large_template);
  return contentView;
}
Program: 197910
Project: 197910
Buggy source:
private Bitmap getProfileBadge(){
  UserManager userManager=(UserManager)mContext.getSystemService(Context.USER_SERVICE);
  Drawable badge=userManager.getBadgeForUser(new UserHandle(mOriginatingUserId),0);
  if (badge == null) {
    return null;
  }
  final int width=badge.getIntrinsicWidth();
  final int height=badge.getIntrinsicHeight();
  Bitmap bitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  Canvas canvas=new Canvas(bitmap);
  badge.setBounds(0,0,width,height);
  badge.draw(canvas);
  return bitmap;
}

Fixed version (ground truth):
private Bitmap getProfileBadge(){
  Drawable badge=getProfileBadgeDrawable();
  if (badge == null) {
    return null;
  }
  final int size=mContext.getResources().getDimensionPixelSize(R.dimen.notification_badge_size);
  Bitmap bitmap=Bitmap.createBitmap(size,size,Bitmap.Config.ARGB_8888);
  Canvas canvas=new Canvas(bitmap);
  badge.setBounds(0,0,size,size);
  badge.draw(canvas);
  return bitmap;
}
Program: 197911
Project: 197911
Buggy source:
/** 
 * Changes the padding of the first line such that the big and small content view have the same top padding.
 * @hide
 */
protected void applyTopPadding(RemoteViews contentView){
  int topPadding=Builder.calculateTopPadding(mBuilder.mContext,mBuilder.hasThreeLines(),mBuilder.mContext.getResources().getConfiguration().fontScale);
  contentView.setViewPadding(R.id.line1,0,topPadding,0,0);
}

Fixed version (ground truth):
/** 
 * Changes the padding of the first line such that the big and small content view have the same top padding.
 * @hide
 */
protected void applyTopPadding(RemoteViews contentView){
  int topPadding=Builder.calculateTopPadding(mBuilder.mContext,mBuilder.mHasThreeLines,mBuilder.mContext.getResources().getConfiguration().fontScale);
  contentView.setViewPadding(R.id.line1,0,topPadding,0,0);
}
Program: 197913
Project: 197913
Buggy source:
/** 
 * Logic to find out whether the notification is going to have three lines in the contracted layout. This is used to adjust the top padding.
 * @return true if the notification is going to have three lines; false if the notificationis going to have one or two lines
 */
private boolean hasThreeLines(){
  boolean hasLine3=mContentText != null || mContentInfo != null || mNumber > 0;
  boolean hasLine2=(mSubText != null && mContentText != null) || (mSubText == null && (mProgressMax != 0 || mProgressIndeterminate));
  return hasLine2 && hasLine3;
}

Fixed version (ground truth):
/** 
 * Logic to find out whether the notification is going to have three lines in the contracted layout. This is used to adjust the top padding.
 * @return true if the notification is going to have three lines; false if the notificationis going to have one or two lines
 */
private boolean hasThreeLines(){
  boolean contentTextInLine2=mSubText != null && mContentText != null;
  boolean badgeInLine3=getProfileBadgeDrawable() != null && !contentTextInLine2;
  boolean hasLine3=mContentText != null || mContentInfo != null || mNumber > 0 || badgeInLine3;
  boolean hasLine2=(mSubText != null && mContentText != null) || (mSubText == null && (mProgressMax != 0 || mProgressIndeterminate));
  return hasLine2 && hasLine3;
}
Program: 197914
Project: 197914
Buggy source:
/** 
 * Rebuilds the notification passed in to the rebuild-constructor  {@link #Builder(Context,Notification)}. <p> Throws IllegalStateException when invoked on a Builder that isn't in rebuild mode.
 * @hide
 */
private Notification rebuild(){
  if (mRebuildNotification == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  Bundle extras=mRebuildNotification.extras;
  if (extras.getBoolean(EXTRA_REBUILD_LARGE_ICON)) {
    mRebuildNotification.largeIcon=extras.getParcelable(EXTRA_LARGE_ICON);
  }
  extras.remove(EXTRA_REBUILD_LARGE_ICON);
  if (extras.getBoolean(EXTRA_REBUILD_CONTENT_VIEW)) {
    setBuilderContentView(mRebuildNotification,makeContentView());
    if (mStyle != null) {
      mStyle.populateContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_BIG_CONTENT_VIEW)) {
    setBuilderBigContentView(mRebuildNotification,makeBigContentView());
    if (mStyle != null) {
      mStyle.populateBigContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_BIG_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW)) {
    setBuilderHeadsUpContentView(mRebuildNotification,makeHeadsUpContentView());
    if (mStyle != null) {
      mStyle.populateHeadsUpContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW);
  return mRebuildNotification;
}

Fixed version (ground truth):
/** 
 * Rebuilds the notification passed in to the rebuild-constructor  {@link #Builder(Context,Notification)}. <p> Throws IllegalStateException when invoked on a Builder that isn't in rebuild mode.
 * @hide
 */
private Notification rebuild(){
  if (mRebuildNotification == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  mHasThreeLines=hasThreeLines();
  Bundle extras=mRebuildNotification.extras;
  if (extras.getBoolean(EXTRA_REBUILD_LARGE_ICON)) {
    mRebuildNotification.largeIcon=extras.getParcelable(EXTRA_LARGE_ICON);
  }
  extras.remove(EXTRA_REBUILD_LARGE_ICON);
  if (extras.getBoolean(EXTRA_REBUILD_CONTENT_VIEW)) {
    setBuilderContentView(mRebuildNotification,makeContentView());
    if (mStyle != null) {
      mStyle.populateContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_BIG_CONTENT_VIEW)) {
    setBuilderBigContentView(mRebuildNotification,makeBigContentView());
    if (mStyle != null) {
      mStyle.populateBigContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_BIG_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW)) {
    setBuilderHeadsUpContentView(mRebuildNotification,makeHeadsUpContentView());
    if (mStyle != null) {
      mStyle.populateHeadsUpContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW);
  mHasThreeLines=false;
  return mRebuildNotification;
}
Program: 197915
Project: 197915
Buggy source:
private RemoteViews makeBigContentView(){
  CharSequence oldBuilderContentText=mBuilder.mContentText;
  mBuilder.mContentText=null;
  RemoteViews contentView=getStandardView(mBuilder.getInboxLayoutResource());
  mBuilder.mContentText=oldBuilderContentText;
  contentView.setViewVisibility(R.id.text2,View.GONE);
  int[] rowIds={R.id.inbox_text0,R.id.inbox_text1,R.id.inbox_text2,R.id.inbox_text3,R.id.inbox_text4,R.id.inbox_text5,R.id.inbox_text6};
  for (  int rowId : rowIds) {
    contentView.setViewVisibility(rowId,View.GONE);
  }
  final boolean largeText=mBuilder.mContext.getResources().getConfiguration().fontScale > 1f;
  final float subTextSize=mBuilder.mContext.getResources().getDimensionPixelSize(R.dimen.notification_subtext_size);
  int i=0;
  while (i < mTexts.size() && i < rowIds.length) {
    CharSequence str=mTexts.get(i);
    if (str != null && !str.equals("String_Node_Str")) {
      contentView.setViewVisibility(rowIds[i],View.VISIBLE);
      contentView.setTextViewText(rowIds[i],mBuilder.processLegacyText(str));
      if (largeText) {
        contentView.setTextViewTextSize(rowIds[i],TypedValue.COMPLEX_UNIT_PX,subTextSize);
      }
    }
    i++;
  }
  contentView.setViewVisibility(R.id.inbox_end_pad,mTexts.size() > 0 ? View.VISIBLE : View.GONE);
  contentView.setViewVisibility(R.id.inbox_more,mTexts.size() > rowIds.length ? View.VISIBLE : View.GONE);
  applyTopPadding(contentView);
  mBuilder.addProfileBadge(contentView,R.id.profile_badge_large_template);
  return contentView;
}

Fixed version (ground truth):
private RemoteViews makeBigContentView(){
  CharSequence oldBuilderContentText=mBuilder.mContentText;
  mBuilder.mContentText=null;
  RemoteViews contentView=getStandardView(mBuilder.getInboxLayoutResource());
  mBuilder.mContentText=oldBuilderContentText;
  contentView.setViewVisibility(R.id.text2,View.GONE);
  int[] rowIds={R.id.inbox_text0,R.id.inbox_text1,R.id.inbox_text2,R.id.inbox_text3,R.id.inbox_text4,R.id.inbox_text5,R.id.inbox_text6};
  for (  int rowId : rowIds) {
    contentView.setViewVisibility(rowId,View.GONE);
  }
  final boolean largeText=mBuilder.mContext.getResources().getConfiguration().fontScale > 1f;
  final float subTextSize=mBuilder.mContext.getResources().getDimensionPixelSize(R.dimen.notification_subtext_size);
  int i=0;
  while (i < mTexts.size() && i < rowIds.length) {
    CharSequence str=mTexts.get(i);
    if (str != null && !str.equals("String_Node_Str")) {
      contentView.setViewVisibility(rowIds[i],View.VISIBLE);
      contentView.setTextViewText(rowIds[i],mBuilder.processLegacyText(str));
      if (largeText) {
        contentView.setTextViewTextSize(rowIds[i],TypedValue.COMPLEX_UNIT_PX,subTextSize);
      }
    }
    i++;
  }
  contentView.setViewVisibility(R.id.inbox_end_pad,mTexts.size() > 0 ? View.VISIBLE : View.GONE);
  contentView.setViewVisibility(R.id.inbox_more,mTexts.size() > rowIds.length ? View.VISIBLE : View.GONE);
  applyTopPadding(contentView);
  mBuilder.shrinkLine3Text(contentView);
  mBuilder.addProfileBadge(contentView,R.id.profile_badge_large_template);
  return contentView;
}
Program: 197916
Project: 197916
Buggy source:
private Bitmap getProfileBadge(){
  UserManager userManager=(UserManager)mContext.getSystemService(Context.USER_SERVICE);
  Drawable badge=userManager.getBadgeForUser(new UserHandle(mOriginatingUserId),0);
  if (badge == null) {
    return null;
  }
  final int width=badge.getIntrinsicWidth();
  final int height=badge.getIntrinsicHeight();
  Bitmap bitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  Canvas canvas=new Canvas(bitmap);
  badge.setBounds(0,0,width,height);
  badge.draw(canvas);
  return bitmap;
}

Fixed version (ground truth):
private Bitmap getProfileBadge(){
  Drawable badge=getProfileBadgeDrawable();
  if (badge == null) {
    return null;
  }
  final int size=mContext.getResources().getDimensionPixelSize(R.dimen.notification_badge_size);
  Bitmap bitmap=Bitmap.createBitmap(size,size,Bitmap.Config.ARGB_8888);
  Canvas canvas=new Canvas(bitmap);
  badge.setBounds(0,0,size,size);
  badge.draw(canvas);
  return bitmap;
}
Program: 197917
Project: 197917
Buggy source:
/** 
 * Changes the padding of the first line such that the big and small content view have the same top padding.
 * @hide
 */
protected void applyTopPadding(RemoteViews contentView){
  int topPadding=Builder.calculateTopPadding(mBuilder.mContext,mBuilder.hasThreeLines(),mBuilder.mContext.getResources().getConfiguration().fontScale);
  contentView.setViewPadding(R.id.line1,0,topPadding,0,0);
}

Fixed version (ground truth):
/** 
 * Changes the padding of the first line such that the big and small content view have the same top padding.
 * @hide
 */
protected void applyTopPadding(RemoteViews contentView){
  int topPadding=Builder.calculateTopPadding(mBuilder.mContext,mBuilder.mHasThreeLines,mBuilder.mContext.getResources().getConfiguration().fontScale);
  contentView.setViewPadding(R.id.line1,0,topPadding,0,0);
}
Program: 197919
Project: 197919
Buggy source:
/** 
 * Logic to find out whether the notification is going to have three lines in the contracted layout. This is used to adjust the top padding.
 * @return true if the notification is going to have three lines; false if the notificationis going to have one or two lines
 */
private boolean hasThreeLines(){
  boolean hasLine3=mContentText != null || mContentInfo != null || mNumber > 0;
  boolean hasLine2=(mSubText != null && mContentText != null) || (mSubText == null && (mProgressMax != 0 || mProgressIndeterminate));
  return hasLine2 && hasLine3;
}

Fixed version (ground truth):
/** 
 * Logic to find out whether the notification is going to have three lines in the contracted layout. This is used to adjust the top padding.
 * @return true if the notification is going to have three lines; false if the notificationis going to have one or two lines
 */
private boolean hasThreeLines(){
  boolean contentTextInLine2=mSubText != null && mContentText != null;
  boolean badgeInLine3=getProfileBadgeDrawable() != null && !contentTextInLine2;
  boolean hasLine3=mContentText != null || mContentInfo != null || mNumber > 0 || badgeInLine3;
  boolean hasLine2=(mSubText != null && mContentText != null) || (mSubText == null && (mProgressMax != 0 || mProgressIndeterminate));
  return hasLine2 && hasLine3;
}
Program: 197920
Project: 197920
Buggy source:
/** 
 * Rebuilds the notification passed in to the rebuild-constructor  {@link #Builder(Context,Notification)}. <p> Throws IllegalStateException when invoked on a Builder that isn't in rebuild mode.
 * @hide
 */
private Notification rebuild(){
  if (mRebuildNotification == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  Bundle extras=mRebuildNotification.extras;
  if (extras.getBoolean(EXTRA_REBUILD_LARGE_ICON)) {
    mRebuildNotification.largeIcon=extras.getParcelable(EXTRA_LARGE_ICON);
  }
  extras.remove(EXTRA_REBUILD_LARGE_ICON);
  if (extras.getBoolean(EXTRA_REBUILD_CONTENT_VIEW)) {
    setBuilderContentView(mRebuildNotification,makeContentView());
    if (mStyle != null) {
      mStyle.populateContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_BIG_CONTENT_VIEW)) {
    setBuilderBigContentView(mRebuildNotification,makeBigContentView());
    if (mStyle != null) {
      mStyle.populateBigContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_BIG_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW)) {
    setBuilderHeadsUpContentView(mRebuildNotification,makeHeadsUpContentView());
    if (mStyle != null) {
      mStyle.populateHeadsUpContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW);
  return mRebuildNotification;
}

Fixed version (ground truth):
/** 
 * Rebuilds the notification passed in to the rebuild-constructor  {@link #Builder(Context,Notification)}. <p> Throws IllegalStateException when invoked on a Builder that isn't in rebuild mode.
 * @hide
 */
private Notification rebuild(){
  if (mRebuildNotification == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  mHasThreeLines=hasThreeLines();
  Bundle extras=mRebuildNotification.extras;
  if (extras.getBoolean(EXTRA_REBUILD_LARGE_ICON)) {
    mRebuildNotification.largeIcon=extras.getParcelable(EXTRA_LARGE_ICON);
  }
  extras.remove(EXTRA_REBUILD_LARGE_ICON);
  if (extras.getBoolean(EXTRA_REBUILD_CONTENT_VIEW)) {
    setBuilderContentView(mRebuildNotification,makeContentView());
    if (mStyle != null) {
      mStyle.populateContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_BIG_CONTENT_VIEW)) {
    setBuilderBigContentView(mRebuildNotification,makeBigContentView());
    if (mStyle != null) {
      mStyle.populateBigContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_BIG_CONTENT_VIEW);
  if (extras.getBoolean(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW)) {
    setBuilderHeadsUpContentView(mRebuildNotification,makeHeadsUpContentView());
    if (mStyle != null) {
      mStyle.populateHeadsUpContentView(mRebuildNotification);
    }
  }
  extras.remove(EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW);
  mHasThreeLines=false;
  return mRebuildNotification;
}
Program: 197921
Project: 197921
Buggy source:
private RemoteViews makeBigContentView(){
  CharSequence oldBuilderContentText=mBuilder.mContentText;
  mBuilder.mContentText=null;
  RemoteViews contentView=getStandardView(mBuilder.getInboxLayoutResource());
  mBuilder.mContentText=oldBuilderContentText;
  contentView.setViewVisibility(R.id.text2,View.GONE);
  int[] rowIds={R.id.inbox_text0,R.id.inbox_text1,R.id.inbox_text2,R.id.inbox_text3,R.id.inbox_text4,R.id.inbox_text5,R.id.inbox_text6};
  for (  int rowId : rowIds) {
    contentView.setViewVisibility(rowId,View.GONE);
  }
  final boolean largeText=mBuilder.mContext.getResources().getConfiguration().fontScale > 1f;
  final float subTextSize=mBuilder.mContext.getResources().getDimensionPixelSize(R.dimen.notification_subtext_size);
  int i=0;
  while (i < mTexts.size() && i < rowIds.length) {
    CharSequence str=mTexts.get(i);
    if (str != null && !str.equals("String_Node_Str")) {
      contentView.setViewVisibility(rowIds[i],View.VISIBLE);
      contentView.setTextViewText(rowIds[i],mBuilder.processLegacyText(str));
      if (largeText) {
        contentView.setTextViewTextSize(rowIds[i],TypedValue.COMPLEX_UNIT_PX,subTextSize);
      }
    }
    i++;
  }
  contentView.setViewVisibility(R.id.inbox_end_pad,mTexts.size() > 0 ? View.VISIBLE : View.GONE);
  contentView.setViewVisibility(R.id.inbox_more,mTexts.size() > rowIds.length ? View.VISIBLE : View.GONE);
  applyTopPadding(contentView);
  mBuilder.addProfileBadge(contentView,R.id.profile_badge_large_template);
  return contentView;
}

Fixed version (ground truth):
private RemoteViews makeBigContentView(){
  CharSequence oldBuilderContentText=mBuilder.mContentText;
  mBuilder.mContentText=null;
  RemoteViews contentView=getStandardView(mBuilder.getInboxLayoutResource());
  mBuilder.mContentText=oldBuilderContentText;
  contentView.setViewVisibility(R.id.text2,View.GONE);
  int[] rowIds={R.id.inbox_text0,R.id.inbox_text1,R.id.inbox_text2,R.id.inbox_text3,R.id.inbox_text4,R.id.inbox_text5,R.id.inbox_text6};
  for (  int rowId : rowIds) {
    contentView.setViewVisibility(rowId,View.GONE);
  }
  final boolean largeText=mBuilder.mContext.getResources().getConfiguration().fontScale > 1f;
  final float subTextSize=mBuilder.mContext.getResources().getDimensionPixelSize(R.dimen.notification_subtext_size);
  int i=0;
  while (i < mTexts.size() && i < rowIds.length) {
    CharSequence str=mTexts.get(i);
    if (str != null && !str.equals("String_Node_Str")) {
      contentView.setViewVisibility(rowIds[i],View.VISIBLE);
      contentView.setTextViewText(rowIds[i],mBuilder.processLegacyText(str));
      if (largeText) {
        contentView.setTextViewTextSize(rowIds[i],TypedValue.COMPLEX_UNIT_PX,subTextSize);
      }
    }
    i++;
  }
  contentView.setViewVisibility(R.id.inbox_end_pad,mTexts.size() > 0 ? View.VISIBLE : View.GONE);
  contentView.setViewVisibility(R.id.inbox_more,mTexts.size() > rowIds.length ? View.VISIBLE : View.GONE);
  applyTopPadding(contentView);
  mBuilder.shrinkLine3Text(contentView);
  mBuilder.addProfileBadge(contentView,R.id.profile_badge_large_template);
  return contentView;
}
Program: 197922
Project: 197922
Buggy source:
private Bitmap getProfileBadge(){
  UserManager userManager=(UserManager)mContext.getSystemService(Context.USER_SERVICE);
  Drawable badge=userManager.getBadgeForUser(new UserHandle(mOriginatingUserId),0);
  if (badge == null) {
    return null;
  }
  final int width=badge.getIntrinsicWidth();
  final int height=badge.getIntrinsicHeight();
  Bitmap bitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
  Canvas canvas=new Canvas(bitmap);
  badge.setBounds(0,0,width,height);
  badge.draw(canvas);
  return bitmap;
}

Fixed version (ground truth):
private Bitmap getProfileBadge(){
  Drawable badge=getProfileBadgeDrawable();
  if (badge == null) {
    return null;
  }
  final int size=mContext.getResources().getDimensionPixelSize(R.dimen.notification_badge_size);
  Bitmap bitmap=Bitmap.createBitmap(size,size,Bitmap.Config.ARGB_8888);
  Canvas canvas=new Canvas(bitmap);
  badge.setBounds(0,0,size,size);
  badge.draw(canvas);
  return bitmap;
}
Program: 197923
Project: 197923
Buggy source:
/** 
 * Changes the padding of the first line such that the big and small content view have the same top padding.
 * @hide
 */
protected void applyTopPadding(RemoteViews contentView){
  int topPadding=Builder.calculateTopPadding(mBuilder.mContext,mBuilder.hasThreeLines(),mBuilder.mContext.getResources().getConfiguration().fontScale);
  contentView.setViewPadding(R.id.line1,0,topPadding,0,0);
}

Fixed version (ground truth):
/** 
 * Changes the padding of the first line such that the big and small content view have the same top padding.
 * @hide
 */
protected void applyTopPadding(RemoteViews contentView){
  int topPadding=Builder.calculateTopPadding(mBuilder.mContext,mBuilder.mHasThreeLines,mBuilder.mContext.getResources().getConfiguration().fontScale);
  contentView.setViewPadding(R.id.line1,0,topPadding,0,0);
}
Program: 197925
Project: 197925
Buggy source:
/** 
 * Logic to find out whether the notification is going to have three lines in the contracted layout. This is used to adjust the top padding.
 * @return true if the notification is going to have three lines; false if the notificationis going to have one or two lines
 */
private boolean hasThreeLines(){
  boolean hasLine3=mContentText != null || mContentInfo != null || mNumber > 0;
  boolean hasLine2=(mSubText != null && mContentText != null) || (mSubText == null && (mProgressMax != 0 || mProgressIndeterminate));
  return hasLine2 && hasLine3;
}

Fixed version (ground truth):
/** 
 * Logic to find out whether the notification is going to have three lines in the contracted layout. This is used to adjust the top padding.
 * @return true if the notification is going to have three lines; false if the notificationis going to have one or two lines
 */
private boolean hasThreeLines(){
  boolean contentTextInLine2=mSubText != null && mContentText != null;
  boolean badgeInLine3=getProfileBadgeDrawable() != null && !contentTextInLine2;
  boolean hasLine3=mContentText != null || mContentInfo != null || mNumber > 0 || badgeInLine3;
  boolean hasLine2=(mSubText != null && mContentText != null) || (mSubText == null && (mProgressMax != 0 || mProgressIndeterminate));
  return hasLine2 && hasLine3;
}