nus-yam/ex-repair huggingface dataset:
Program: 79774
Project: 79774
Buggy source:
protected void handleSubscribeMessage(SubscribeMessage subscribeMessage) throws Exception {
  try {
    List<SubscribeMessage.Couple> subs=subscribeMessage.subscriptions();
    for (    SubscribeMessage.Couple c : subs) {
      byte requestedQosByte=c.getQos();
      final QOSType requestedQos=toQos(requestedQosByte);
      String topic=c.getTopic();
      subscribeClientToTopic(topic,requestedQos);
      if (clientID != null && cleanSession == false) {
        Subscription s=new Subscription();
        s.setQos(requestedQosByte);
        s.setTopic(topic);
        getStore().saveSubscription(s,clientID);
      }
    }
  }
 catch (  Throwable e) {
    container.logger().error(e.getMessage());
  }
}

Fixed version (ground truth):
protected void handleSubscribeMessage(SubscribeMessage subscribeMessage) throws Exception {
  try {
    List<SubscribeMessage.Couple> subs=subscribeMessage.subscriptions();
    for (    SubscribeMessage.Couple c : subs) {
      byte requestedQosByte=c.getQos();
      final QOSType requestedQos=toQos(requestedQosByte);
      String topic=c.getTopic();
      subscribeClientToTopic(topic,requestedQos);
      if (clientID != null && cleanSession == false) {
        Subscription s=new Subscription();
        s.setQos(requestedQosByte);
        s.setTopic(topic);
        getStore().saveSubscription(s,clientID);
      }
      republishPendingMessagesForSubscription(topic);
    }
  }
 catch (  Throwable e) {
    container.logger().error(e.getMessage());
  }
}
Program: 79775
Project: 79775
Buggy source:
private void republishPendingMessages() throws Exception {
  if (cleanSession) {
  }
 else {
    MQTTStoreManager store=getStore();
    List<Subscription> subscriptions=store.getSubscriptionsByClientID(clientID);
    for (    Subscription sub : subscriptions) {
      QOSType qos=new QOSUtils().toQos(sub.getQos());
      String topic2=sub.getTopic();
      subscribeClientToTopic(topic2,qos);
      List<byte[]> messages=store.getMessagesByTopic(topic2,clientID);
      for (      byte[] message : messages) {
        PublishMessage pm=(PublishMessage)decoder.dec(new Buffer(message));
        sendMessageToClient(pm);
        deleteMessage(pm);
      }
    }
  }
}

Fixed version (ground truth):
private void republishPendingMessages() throws Exception {
  if (cleanSession) {
  }
 else {
    MQTTStoreManager store=getStore();
    List<Subscription> subscriptions=store.getSubscriptionsByClientID(clientID);
    for (    Subscription sub : subscriptions) {
      QOSType qos=new QOSUtils().toQos(sub.getQos());
      String topic2=sub.getTopic();
      subscribeClientToTopic(topic2,qos);
      republishPendingMessagesForSubscription(topic2);
    }
  }
}
Program: 79776
Project: 79776
Buggy source:
private static View createContentLayout(Context context,StatusBarNotification n){
  LayoutInflater inflater=LayoutInflater.from(context);
  View rootLayout=inflater.inflate(R.layout.content_layout,null);
  ImageView contactImageView=(ImageView)rootLayout.findViewById(R.id.contact_image);
  contactImageView.setImageDrawable(getNotificationContactImage(context,n));
  TextView contentTextView=(TextView)rootLayout.findViewById(R.id.content_text);
  TextView contentTitleView=(TextView)rootLayout.findViewById(R.id.title_text);
  String content=NotificationHelper.getNotificationContent(n);
  String title=NotificationHelper.getNotificationTitle(n);
  if (!content.startsWith(NotificationHelper.getNotificationTitle(n))) {
    contentTitleView.setText(title);
  }
 else {
    contentTextView.setVisibility(View.GONE);
  }
  contentTextView.setText(content);
  if (contactImageView.getDrawable() == null) {
    int padding=context.getResources().getDimensionPixelSize(R.dimen.content_text_paddings);
    contentTextView.setPadding(padding,contentTextView.getPaddingTop(),padding,contentTextView.getPaddingBottom());
    contentTitleView.setPadding(padding,contentTextView.getPaddingTop(),padding,contentTextView.getPaddingBottom());
    contactImageView.setVisibility(View.GONE);
  }
  return rootLayout;
}

Fixed version (ground truth):
private static View createContentLayout(Context context,StatusBarNotification n){
  LayoutInflater inflater=LayoutInflater.from(context);
  View rootLayout=inflater.inflate(R.layout.content_layout,null);
  ImageView contactImageView=(ImageView)rootLayout.findViewById(R.id.contact_image);
  contactImageView.setImageDrawable(getNotificationContactImage(context,n));
  TextView contentTextView=(TextView)rootLayout.findViewById(R.id.content_text);
  TextView contentTitleView=(TextView)rootLayout.findViewById(R.id.title_text);
  String content=NotificationHelper.getNotificationContent(n);
  String title=NotificationHelper.getNotificationTitle(n);
  if (content != null && !content.startsWith(NotificationHelper.getNotificationTitle(n))) {
    contentTitleView.setText(title);
  }
 else {
    contentTextView.setVisibility(View.GONE);
  }
  contentTextView.setText(content);
  if (contactImageView.getDrawable() == null) {
    int padding=context.getResources().getDimensionPixelSize(R.dimen.content_text_paddings);
    contentTextView.setPadding(padding,contentTextView.getPaddingTop(),padding,contentTextView.getPaddingBottom());
    contentTitleView.setPadding(padding,contentTextView.getPaddingTop(),padding,contentTextView.getPaddingBottom());
    contactImageView.setVisibility(View.GONE);
  }
  return rootLayout;
}
Program: 79777
Project: 79777
Buggy source:
/** 
 * Get text from notification with specific field.
 * @param n     StatusBarNotification object.
 * @param field StatusBarNotification extra field.
 * @return Notification text.
 */
public static String getNotificationText(StatusBarNotification n,String field){
  String text=null;
  if (n != null) {
    Notification notification=n.getNotification();
    Bundle extras=notification.extras;
    text=extras.getString(field);
  }
  return text;
}

Fixed version (ground truth):
/** 
 * Get text from notification with specific field.
 * @param n     StatusBarNotification object.
 * @param field StatusBarNotification extra field.
 * @return Notification text.
 */
public static String getNotificationText(StatusBarNotification n,String field){
  String text=null;
  if (n != null) {
    Notification notification=n.getNotification();
    Bundle extras=notification.extras;
    CharSequence chars=extras.getCharSequence(field);
    text=chars != null ? chars.toString() : null;
  }
  return text;
}
Program: 79778
Project: 79778
Buggy source:
private void updateSelection(StatusBarNotification n){
  String oldNotif=NotificationHelper.getContentDescription((StatusBarNotification)mNotificationView.getTag());
  String newNotif=NotificationHelper.getContentDescription(n);
  boolean sameNotification=newNotif.equals(oldNotif);
  if (!mAnimating || sameNotification) {
    Bitmap b=n.getNotification().largeIcon;
    if (b != null) {
      mNotificationIcon.setImageDrawable(NotificationPeekViewUtils.getRoundedShape(mContext.getResources(),b));
    }
 else {
      mNotificationIcon.setImageDrawable(NotificationPeekViewUtils.getIconFromResource(mContext,n));
    }
    mNotificationText.setText(NotificationPeekViewUtils.getNotificationDisplayText(mContext,n));
    mNotificationText.setVisibility(isKeyguardSecureShowing() ? View.GONE : View.VISIBLE);
    mNotificationView.setTag(n);
    if (!sameNotification || mNotificationView.getX() != 0) {
      mNotificationView.setAlpha(1f);
      mNotificationView.setX(0);
    }
  }
  for (int i=0; i < mNotificationsContainer.getChildCount(); i++) {
    ImageView view=(ImageView)mNotificationsContainer.getChildAt(i);
    if ((mAnimating ? oldNotif : newNotif).equals(NotificationHelper.getContentDescription((StatusBarNotification)view.getTag()))) {
      view.setAlpha(1f);
    }
 else {
      view.setAlpha(ICON_LOW_OPACITY);
    }
  }
}

Fixed version (ground truth):
private void updateSelection(StatusBarNotification n){
  String oldNotif=NotificationHelper.getContentDescription((StatusBarNotification)mNotificationView.getTag());
  String newNotif=NotificationHelper.getContentDescription(n);
  boolean sameNotification=newNotif.equals(oldNotif);
  if (!mAnimating || sameNotification) {
    Bitmap b=n.getNotification().largeIcon;
    if (b != null) {
      mNotificationIcon.setImageDrawable(NotificationPeekViewUtils.getRoundedShape(mContext.getResources(),b));
    }
 else {
      mNotificationIcon.setImageDrawable(NotificationPeekViewUtils.getIconFromResource(mContext,n));
    }
    final PendingIntent contentIntent=n.getNotification().contentIntent;
    if (contentIntent != null) {
      mNotificationIcon.setOnClickListener(new NotificationClicker(n,this));
    }
 else {
      mNotificationIcon.setOnClickListener(null);
    }
    mNotificationText.setText(NotificationPeekViewUtils.getNotificationDisplayText(mContext,n));
    mNotificationText.setVisibility(isKeyguardSecureShowing() ? View.GONE : View.VISIBLE);
    mNotificationView.setTag(n);
    if (!sameNotification || mNotificationView.getX() != 0) {
      mNotificationView.setAlpha(1f);
      mNotificationView.setX(0);
    }
  }
  for (int i=0; i < mNotificationsContainer.getChildCount(); i++) {
    ImageView view=(ImageView)mNotificationsContainer.getChildAt(i);
    if ((mAnimating ? oldNotif : newNotif).equals(NotificationHelper.getContentDescription((StatusBarNotification)view.getTag()))) {
      view.setAlpha(1f);
    }
 else {
      view.setAlpha(ICON_LOW_OPACITY);
    }
  }
}
Program: 79780
Project: 79780
Buggy source:
private void hideNotificationContent(){
  if (!mContentShowing) {
    return;
  }
  mContentShowing=false;
  final View contentView=mPeekView.findViewById(R.id.notification_content);
  TextView contentTextView=(TextView)contentView.findViewById(R.id.content_text);
  contentView.animate().alpha(0f).setInterpolator(new AccelerateInterpolator()).setListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      super.onAnimationEnd(animation);
      mPeekView.removeView(contentView);
    }
  }
).start();
  contentTextView.animate().translationY(50).setInterpolator(new AccelerateInterpolator()).start();
  mNotificationText.animate().alpha(1f).setInterpolator(new AccelerateInterpolator()).start();
  if (mClockTextView != null) {
    mClockTextView.animate().alpha(1f).setInterpolator(new AccelerateInterpolator()).start();
  }
}

Fixed version (ground truth):
private void hideNotificationContent(){
  if (!mContentShowing) {
    return;
  }
  mContentShowing=false;
  final View contentView=mPeekView.findViewById(R.id.notification_content);
  LinearLayout contentTextLayout=(LinearLayout)contentView.findViewById(R.id.content_layout);
  contentTextLayout.animate().translationY(50).setInterpolator(new AccelerateInterpolator()).start();
  contentView.animate().alpha(0f).setInterpolator(new AccelerateInterpolator()).setListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      super.onAnimationEnd(animation);
      if (contentView != null) {
        mPeekView.removeView(contentView);
      }
    }
  }
).start();
  mNotificationText.animate().alpha(1f).setInterpolator(new AccelerateInterpolator()).start();
  if (mClockTextView != null) {
    mClockTextView.animate().alpha(1f).setInterpolator(new AccelerateInterpolator()).start();
  }
}
Program: 79781
Project: 79781
Buggy source:
@Override public void onAnimationEnd(Animator animation){
  super.onAnimationEnd(animation);
  mPeekView.removeView(contentView);
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animator animation){
  super.onAnimationEnd(animation);
  if (contentView != null) {
    mPeekView.removeView(contentView);
  }
}
Program: 79782
Project: 79782
Buggy source:
private void showNotificationContent(){
  if (mContentShowing) {
    return;
  }
  mContentShowing=true;
  StatusBarNotification selectedNotification=(StatusBarNotification)mNotificationView.getTag();
  View contentView=PeekLayoutFactory.createPeekLayout(this,PeekLayoutFactory.LAYOUT_TYPE_CONTENT,selectedNotification);
  contentView.setId(R.id.notification_content);
  RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
  params.addRule(RelativeLayout.ABOVE,R.id.notification_layout);
  contentView.setLayoutParams(params);
  TextView contentTextView=(TextView)contentView.findViewById(R.id.content_text);
  contentTextView.setTranslationY(50);
  contentView.setAlpha(0);
  mPeekView.addView(contentView);
  contentView.animate().alpha(1f).setInterpolator(new DecelerateInterpolator()).start();
  contentTextView.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start();
  mNotificationText.animate().alpha(0f).setInterpolator(new DecelerateInterpolator()).start();
  if (mClockTextView != null) {
    mClockTextView.animate().alpha(0f).setInterpolator(new DecelerateInterpolator()).start();
  }
}

Fixed version (ground truth):
private void showNotificationContent(){
  if (mContentShowing) {
    return;
  }
  Log.d(TAG,"String_Node_Str");
  mContentShowing=true;
  StatusBarNotification selectedNotification=(StatusBarNotification)mNotificationView.getTag();
  View contentView=PeekLayoutFactory.createPeekLayout(this,PeekLayoutFactory.LAYOUT_TYPE_CONTENT,selectedNotification);
  contentView.setId(R.id.notification_content);
  RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
  params.addRule(RelativeLayout.ABOVE,R.id.notification_layout);
  contentView.setLayoutParams(params);
  LinearLayout contentTextLayout=(LinearLayout)contentView.findViewById(R.id.content_layout);
  contentTextLayout.setTranslationY(50);
  contentView.setAlpha(0);
  mPeekView.addView(contentView);
  contentView.animate().alpha(1f).setInterpolator(new DecelerateInterpolator()).start();
  contentTextLayout.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start();
  mNotificationText.animate().alpha(0f).setInterpolator(new DecelerateInterpolator()).start();
  if (mClockTextView != null) {
    mClockTextView.animate().alpha(0f).setInterpolator(new DecelerateInterpolator()).start();
  }
}
Program: 79783
Project: 79783
Buggy source:
private static View createContentLayout(Context context,StatusBarNotification n){
  LayoutInflater inflater=LayoutInflater.from(context);
  View rootLayout=inflater.inflate(R.layout.content_layout,null);
  ImageView contactImageView=(ImageView)rootLayout.findViewById(R.id.contact_image);
  contactImageView.setImageDrawable(getNotificationContactImage(context,n));
  TextView contentTextView=(TextView)rootLayout.findViewById(R.id.content_text);
  String content=NotificationHelper.getNotificationContent(n);
  if (!content.startsWith(NotificationHelper.getNotificationTitle(n))) {
    content=NotificationHelper.getNotificationTitle(n) + "String_Node_Str" + content;
  }
  contentTextView.setText(content);
  if (contactImageView.getDrawable() == null) {
    int padding=context.getResources().getDimensionPixelSize(R.dimen.content_text_paddings);
    contentTextView.setPadding(padding,contentTextView.getPaddingTop(),padding,contentTextView.getPaddingBottom());
    contactImageView.setVisibility(View.GONE);
  }
  return rootLayout;
}

Fixed version (ground truth):
private static View createContentLayout(Context context,StatusBarNotification n){
  LayoutInflater inflater=LayoutInflater.from(context);
  View rootLayout=inflater.inflate(R.layout.content_layout,null);
  ImageView contactImageView=(ImageView)rootLayout.findViewById(R.id.contact_image);
  contactImageView.setImageDrawable(getNotificationContactImage(context,n));
  TextView contentTextView=(TextView)rootLayout.findViewById(R.id.content_text);
  TextView contentTitleView=(TextView)rootLayout.findViewById(R.id.title_text);
  String content=NotificationHelper.getNotificationContent(n);
  String title=NotificationHelper.getNotificationTitle(n);
  if (!content.startsWith(NotificationHelper.getNotificationTitle(n))) {
    contentTitleView.setText(title);
  }
  contentTextView.setText(content);
  if (contactImageView.getDrawable() == null) {
    int padding=context.getResources().getDimensionPixelSize(R.dimen.content_text_paddings);
    contentTextView.setPadding(padding,contentTextView.getPaddingTop(),padding,contentTextView.getPaddingBottom());
    contentTitleView.setPadding(padding,contentTextView.getPaddingTop(),padding,contentTextView.getPaddingBottom());
    contactImageView.setVisibility(View.GONE);
  }
  return rootLayout;
}
Program: 79785
Project: 79785
Buggy source:
public static String getNotificationContent(StatusBarNotification n){
  String content=getNotificationText(n,Notification.EXTRA_TEXT);
  if (content == null) {
    return n.getNotification().tickerText == null ? "String_Node_Str" : n.getNotification().tickerText.toString();
  }
  return content;
}

Fixed version (ground truth):
public static String getNotificationContent(StatusBarNotification n){
  String content=getNotificationTextLines(n);
  if (content.length() == 0) {
    content=getNotificationText(n,Notification.EXTRA_TEXT);
  }
  if (content == null) {
    return n.getNotification().tickerText == null ? "String_Node_Str" : n.getNotification().tickerText.toString();
  }
  return content;
}
Program: 79786
Project: 79786
Buggy source:
@Override public void onShowContentActionDetected(){
  Intent intent=new Intent(NotificationPeekActivity.NotificationPeekReceiver.ACTION_SHOW_CONTENT);
  getContext().sendBroadcast(intent);
}

Fixed version (ground truth):
@Override public void onShowContentActionDetected(){
  showNotificationContent();
}
Program: 79787
Project: 79787
Buggy source:
@Override public void onHideContentActionDetected(){
  Intent intent=new Intent(NotificationPeekActivity.NotificationPeekReceiver.ACTION_HIDE_CONTENT);
  getContext().sendBroadcast(intent);
}

Fixed version (ground truth):
@Override public void onHideContentActionDetected(){
  hideNotificationContent();
}
Program: 79789
Project: 79789
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (intent.getAction().equals(ACTION_FINISH_PEEK)) {
    finish();
  }
 else   if (intent.getAction().equals(ACTION_DIMISS_NOTIFICATION)) {
    String description=intent.getStringExtra(EXTRA_NOTIFICATION_DESCRIPTION);
    if (!updateNotification(description)) {
      lockScreen();
    }
  }
 else   if (intent.getAction().equals(Intent.ACTION_TIME_TICK)) {
    mClockTextView.setText(getCurrentTimeText());
  }
 else   if (intent.getAction().equals(ACTION_UPDATE_NOTIFICATION_ICONS)) {
    updateNotificationIcons();
  }
 else   if (intent.getAction().equals(ACTION_SHOW_CONTENT)) {
    showNotificationContent();
  }
 else   if (intent.getAction().equals(ACTION_HIDE_CONTENT)) {
    hideNotificationContent();
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (intent.getAction().equals(ACTION_FINISH_PEEK)) {
    finish();
  }
 else   if (intent.getAction().equals(ACTION_DIMISS_NOTIFICATION)) {
    String description=intent.getStringExtra(EXTRA_NOTIFICATION_DESCRIPTION);
    if (!updateNotification(description)) {
      lockScreen();
    }
  }
 else   if (intent.getAction().equals(Intent.ACTION_TIME_TICK)) {
    mClockTextView.setText(getCurrentTimeText());
  }
 else   if (intent.getAction().equals(ACTION_UPDATE_NOTIFICATION_ICONS)) {
    updateNotificationIcons();
  }
 else   if (intent.getAction().equals(ACTION_SHOW_CONTENT)) {
    hidePeekComponents();
  }
 else   if (intent.getAction().equals(ACTION_HIDE_CONTENT)) {
    showPeekComponents();
  }
}
Program: 79790
Project: 79790
Buggy source:
private static View createContentLayout(Context context,StatusBarNotification n){
  LayoutInflater inflater=LayoutInflater.from(context);
  View rootLayout=inflater.inflate(R.layout.content_layout,null);
  ImageView contactImageView=(ImageView)rootLayout.findViewById(R.id.contact_image);
  contactImageView.setImageDrawable(getNotificationContactImage(context,n));
  TextView contentTextView=(TextView)rootLayout.findViewById(R.id.content_text);
  TextView contentTitleView=(TextView)rootLayout.findViewById(R.id.title_text);
  String content=NotificationHelper.getNotificationContent(n);
  String title=NotificationHelper.getNotificationTitle(n);
  if (!content.startsWith(NotificationHelper.getNotificationTitle(n))) {
    contentTitleView.setText(title);
  }
  contentTextView.setText(content);
  if (contactImageView.getDrawable() == null) {
    int padding=context.getResources().getDimensionPixelSize(R.dimen.content_text_paddings);
    contentTextView.setPadding(padding,contentTextView.getPaddingTop(),padding,contentTextView.getPaddingBottom());
    contentTitleView.setPadding(padding,contentTextView.getPaddingTop(),padding,contentTextView.getPaddingBottom());
    contactImageView.setVisibility(View.GONE);
  }
  return rootLayout;
}

Fixed version (ground truth):
private static View createContentLayout(Context context,StatusBarNotification n){
  LayoutInflater inflater=LayoutInflater.from(context);
  View rootLayout=inflater.inflate(R.layout.content_layout,null);
  ImageView contactImageView=(ImageView)rootLayout.findViewById(R.id.contact_image);
  contactImageView.setImageDrawable(getNotificationContactImage(context,n));
  TextView contentTextView=(TextView)rootLayout.findViewById(R.id.content_text);
  TextView contentTitleView=(TextView)rootLayout.findViewById(R.id.title_text);
  String content=NotificationHelper.getNotificationContent(n);
  String title=NotificationHelper.getNotificationTitle(n);
  if (!content.startsWith(NotificationHelper.getNotificationTitle(n))) {
    contentTitleView.setText(title);
  }
 else {
    contentTextView.setVisibility(View.GONE);
  }
  contentTextView.setText(content);
  if (contactImageView.getDrawable() == null) {
    int padding=context.getResources().getDimensionPixelSize(R.dimen.content_text_paddings);
    contentTextView.setPadding(padding,contentTextView.getPaddingTop(),padding,contentTextView.getPaddingBottom());
    contentTitleView.setPadding(padding,contentTextView.getPaddingTop(),padding,contentTextView.getPaddingBottom());
    contactImageView.setVisibility(View.GONE);
  }
  return rootLayout;
}
Program: 79792
Project: 79792
Buggy source:
public void removeShowContentCallback(){
  if (mShowContentRunnable != null) {
    mHandler.removeCallbacks(mShowContentRunnable);
    mShowContentRunnable=null;
    mCallback.onHideContentActionDetected();
  }
}

Fixed version (ground truth):
public void removeShowContentCallback(){
  if (mShowContentRunnable != null) {
    mHandler.removeCallbacks(mShowContentRunnable);
    mShowContentRunnable=null;
  }
  mCallback.onHideContentActionDetected();
}
Program: 79793
Project: 79793
Buggy source:
public void removeNotification(StatusBarNotification notification){
  mNotifications.remove(notification.getPackageName());
  if (NotificationHelper.getContentDescription(notification).equals(NotificationHelper.getContentDescription(mCurrentNotification))) {
    mCurrentNotification=null;
  }
}

Fixed version (ground truth):
public void removeNotification(StatusBarNotification notification){
  mNotifications.remove(notification.getPackageName());
  if (NotificationHelper.getContentDescription(notification).equals(NotificationHelper.getContentDescription(mCurrentNotification))) {
    if (mNotifications.size() > 0) {
      mCurrentNotification=getNextNotification();
    }
 else {
      mCurrentNotification=null;
    }
  }
}
Program: 79794
Project: 79794
Buggy source:
@Override public void onNotificationPosted(StatusBarNotification sbn){
  Log.i(TAG,sbn.getPackageName() + "String_Node_Str" + sbn.getNotification().tickerText);
  Notification postedNotification=sbn.getNotification();
  if (postedNotification.tickerText == null || sbn.isOngoing() || !sbn.isClearable() || isInBlackList(sbn)) {
    return;
  }
  if (mAppList.isInQuietHour(sbn.getPostTime())) {
    mNotificationPeek.unregisterEventListeners();
    return;
  }
  mNotificationHub.addNotification(sbn);
  if (AccessChecker.isDeviceAdminEnabled(this)) {
    mNotificationPeek.showNotification(sbn,false,mPeekTimeoutMultiplier,mSensorTimeoutMultiplier,mShowContent);
  }
}

Fixed version (ground truth):
@Override public void onNotificationPosted(StatusBarNotification sbn){
  Notification postedNotification=sbn.getNotification();
  if (postedNotification.tickerText == null || sbn.isOngoing() || !sbn.isClearable() || isInBlackList(sbn)) {
    return;
  }
  if (mAppList.isInQuietHour(sbn.getPostTime())) {
    mNotificationPeek.unregisterEventListeners();
    return;
  }
  mNotificationHub.addNotification(sbn);
  if (AccessChecker.isDeviceAdminEnabled(this)) {
    mNotificationPeek.showNotification(sbn,false,mPeekTimeoutMultiplier,mSensorTimeoutMultiplier,mShowContent);
  }
}
Program: 79796
Project: 79796
Buggy source:
/** 
 * Update background ImageView to display proper background according to user preference.
 */
public void updateBackgroundImageView(){
  boolean used=mWallpaperFactory.isWallpaperThemeSelected() && !WallpaperFactory.isLiveWallpaperUsed(mContext);
  if (mPeekBackgroundImageView == null) {
    mPeekBackgroundImageView=new ImageView(mContext);
    ViewGroup.LayoutParams params=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
    mPeekBackgroundImageView.setLayoutParams(params);
    mPeekBackgroundImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
  }
  if (used) {
    mPeekBackgroundImageView.setImageBitmap(mWallpaperFactory.getPrefSystemWallpaper());
    if (!isBackgroundImageViewAdded()) {
      sPeekView.addView(mPeekBackgroundImageView,0);
    }
  }
 else {
    if (isBackgroundImageViewAdded()) {
      sPeekView.removeViewAt(0);
    }
  }
}

Fixed version (ground truth):
/** 
 * Update background ImageView to display proper background according to user preference.
 */
public void updateBackgroundImageView(){
  boolean used=WallpaperFactory.isWallpaperThemeSelected(mContext) && !WallpaperFactory.isLiveWallpaperUsed(mContext);
  if (mPeekBackgroundImageView == null) {
    mPeekBackgroundImageView=new ImageView(mContext);
    ViewGroup.LayoutParams params=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
    mPeekBackgroundImageView.setLayoutParams(params);
    mPeekBackgroundImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
  }
  if (used) {
    mPeekBackgroundImageView.setImageBitmap(mWallpaperFactory.getPrefSystemWallpaper());
    if (!isBackgroundImageViewAdded()) {
      sPeekView.addView(mPeekBackgroundImageView,0);
    }
  }
 else {
    if (isBackgroundImageViewAdded()) {
      sPeekView.removeViewAt(0);
    }
  }
}
Program: 79797
Project: 79797
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
  if (WallpaperFactory.isLiveWallpaperUsed(this)) {
    setTheme(R.style.AppTheme_Peek_Wallpaper);
  }
 else {
    setTheme(R.style.AppTheme_Peek);
  }
  super.onCreate(savedInstanceState);
  mPeekView=NotificationPeek.sPeekView;
  mNotificationsContainer=(GridLayout)mPeekView.findViewById(NotificationPeek.NOTIFICATION_CONTAINER_ID);
  mNotificationView=mPeekView.findViewById(NotificationPeek.NOTIFICATION_VIEW_ID);
  setContentView(mPeekView);
  boolean showClock=PreferenceManager.getDefaultSharedPreferences(this).getBoolean(PreferenceKeys.PREF_CLOCK,true);
  if (showClock) {
    mClockTextView=(TextView)PeekLayoutFactory.createPeekLayout(this,PeekLayoutFactory.LAYOUT_TYPE_CLOCK);
    mPeekView.addView(mClockTextView);
    mClockTextView.setText(getCurrentTimeText());
  }
  mPeekView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
  initReceiver();
  NotificationLayout notificationView=(NotificationLayout)mPeekView.findViewById(NotificationPeek.NOTIFICATION_LAYOUT_ID);
  mPeek=notificationView.getNotificationPeek();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
  if (WallpaperFactory.isLiveWallpaperUsed(this) && WallpaperFactory.isWallpaperThemeSelected(this)) {
    setTheme(R.style.AppTheme_Peek_Wallpaper);
  }
 else {
    setTheme(R.style.AppTheme_Peek);
  }
  super.onCreate(savedInstanceState);
  mPeekView=NotificationPeek.sPeekView;
  mNotificationsContainer=(GridLayout)mPeekView.findViewById(NotificationPeek.NOTIFICATION_CONTAINER_ID);
  mNotificationView=mPeekView.findViewById(NotificationPeek.NOTIFICATION_VIEW_ID);
  setContentView(mPeekView);
  boolean showClock=PreferenceManager.getDefaultSharedPreferences(this).getBoolean(PreferenceKeys.PREF_CLOCK,true);
  if (showClock) {
    mClockTextView=(TextView)PeekLayoutFactory.createPeekLayout(this,PeekLayoutFactory.LAYOUT_TYPE_CLOCK);
    mPeekView.addView(mClockTextView);
    mClockTextView.setText(getCurrentTimeText());
  }
  mPeekView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
  initReceiver();
  NotificationLayout notificationView=(NotificationLayout)mPeekView.findViewById(NotificationPeek.NOTIFICATION_LAYOUT_ID);
  mPeek=notificationView.getNotificationPeek();
}
Program: 79798
Project: 79798
Buggy source:
/** 
 * Create a new   {@link android.graphics.drawable.TransitionDrawable} object with correct orderof Drawables based on user selection.
 * @return TransitionDrawable object created.
 */
private TransitionDrawable initPreviewBackgroundDrawable(){
  boolean isWallpaperSelected=mWallpaperFactory.isWallpaperThemeSelected();
  Drawable black=new ColorDrawable(Color.BLACK);
  Drawable wallpaper=mUseLiveWallpaper ? new ColorDrawable(Color.TRANSPARENT) : new BitmapDrawable(getResources(),mWallpaperFactory.getPrefSystemWallpaper());
  mChangeDrawables=!isWallpaperSelected ? new Drawable[]{black,wallpaper} : new Drawable[]{wallpaper,black};
  mBlackDrawableIndex=!isWallpaperSelected ? 0 : 1;
  return new TransitionDrawable(mChangeDrawables);
}

Fixed version (ground truth):
/** 
 * Create a new   {@link android.graphics.drawable.TransitionDrawable} object with correct orderof Drawables based on user selection.
 * @return TransitionDrawable object created.
 */
private TransitionDrawable initPreviewBackgroundDrawable(){
  boolean isWallpaperSelected=WallpaperFactory.isWallpaperThemeSelected(getActivity());
  Drawable black=new ColorDrawable(Color.BLACK);
  Drawable wallpaper=mUseLiveWallpaper ? new ColorDrawable(Color.TRANSPARENT) : new BitmapDrawable(getResources(),mWallpaperFactory.getPrefSystemWallpaper());
  mChangeDrawables=!isWallpaperSelected ? new Drawable[]{black,wallpaper} : new Drawable[]{wallpaper,black};
  mBlackDrawableIndex=!isWallpaperSelected ? 0 : 1;
  return new TransitionDrawable(mChangeDrawables);
}
Program: 79799
Project: 79799
Buggy source:
/** 
 * Update layout components (SeekBar, TextView, ImageView) according to the new preference.
 * @param manual If the update is from user or from the initialization.
 */
private void updateLayouts(boolean manual){
  if (!mWallpaperFactory.isWallpaperThemeSelected()) {
    if (!manual) {
      mBackgroundSpinner.setSelection(0);
    }
 else {
      mPreviewImageDrawable.reverseTransition(TRANSITION_ANIM_DURATION);
    }
    mRadiusSeek.setEnabled(false);
    mDimSeek.setEnabled(false);
    mRadiusText.setEnabled(false);
    mDimText.setEnabled(false);
  }
 else {
    if (!manual) {
      mBackgroundSpinner.setSelection(1);
    }
 else {
      mPreviewImageDrawable.reverseTransition(TRANSITION_ANIM_DURATION);
    }
    mRadiusSeek.setEnabled(true && !mUseLiveWallpaper);
    mDimSeek.setEnabled(true && !mUseLiveWallpaper);
    mRadiusText.setEnabled(true && !mUseLiveWallpaper);
    mDimText.setEnabled(true && !mUseLiveWallpaper);
  }
}

Fixed version (ground truth):
/** 
 * Update layout components (SeekBar, TextView, ImageView) according to the new preference.
 * @param manual If the update is from user or from the initialization.
 */
private void updateLayouts(boolean manual){
  if (!WallpaperFactory.isWallpaperThemeSelected(getActivity())) {
    if (!manual) {
      mBackgroundSpinner.setSelection(0);
    }
 else {
      mPreviewImageDrawable.reverseTransition(TRANSITION_ANIM_DURATION);
    }
    mRadiusSeek.setEnabled(false);
    mDimSeek.setEnabled(false);
    mRadiusText.setEnabled(false);
    mDimText.setEnabled(false);
  }
 else {
    if (!manual) {
      mBackgroundSpinner.setSelection(1);
    }
 else {
      mPreviewImageDrawable.reverseTransition(TRANSITION_ANIM_DURATION);
    }
    mRadiusSeek.setEnabled(true && !mUseLiveWallpaper);
    mDimSeek.setEnabled(true && !mUseLiveWallpaper);
    mRadiusText.setEnabled(true && !mUseLiveWallpaper);
    mDimText.setEnabled(true && !mUseLiveWallpaper);
  }
}
Program: 79800
Project: 79800
Buggy source:
@Override public void run(){
  if (mAdjusted) {
    mAdjusted=false;
    mChangeDrawables[1]=mChangeDrawables[mBlackDrawableIndex];
    mChangeDrawables[0]=mAdjustDrawables[1];
    mPreviewImageDrawable=new TransitionDrawable(mChangeDrawables);
  }
  mPreviewImageView.setImageDrawable(mPreviewImageDrawable);
  updateLayouts(true);
}

Fixed version (ground truth):
@Override public void run(){
  if (mAdjusted) {
    mAdjusted=false;
    mChangeDrawables[1]=mChangeDrawables[mBlackDrawableIndex];
    mChangeDrawables[0]=mAdjustDrawables[1];
    mPreviewImageDrawable=new TransitionDrawable(mChangeDrawables);
    mPreviewImageView.setImageDrawable(mPreviewImageDrawable);
  }
  updateLayouts(true);
}
Program: 79801
Project: 79801
Buggy source:
/** 
 * Check if user selected system wallpaper as Peek background.
 * @return True if system wallpaper is selected, false otherwise.
 */
public boolean isWallpaperThemeSelected(){
  return PreferenceManager.getDefaultSharedPreferences(mContext).getInt(PreferenceKeys.PREF_BACKGROUND,BACKGROUND_PURE_BLACK) == BACKGROUND_SYSTEM_WALLPAPER;
}

Fixed version (ground truth):
/** 
 * Check if user selected system wallpaper as Peek background.
 * @return True if system wallpaper is selected, false otherwise.
 */
public static boolean isWallpaperThemeSelected(Context context){
  return PreferenceManager.getDefaultSharedPreferences(context).getInt(PreferenceKeys.PREF_BACKGROUND,BACKGROUND_PURE_BLACK) == BACKGROUND_SYSTEM_WALLPAPER;
}
Program: 79802
Project: 79802
Buggy source:
public static boolean isLiveWallpaperUsed(Context context){
  return WallpaperManager.getInstance(context).getWallpaperInfo() != null;
}

Fixed version (ground truth):
/** 
 * Check if live wallpaper is used.
 * @param context   Context object.
 * @return          True if live wallpaper is used, false otherwise.
 */
public static boolean isLiveWallpaperUsed(Context context){
  return WallpaperManager.getInstance(context).getWallpaperInfo() != null;
}
Program: 79803
Project: 79803
Buggy source:
public void snapChild(final View view,float velocity){
  final View animView=mCallback.getChildContentView(view);
  final boolean canAnimViewBeDismissed=mCallback.canChildBeDismissed(animView);
  ObjectAnimator anim=createTranslationAnimation(animView,0);
  int duration=SNAP_ANIM_LEN;
  anim.setDuration(duration);
  anim.addUpdateListener(new AnimatorUpdateListener(){
    public void onAnimationUpdate(    ValueAnimator animation){
      updateAlphaFromOffset(animView,canAnimViewBeDismissed);
    }
  }
);
  anim.addListener(new AnimatorListenerAdapter(){
    public void onAnimationEnd(    Animator animator){
      updateAlphaFromOffset(animView,canAnimViewBeDismissed);
    }
  }
);
  anim.start();
}

Fixed version (ground truth):
public void snapChild(final View view,float velocity){
  final View animView=mCallback.getChildContentView(view);
  final boolean canAnimViewBeDismissed=mCallback.canChildBeDismissed(animView);
  ObjectAnimator anim=createTranslationAnimation(animView,0);
  anim.setInterpolator(new OvershootInterpolator(2.5f));
  int duration=SNAP_ANIM_LEN;
  anim.setDuration(duration);
  anim.addUpdateListener(new AnimatorUpdateListener(){
    public void onAnimationUpdate(    ValueAnimator animation){
      updateAlphaFromOffset(animView,canAnimViewBeDismissed);
    }
  }
);
  anim.addListener(new AnimatorListenerAdapter(){
    public void onAnimationEnd(    Animator animator){
      updateAlphaFromOffset(animView,canAnimViewBeDismissed);
    }
  }
);
  anim.start();
}
Program: 79804
Project: 79804
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  mHandler=new Handler(Looper.getMainLooper());
  mWallpaperFactory=new WallpaperFactory(getActivity());
  mUseLiveWallpaper=WallpaperFactory.isLiveWallpaperUsed(getActivity());
  mPreviewImageDrawable=initPreviewBackgroundDrawable();
  View rootView=inflater.inflate(R.layout.appearance_fragment_layout,container,false);
  mBackgroundSpinner=(Spinner)rootView.findViewById(R.id.spinner);
  ArrayAdapter<String> spinnerAdapter=new ArrayAdapter<String>(getActivity(),R.layout.spinner_item_layout,R.id.text_view,getResources().getStringArray(R.array.background_pref_array));
  mBackgroundSpinner.setAdapter(spinnerAdapter);
  mBackgroundSpinner.setOnItemSelectedListener(this);
  mPreviewImageView=(ImageView)rootView.findViewById(R.id.preview_image_view);
  mPreviewImageView.setImageDrawable(mPreviewImageDrawable);
  mRadiusSeek=(SeekBar)rootView.findViewById(R.id.radius_seek);
  mDimSeek=(SeekBar)rootView.findViewById(R.id.dim_seek);
  mRadiusText=(TextView)rootView.findViewById(R.id.radius_text);
  mDimText=(TextView)rootView.findViewById(R.id.dim_text);
  initSeekBars();
  updateLayouts(false);
  return rootView;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  mHandler=new Handler(Looper.getMainLooper());
  mWallpaperFactory=new WallpaperFactory(getActivity());
  mUseLiveWallpaper=WallpaperFactory.isLiveWallpaperUsed(getActivity());
  mPreviewImageDrawable=initPreviewBackgroundDrawable();
  mPreviewImageDrawable.setCrossFadeEnabled(true);
  View rootView=inflater.inflate(R.layout.appearance_fragment_layout,container,false);
  mBackgroundSpinner=(Spinner)rootView.findViewById(R.id.spinner);
  ArrayAdapter<String> spinnerAdapter=new ArrayAdapter<String>(getActivity(),R.layout.spinner_item_layout,R.id.text_view,getResources().getStringArray(R.array.background_pref_array));
  mBackgroundSpinner.setAdapter(spinnerAdapter);
  mBackgroundSpinner.setOnItemSelectedListener(this);
  mPreviewImageView=(ImageView)rootView.findViewById(R.id.preview_image_view);
  mPreviewImageView.setImageDrawable(mPreviewImageDrawable);
  mRadiusSeek=(SeekBar)rootView.findViewById(R.id.radius_seek);
  mDimSeek=(SeekBar)rootView.findViewById(R.id.dim_seek);
  mRadiusText=(TextView)rootView.findViewById(R.id.radius_text);
  mDimText=(TextView)rootView.findViewById(R.id.dim_text);
  initSeekBars();
  updateLayouts(false);
  return rootView;
}
Program: 79807
Project: 79807
Buggy source:
public static Drawable getRoundedShape(ImageView imageView,Bitmap scaleBitmapImage){
  final int shadowSize=imageView.getContext().getResources().getDimensionPixelSize(R.dimen.shadow_size);
  final int shadowColor=imageView.getContext().getResources().getColor(R.color.background_color);
  Drawable rounded=new RoundedAvatarDrawable(scaleBitmapImage,shadowSize,shadowColor);
  imageView.setLayerType(View.LAYER_TYPE_SOFTWARE,null);
  return rounded;
}

Fixed version (ground truth):
/** 
 * Get rounded icon from the Bitmap object, with shade. The shade will only be drawn if the Bitmap is larger than the ImageView's size.
 * @param resources         Resources object for getting size and color.
 * @param scaleBitmapImage  Source Bitmap.
 * @return                  Rounded BitmapDrawable with shade (if possible).
 */
public static Drawable getRoundedShape(Resources resources,Bitmap scaleBitmapImage){
  final int shadowSize=resources.getDimensionPixelSize(R.dimen.shadow_size);
  final int shadowColor=resources.getColor(R.color.background_color);
  int targetWidth=scaleBitmapImage.getWidth();
  int targetHeight=scaleBitmapImage.getHeight();
  Bitmap targetBitmap=Bitmap.createBitmap(targetWidth,targetHeight,Bitmap.Config.ARGB_8888);
  Paint paint=new Paint();
  paint.setAntiAlias(true);
  paint.setDither(true);
  Paint shadowPaint=new Paint(paint);
  RectF rectF=new RectF(0,0,targetWidth,targetHeight);
  Canvas canvas=new Canvas(targetBitmap);
  final BitmapShader shader=new BitmapShader(scaleBitmapImage,Shader.TileMode.CLAMP,Shader.TileMode.CLAMP);
  paint.setShader(shader);
  if (scaleBitmapImage.getWidth() > resources.getDimensionPixelSize(R.dimen.notification_icon_size)) {
    rectF.inset(shadowSize,shadowSize);
    shadowPaint.setShadowLayer(shadowSize,0f,0f,shadowColor);
    shadowPaint.setColor(Color.BLACK);
    canvas.drawOval(rectF,shadowPaint);
  }
  canvas.drawOval(rectF,paint);
  return new BitmapDrawable(resources,targetBitmap);
}
Program: 79808
Project: 79808
Buggy source:
/** 
 * Crop wallpaper to fit the Peek view.
 * @param original  Original Wallpaper bitmap.
 * @param width     Desired width.
 * @return          Cropped bitmap.
 */
private Bitmap cropBitmap(Bitmap original,int width){
  Bitmap cropped=Bitmap.createBitmap(original,0,0,width,original.getHeight());
  return cropped;
}

Fixed version (ground truth):
/** 
 * Crop wallpaper to fit the Peek view.
 * @param original  Original Wallpaper bitmap.
 * @param width     Desired width.
 * @return          Cropped bitmap.
 */
private Bitmap cropBitmap(Bitmap original,int width){
  if (width > original.getWidth()) {
    return original;
  }
  Bitmap cropped=Bitmap.createBitmap(original,0,0,width,original.getHeight());
  return cropped;
}
Program: 79810
Project: 79810
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  getWindow().setBackgroundDrawable(new ColorDrawable(Color.BLACK));
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
  super.onCreate(savedInstanceState);
  mPeekView=NotificationPeek.sPeekView;
  setContentView(mPeekView);
  boolean showClock=PreferenceManager.getDefaultSharedPreferences(this).getBoolean(PreferenceKeys.PREF_CLOCK,true);
  if (showClock) {
    mClockTextView=(TextView)PeekLayoutFactory.createPeekLayout(this,PeekLayoutFactory.LAYOUT_TYPE_CLOCK);
    mPeekView.addView(mClockTextView);
    mClockTextView.setText(getCurrentTimeText());
  }
  mPeekView.setAlpha(1f);
  mPeekView.setVisibility(View.VISIBLE);
  mPeekView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
  initReceiver();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  getWindow().setBackgroundDrawable(new ColorDrawable(Color.BLACK));
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
  super.onCreate(savedInstanceState);
  mPeekView=NotificationPeek.sPeekView;
  setContentView(mPeekView);
  boolean showClock=PreferenceManager.getDefaultSharedPreferences(this).getBoolean(PreferenceKeys.PREF_CLOCK,true);
  if (showClock) {
    mClockTextView=(TextView)PeekLayoutFactory.createPeekLayout(this,PeekLayoutFactory.LAYOUT_TYPE_CLOCK);
    mPeekView.addView(mClockTextView);
    mClockTextView.setText(getCurrentTimeText());
  }
  mPeekView.setAlpha(1f);
  mPeekView.setVisibility(View.VISIBLE);
  mPeekView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
  initReceiver();
  NotificationLayout notificationView=(NotificationLayout)mPeekView.findViewById(NotificationPeek.NOTIFICATION_LAYOUT_ID);
  mPeek=notificationView.getNotificationPeek();
}
Program: 79812
Project: 79812
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (intent.getAction().equals(ACTION_DISMISS)) {
    finish();
  }
 else   if (intent.getAction().equals(ACTION_UPDATE_NOTIFICATION)) {
    String description=intent.getStringExtra(EXTRA_NOTIFICATION_DESCRIPTION);
    if (!updateNotification(description)) {
      DevicePolicyManager devicePolicyManager=(DevicePolicyManager)getSystemService(DEVICE_POLICY_SERVICE);
      devicePolicyManager.lockNow();
      finish();
    }
  }
 else   if (intent.getAction().equals(Intent.ACTION_TIME_TICK)) {
    mClockTextView.setText(getCurrentTimeText());
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (intent.getAction().equals(ACTION_DISMISS)) {
    finish();
  }
 else   if (intent.getAction().equals(ACTION_UPDATE_NOTIFICATION)) {
    String description=intent.getStringExtra(EXTRA_NOTIFICATION_DESCRIPTION);
    if (!updateNotification(description)) {
      lockScreen();
    }
  }
 else   if (intent.getAction().equals(Intent.ACTION_TIME_TICK)) {
    mClockTextView.setText(getCurrentTimeText());
  }
}
Program: 79813
Project: 79813
Buggy source:
private void registerNotificationActionReceiver(){
  mReceiver=new NotificationActionReceiver();
  IntentFilter intentFilter=new IntentFilter();
  intentFilter.addAction(ACTION_DISMISS_NOTIFICATION);
  intentFilter.addAction(ACTION_PREFERENCE_CHANGED);
  registerReceiver(mReceiver,intentFilter);
}

Fixed version (ground truth):
private void registerNotificationActionReceiver(){
  mReceiver=new NotificationActionReceiver();
  IntentFilter intentFilter=new IntentFilter();
  intentFilter.addAction(ACTION_DISMISS_NOTIFICATION);
  intentFilter.addAction(ACTION_PREFERENCE_CHANGED);
  intentFilter.addAction(Intent.ACTION_WALLPAPER_CHANGED);
  registerReceiver(mReceiver,intentFilter);
}