nus-yam/ex-repair huggingface dataset:
Program: 191398
Project: 191398
Buggy source:
void connect(Context context){
  disconnect(context);
  Intent service=new Intent();
  service.setComponent(mComponentName);
  mBound=context.bindServiceAsUser(service,this,Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE,UserHandle.SYSTEM);
  if (!mBound) {
    Log.w(TAG,"String_Node_Str" + service);
  }
}

Fixed version (ground truth):
void connect(Context context){
  if (!mBound) {
    Intent service=new Intent();
    service.setComponent(mComponentName);
    mBound=context.bindServiceAsUser(service,this,Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE,UserHandle.SYSTEM);
    if (!mBound) {
      Log.w(TAG,"String_Node_Str" + service);
    }
 else {
      if (DBG)       Log.d(TAG,"String_Node_Str");
    }
  }
}
Program: 191399
Project: 191399
Buggy source:
/** 
 * @return the minimum apparent height that the wrapper should allow for the purposeof aligning elements at the bottom edge. If this is larger than the content height, the notification is clipped instead of being further shrunk.
 */
private int getMinContentHeightHint(){
  if (mIsChildInGroup && (mVisibleType == VISIBLE_TYPE_SINGLELINE || mTransformationStartVisibleType == VISIBLE_TYPE_SINGLELINE)) {
    return mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_action_list_height);
  }
  if (mHeadsUpChild != null) {
    return mHeadsUpChild.getHeight();
  }
 else {
    return mContractedChild.getHeight() + mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_action_list_height);
  }
}

Fixed version (ground truth):
/** 
 * @return the minimum apparent height that the wrapper should allow for the purposeof aligning elements at the bottom edge. If this is larger than the content height, the notification is clipped instead of being further shrunk.
 */
private int getMinContentHeightHint(){
  if (mIsChildInGroup && (mVisibleType == VISIBLE_TYPE_SINGLELINE || mTransformationStartVisibleType == VISIBLE_TYPE_SINGLELINE)) {
    return mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_action_list_height);
  }
  int hint;
  if (mHeadsUpChild != null) {
    hint=mHeadsUpChild.getHeight();
  }
 else {
    hint=mContractedChild.getHeight() + mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_action_list_height);
  }
  if (mExpandedChild != null) {
    hint=Math.min(hint,mExpandedChild.getHeight());
  }
  return hint;
}
Program: 191400
Project: 191400
Buggy source:
/** 
 * @return the minimum apparent height that the wrapper should allow for the purposeof aligning elements at the bottom edge. If this is larger than the content height, the notification is clipped instead of being further shrunk.
 */
private int getMinContentHeightHint(){
  if (mIsChildInGroup && (mVisibleType == VISIBLE_TYPE_SINGLELINE || mTransformationStartVisibleType == VISIBLE_TYPE_SINGLELINE)) {
    return mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_action_list_height);
  }
  if (mHeadsUpChild != null) {
    return mHeadsUpChild.getHeight();
  }
 else {
    return mContractedChild.getHeight() + mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_action_list_height);
  }
}

Fixed version (ground truth):
/** 
 * @return the minimum apparent height that the wrapper should allow for the purposeof aligning elements at the bottom edge. If this is larger than the content height, the notification is clipped instead of being further shrunk.
 */
private int getMinContentHeightHint(){
  if (mIsChildInGroup && (mVisibleType == VISIBLE_TYPE_SINGLELINE || mTransformationStartVisibleType == VISIBLE_TYPE_SINGLELINE)) {
    return mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_action_list_height);
  }
  int hint;
  if (mHeadsUpChild != null) {
    hint=mHeadsUpChild.getHeight();
  }
 else {
    hint=mContractedChild.getHeight() + mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_action_list_height);
  }
  if (mExpandedChild != null) {
    hint=Math.min(hint,mExpandedChild.getHeight());
  }
  return hint;
}
Program: 191405
Project: 191405
Buggy source:
void disconnect(Context context){
  try {
    if (mBound) {
      mBound=false;
      context.unbindService(this);
    }
  }
 catch (  RuntimeException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
void disconnect(Context context){
  try {
    if (mBound) {
      mBound=false;
      context.unbindService(this);
      if (DBG)       Log.d(TAG,"String_Node_Str");
    }
  }
 catch (  RuntimeException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 191406
Project: 191406
Buggy source:
@Override public void onServiceDisconnected(ComponentName name){
  if (DBG)   Log.d(TAG,"String_Node_Str" + name.flattenToString());
}

Fixed version (ground truth):
@Override public void onServiceDisconnected(ComponentName name){
  if (DBG) {
    Log.d(TAG,"String_Node_Str" + name.flattenToString());
  }
  mConnected=false;
}
Program: 191407
Project: 191407
Buggy source:
@Override public void onServiceConnected(ComponentName name,IBinder service){
  if (DBG)   Log.d(TAG,"String_Node_Str" + name.flattenToString());
}

Fixed version (ground truth):
@Override public void onServiceConnected(ComponentName name,IBinder service){
  if (DBG)   Log.d(TAG,"String_Node_Str" + name.flattenToString());
  mConnected=true;
}
Program: 191408
Project: 191408
Buggy source:
/** 
 * Called when the system is ready to run third-party code but before it actually does so. 
 */
void systemReady(){
  if (DBG)   Log.d(TAG,"String_Node_Str");
  ContentResolver cr=mContext.getContentResolver();
  if (Settings.Global.getInt(cr,Settings.Global.NETWORK_SCORING_PROVISIONED,0) == 0) {
    String defaultPackage=mContext.getResources().getString(R.string.config_defaultNetworkScorerPackageName);
    if (!TextUtils.isEmpty(defaultPackage)) {
      NetworkScorerAppManager.setActiveScorer(mContext,defaultPackage);
    }
    Settings.Global.putInt(cr,Settings.Global.NETWORK_SCORING_PROVISIONED,1);
  }
  registerPackageReceiverIfNeeded();
}

Fixed version (ground truth):
/** 
 * Called when the system is ready to run third-party code but before it actually does so. 
 */
void systemReady(){
  if (DBG)   Log.d(TAG,"String_Node_Str");
  ContentResolver cr=mContext.getContentResolver();
  if (Settings.Global.getInt(cr,Settings.Global.NETWORK_SCORING_PROVISIONED,0) == 0) {
    String defaultPackage=mContext.getResources().getString(R.string.config_defaultNetworkScorerPackageName);
    if (!TextUtils.isEmpty(defaultPackage)) {
      NetworkScorerAppManager.setActiveScorer(mContext,defaultPackage);
    }
    Settings.Global.putInt(cr,Settings.Global.NETWORK_SCORING_PROVISIONED,1);
  }
  registerPackageMonitorIfNeeded();
}
Program: 191409
Project: 191409
Buggy source:
/** 
 * Set the active scorer. Callers are responsible for checking permissions as appropriate. 
 */
private boolean setScorerInternal(String packageName){
  if (DBG)   Log.d(TAG,"String_Node_Str" + packageName + "String_Node_Str");
  long token=Binder.clearCallingIdentity();
  try {
    unbindFromScoringServiceIfNeeded();
    clearInternal();
    NetworkScorerAppData prevScorer=NetworkScorerAppManager.getActiveScorer(mContext);
    boolean result=NetworkScorerAppManager.setActiveScorer(mContext,packageName);
    bindToScoringServiceIfNeeded();
    if (result) {
      registerPackageReceiverIfNeeded();
      Intent intent=new Intent(NetworkScoreManager.ACTION_SCORER_CHANGED);
      if (prevScorer != null) {
        intent.setPackage(prevScorer.mPackageName);
        mContext.sendBroadcastAsUser(intent,UserHandle.SYSTEM);
      }
      if (packageName != null) {
        intent.putExtra(NetworkScoreManager.EXTRA_NEW_SCORER,packageName);
        intent.setPackage(packageName);
        mContext.sendBroadcastAsUser(intent,UserHandle.SYSTEM);
      }
    }
    return result;
  }
  finally {
    Binder.restoreCallingIdentity(token);
  }
}

Fixed version (ground truth):
/** 
 * Set the active scorer. Callers are responsible for checking permissions as appropriate. 
 */
private boolean setScorerInternal(String packageName){
  if (DBG)   Log.d(TAG,"String_Node_Str" + packageName + "String_Node_Str");
  long token=Binder.clearCallingIdentity();
  try {
    unbindFromScoringServiceIfNeeded();
    clearInternal();
    NetworkScorerAppData prevScorer=NetworkScorerAppManager.getActiveScorer(mContext);
    boolean result=NetworkScorerAppManager.setActiveScorer(mContext,packageName);
    bindToScoringServiceIfNeeded();
    if (result) {
      registerPackageMonitorIfNeeded();
      Intent intent=new Intent(NetworkScoreManager.ACTION_SCORER_CHANGED);
      if (prevScorer != null) {
        intent.setPackage(prevScorer.mPackageName);
        mContext.sendBroadcastAsUser(intent,UserHandle.SYSTEM);
      }
      if (packageName != null) {
        intent.putExtra(NetworkScoreManager.EXTRA_NEW_SCORER,packageName);
        intent.setPackage(packageName);
        mContext.sendBroadcastAsUser(intent,UserHandle.SYSTEM);
      }
    }
    return result;
  }
  finally {
    Binder.restoreCallingIdentity(token);
  }
}
Program: 191410
Project: 191410
Buggy source:
public void dump(FileDescriptor fd,PrintWriter writer,String[] args){
  writer.println("String_Node_Str" + mComponentName + "String_Node_Str"+ mBound);
}

Fixed version (ground truth):
public void dump(FileDescriptor fd,PrintWriter writer,String[] args){
  writer.println("String_Node_Str" + mComponentName + "String_Node_Str"+ mBound+ "String_Node_Str"+ mConnected);
}
Program: 191411
Project: 191411
Buggy source:
void connect(Context context){
  disconnect(context);
  Intent service=new Intent();
  service.setComponent(mComponentName);
  mBound=context.bindServiceAsUser(service,this,Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE,UserHandle.SYSTEM);
  if (!mBound) {
    Log.w(TAG,"String_Node_Str" + service);
  }
}

Fixed version (ground truth):
void connect(Context context){
  if (!mBound) {
    Intent service=new Intent();
    service.setComponent(mComponentName);
    mBound=context.bindServiceAsUser(service,this,Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE,UserHandle.SYSTEM);
    if (!mBound) {
      Log.w(TAG,"String_Node_Str" + service);
    }
 else {
      if (DBG)       Log.d(TAG,"String_Node_Str");
    }
  }
}
Program: 191418
Project: 191418
Buggy source:
/** 
 * @return the minimum apparent height that the wrapper should allow for the purposeof aligning elements at the bottom edge. If this is larger than the content height, the notification is clipped instead of being further shrunk.
 */
private int getMinContentHeightHint(){
  if (mIsChildInGroup && (mVisibleType == VISIBLE_TYPE_SINGLELINE || mTransformationStartVisibleType == VISIBLE_TYPE_SINGLELINE)) {
    return mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_action_list_height);
  }
  if (mHeadsUpChild != null) {
    return mHeadsUpChild.getHeight();
  }
 else {
    return mContractedChild.getHeight() + mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_action_list_height);
  }
}

Fixed version (ground truth):
/** 
 * @return the minimum apparent height that the wrapper should allow for the purposeof aligning elements at the bottom edge. If this is larger than the content height, the notification is clipped instead of being further shrunk.
 */
private int getMinContentHeightHint(){
  if (mIsChildInGroup && (mVisibleType == VISIBLE_TYPE_SINGLELINE || mTransformationStartVisibleType == VISIBLE_TYPE_SINGLELINE)) {
    return mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_action_list_height);
  }
  int hint;
  if (mHeadsUpChild != null) {
    hint=mHeadsUpChild.getHeight();
  }
 else {
    hint=mContractedChild.getHeight() + mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.notification_action_list_height);
  }
  if (mExpandedChild != null) {
    hint=Math.min(hint,mExpandedChild.getHeight());
  }
  return hint;
}
Program: 191422
Project: 191422
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  updateClipping();
  invalidateOutline();
  selectLayout(false,mForceSelectNextLayout);
  mForceSelectNextLayout=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);
  updateClipping();
  invalidateOutline();
  selectLayout(false,mForceSelectNextLayout);
  mForceSelectNextLayout=false;
  updateExpandButtons(mExpandable);
}
Program: 191423
Project: 191423
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  updateClipping();
  invalidateOutline();
  selectLayout(false,mForceSelectNextLayout);
  mForceSelectNextLayout=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);
  updateClipping();
  invalidateOutline();
  selectLayout(false,mForceSelectNextLayout);
  mForceSelectNextLayout=false;
  updateExpandButtons(mExpandable);
}
Program: 191424
Project: 191424
Buggy source:
private void startAnimationToState(){
  if (mNeedsAnimation) {
    generateChildHierarchyEvents();
    mNeedsAnimation=false;
  }
  if (!mAnimationEvents.isEmpty() || isCurrentlyAnimating()) {
    mStateAnimator.startAnimationForEvents(mAnimationEvents,mCurrentStackScrollState,mGoToFullShadeDelay);
    setAnimationRunning(true);
    mAnimationEvents.clear();
    updateBackground();
    updateViewShadows();
  }
 else {
    applyCurrentState();
  }
  mGoToFullShadeDelay=0;
}

Fixed version (ground truth):
private void startAnimationToState(){
  if (mNeedsAnimation) {
    generateChildHierarchyEvents();
    mNeedsAnimation=false;
  }
  if (!mAnimationEvents.isEmpty() || isCurrentlyAnimating()) {
    setAnimationRunning(true);
    mStateAnimator.startAnimationForEvents(mAnimationEvents,mCurrentStackScrollState,mGoToFullShadeDelay);
    mAnimationEvents.clear();
    updateBackground();
    updateViewShadows();
  }
 else {
    applyCurrentState();
  }
  mGoToFullShadeDelay=0;
}
Program: 191425
Project: 191425
Buggy source:
private void applyCurrentState(){
  mCurrentStackScrollState.apply();
  if (mListener != null) {
    mListener.onChildLocationsChanged(this);
  }
  runAnimationFinishedRunnables();
  updateBackground();
  updateViewShadows();
}

Fixed version (ground truth):
private void applyCurrentState(){
  mCurrentStackScrollState.apply();
  if (mListener != null) {
    mListener.onChildLocationsChanged(this);
  }
  runAnimationFinishedRunnables();
  setAnimationRunning(false);
  updateBackground();
  updateViewShadows();
}
Program: 191426
Project: 191426
Buggy source:
private void startBackgroundFadeIn(){
  ObjectAnimator fadeAnimator=ObjectAnimator.ofFloat(this,BACKGROUND_FADE,0f,1f);
  int maxLength;
  if (mDarkAnimationOriginIndex == AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE || mDarkAnimationOriginIndex == AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_BELOW) {
    maxLength=getNotGoneChildCount() - 1;
  }
 else {
    maxLength=Math.max(mDarkAnimationOriginIndex,getNotGoneChildCount() - mDarkAnimationOriginIndex - 1);
  }
  long delay=maxLength * StackStateAnimator.ANIMATION_DELAY_PER_ELEMENT_DARK;
  fadeAnimator.setStartDelay(delay);
  fadeAnimator.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
  fadeAnimator.setInterpolator(Interpolators.ALPHA_IN);
  fadeAnimator.start();
}

Fixed version (ground truth):
private void startBackgroundFadeIn(){
  ObjectAnimator fadeAnimator=ObjectAnimator.ofFloat(this,BACKGROUND_FADE,0f,1f);
  int maxLength;
  if (mDarkAnimationOriginIndex == AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE || mDarkAnimationOriginIndex == AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_BELOW) {
    maxLength=getNotGoneChildCount() - 1;
  }
 else {
    maxLength=Math.max(mDarkAnimationOriginIndex,getNotGoneChildCount() - mDarkAnimationOriginIndex - 1);
  }
  maxLength=Math.max(0,maxLength);
  long delay=maxLength * StackStateAnimator.ANIMATION_DELAY_PER_ELEMENT_DARK;
  fadeAnimator.setStartDelay(delay);
  fadeAnimator.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
  fadeAnimator.setInterpolator(Interpolators.ALPHA_IN);
  fadeAnimator.start();
}
Program: 191427
Project: 191427
Buggy source:
/** 
 * Notifies the screenshot service to show an error.
 */
private void notifyScreenshotError(){
  final ComponentName errorComponent=new ComponentName(SYSUI_PACKAGE,SYSUI_SCREENSHOT_ERROR_RECEIVER);
  Intent errorIntent=new Intent();
  errorIntent.setComponent(errorComponent);
  errorIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT | Intent.FLAG_RECEIVER_FOREGROUND);
  mContext.sendBroadcastAsUser(errorIntent,UserHandle.CURRENT);
}

Fixed version (ground truth):
/** 
 * Notifies the screenshot service to show an error.
 */
private void notifyScreenshotError(){
  final ComponentName errorComponent=new ComponentName(SYSUI_PACKAGE,SYSUI_SCREENSHOT_ERROR_RECEIVER);
  Intent errorIntent=new Intent(Intent.ACTION_USER_PRESENT);
  errorIntent.setComponent(errorComponent);
  errorIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT | Intent.FLAG_RECEIVER_FOREGROUND);
  mContext.sendBroadcastAsUser(errorIntent,UserHandle.CURRENT);
}
Program: 191428
Project: 191428
Buggy source:
private void startAnimationToState(){
  if (mNeedsAnimation) {
    generateChildHierarchyEvents();
    mNeedsAnimation=false;
  }
  if (!mAnimationEvents.isEmpty() || isCurrentlyAnimating()) {
    mStateAnimator.startAnimationForEvents(mAnimationEvents,mCurrentStackScrollState,mGoToFullShadeDelay);
    setAnimationRunning(true);
    mAnimationEvents.clear();
    updateBackground();
    updateViewShadows();
  }
 else {
    applyCurrentState();
  }
  mGoToFullShadeDelay=0;
}

Fixed version (ground truth):
private void startAnimationToState(){
  if (mNeedsAnimation) {
    generateChildHierarchyEvents();
    mNeedsAnimation=false;
  }
  if (!mAnimationEvents.isEmpty() || isCurrentlyAnimating()) {
    setAnimationRunning(true);
    mStateAnimator.startAnimationForEvents(mAnimationEvents,mCurrentStackScrollState,mGoToFullShadeDelay);
    mAnimationEvents.clear();
    updateBackground();
    updateViewShadows();
  }
 else {
    applyCurrentState();
  }
  mGoToFullShadeDelay=0;
}
Program: 191429
Project: 191429
Buggy source:
private void applyCurrentState(){
  mCurrentStackScrollState.apply();
  if (mListener != null) {
    mListener.onChildLocationsChanged(this);
  }
  runAnimationFinishedRunnables();
  updateBackground();
  updateViewShadows();
}

Fixed version (ground truth):
private void applyCurrentState(){
  mCurrentStackScrollState.apply();
  if (mListener != null) {
    mListener.onChildLocationsChanged(this);
  }
  runAnimationFinishedRunnables();
  setAnimationRunning(false);
  updateBackground();
  updateViewShadows();
}
Program: 191430
Project: 191430
Buggy source:
private void startBackgroundFadeIn(){
  ObjectAnimator fadeAnimator=ObjectAnimator.ofFloat(this,BACKGROUND_FADE,0f,1f);
  int maxLength;
  if (mDarkAnimationOriginIndex == AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE || mDarkAnimationOriginIndex == AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_BELOW) {
    maxLength=getNotGoneChildCount() - 1;
  }
 else {
    maxLength=Math.max(mDarkAnimationOriginIndex,getNotGoneChildCount() - mDarkAnimationOriginIndex - 1);
  }
  long delay=maxLength * StackStateAnimator.ANIMATION_DELAY_PER_ELEMENT_DARK;
  fadeAnimator.setStartDelay(delay);
  fadeAnimator.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
  fadeAnimator.setInterpolator(Interpolators.ALPHA_IN);
  fadeAnimator.start();
}

Fixed version (ground truth):
private void startBackgroundFadeIn(){
  ObjectAnimator fadeAnimator=ObjectAnimator.ofFloat(this,BACKGROUND_FADE,0f,1f);
  int maxLength;
  if (mDarkAnimationOriginIndex == AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE || mDarkAnimationOriginIndex == AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_BELOW) {
    maxLength=getNotGoneChildCount() - 1;
  }
 else {
    maxLength=Math.max(mDarkAnimationOriginIndex,getNotGoneChildCount() - mDarkAnimationOriginIndex - 1);
  }
  maxLength=Math.max(0,maxLength);
  long delay=maxLength * StackStateAnimator.ANIMATION_DELAY_PER_ELEMENT_DARK;
  fadeAnimator.setStartDelay(delay);
  fadeAnimator.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
  fadeAnimator.setInterpolator(Interpolators.ALPHA_IN);
  fadeAnimator.start();
}
Program: 191431
Project: 191431
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  updateClipping();
  invalidateOutline();
  selectLayout(false,mForceSelectNextLayout);
  mForceSelectNextLayout=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);
  updateClipping();
  invalidateOutline();
  selectLayout(false,mForceSelectNextLayout);
  mForceSelectNextLayout=false;
  updateExpandButtons(mExpandable);
}
Program: 191432
Project: 191432
Buggy source:
/** 
 * Notifies the screenshot service to show an error.
 */
private void notifyScreenshotError(){
  final ComponentName errorComponent=new ComponentName(SYSUI_PACKAGE,SYSUI_SCREENSHOT_ERROR_RECEIVER);
  Intent errorIntent=new Intent();
  errorIntent.setComponent(errorComponent);
  errorIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT | Intent.FLAG_RECEIVER_FOREGROUND);
  mContext.sendBroadcastAsUser(errorIntent,UserHandle.CURRENT);
}

Fixed version (ground truth):
/** 
 * Notifies the screenshot service to show an error.
 */
private void notifyScreenshotError(){
  final ComponentName errorComponent=new ComponentName(SYSUI_PACKAGE,SYSUI_SCREENSHOT_ERROR_RECEIVER);
  Intent errorIntent=new Intent(Intent.ACTION_USER_PRESENT);
  errorIntent.setComponent(errorComponent);
  errorIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT | Intent.FLAG_RECEIVER_FOREGROUND);
  mContext.sendBroadcastAsUser(errorIntent,UserHandle.CURRENT);
}
Program: 191433
Project: 191433
Buggy source:
@Override public void bindView(View view,Context context,Cursor cursor){
  CheckedTextView text=(CheckedTextView)view.findViewById(R.id.text1);
  text.setText(cursor.getString(mLabelIndex));
  listView.setItemChecked(cursor.getPosition(),cursor.getInt(mIsCheckedIndex) == 1);
}

Fixed version (ground truth):
@Override public void bindView(View view,Context context,Cursor cursor){
  CheckedTextView text=(CheckedTextView)view.findViewById(R.id.text1);
  text.setText(cursor.getString(mLabelIndex));
  listView.setItemChecked(cursor.getPosition() + listView.getHeaderViewsCount(),cursor.getInt(mIsCheckedIndex) == 1);
}
Program: 191436
Project: 191436
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  View view=super.getView(position,convertView,parent);
  if (mCheckedItems != null) {
    boolean isItemChecked=mCheckedItems[position];
    if (isItemChecked) {
      listView.setItemChecked(position,true);
    }
  }
  return view;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  View view=super.getView(position,convertView,parent);
  if (mCheckedItems != null) {
    boolean isItemChecked=mCheckedItems[position];
    if (isItemChecked) {
      listView.setItemChecked(position + listView.getHeaderViewsCount(),true);
    }
  }
  return view;
}
Program: 191437
Project: 191437
Buggy source:
/** 
 * Notifies the screenshot service to show an error.
 */
private void notifyScreenshotError(){
  final ComponentName errorComponent=new ComponentName(SYSUI_PACKAGE,SYSUI_SCREENSHOT_ERROR_RECEIVER);
  Intent errorIntent=new Intent();
  errorIntent.setComponent(errorComponent);
  errorIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT | Intent.FLAG_RECEIVER_FOREGROUND);
  mContext.sendBroadcastAsUser(errorIntent,UserHandle.CURRENT);
}

Fixed version (ground truth):
/** 
 * Notifies the screenshot service to show an error.
 */
private void notifyScreenshotError(){
  final ComponentName errorComponent=new ComponentName(SYSUI_PACKAGE,SYSUI_SCREENSHOT_ERROR_RECEIVER);
  Intent errorIntent=new Intent(Intent.ACTION_USER_PRESENT);
  errorIntent.setComponent(errorComponent);
  errorIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT | Intent.FLAG_RECEIVER_FOREGROUND);
  mContext.sendBroadcastAsUser(errorIntent,UserHandle.CURRENT);
}
Program: 191438
Project: 191438
Buggy source:
private void startAnimationToState(){
  if (mNeedsAnimation) {
    generateChildHierarchyEvents();
    mNeedsAnimation=false;
  }
  if (!mAnimationEvents.isEmpty() || isCurrentlyAnimating()) {
    mStateAnimator.startAnimationForEvents(mAnimationEvents,mCurrentStackScrollState,mGoToFullShadeDelay);
    setAnimationRunning(true);
    mAnimationEvents.clear();
    updateBackground();
    updateViewShadows();
  }
 else {
    applyCurrentState();
  }
  mGoToFullShadeDelay=0;
}

Fixed version (ground truth):
private void startAnimationToState(){
  if (mNeedsAnimation) {
    generateChildHierarchyEvents();
    mNeedsAnimation=false;
  }
  if (!mAnimationEvents.isEmpty() || isCurrentlyAnimating()) {
    setAnimationRunning(true);
    mStateAnimator.startAnimationForEvents(mAnimationEvents,mCurrentStackScrollState,mGoToFullShadeDelay);
    mAnimationEvents.clear();
    updateBackground();
    updateViewShadows();
  }
 else {
    applyCurrentState();
  }
  mGoToFullShadeDelay=0;
}
Program: 191439
Project: 191439
Buggy source:
private void applyCurrentState(){
  mCurrentStackScrollState.apply();
  if (mListener != null) {
    mListener.onChildLocationsChanged(this);
  }
  runAnimationFinishedRunnables();
  updateBackground();
  updateViewShadows();
}

Fixed version (ground truth):
private void applyCurrentState(){
  mCurrentStackScrollState.apply();
  if (mListener != null) {
    mListener.onChildLocationsChanged(this);
  }
  runAnimationFinishedRunnables();
  setAnimationRunning(false);
  updateBackground();
  updateViewShadows();
}
Program: 191440
Project: 191440
Buggy source:
private void startBackgroundFadeIn(){
  ObjectAnimator fadeAnimator=ObjectAnimator.ofFloat(this,BACKGROUND_FADE,0f,1f);
  int maxLength;
  if (mDarkAnimationOriginIndex == AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE || mDarkAnimationOriginIndex == AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_BELOW) {
    maxLength=getNotGoneChildCount() - 1;
  }
 else {
    maxLength=Math.max(mDarkAnimationOriginIndex,getNotGoneChildCount() - mDarkAnimationOriginIndex - 1);
  }
  long delay=maxLength * StackStateAnimator.ANIMATION_DELAY_PER_ELEMENT_DARK;
  fadeAnimator.setStartDelay(delay);
  fadeAnimator.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
  fadeAnimator.setInterpolator(Interpolators.ALPHA_IN);
  fadeAnimator.start();
}

Fixed version (ground truth):
private void startBackgroundFadeIn(){
  ObjectAnimator fadeAnimator=ObjectAnimator.ofFloat(this,BACKGROUND_FADE,0f,1f);
  int maxLength;
  if (mDarkAnimationOriginIndex == AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE || mDarkAnimationOriginIndex == AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_BELOW) {
    maxLength=getNotGoneChildCount() - 1;
  }
 else {
    maxLength=Math.max(mDarkAnimationOriginIndex,getNotGoneChildCount() - mDarkAnimationOriginIndex - 1);
  }
  maxLength=Math.max(0,maxLength);
  long delay=maxLength * StackStateAnimator.ANIMATION_DELAY_PER_ELEMENT_DARK;
  fadeAnimator.setStartDelay(delay);
  fadeAnimator.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
  fadeAnimator.setInterpolator(Interpolators.ALPHA_IN);
  fadeAnimator.start();
}
Program: 191441
Project: 191441
Buggy source:
@Override public void bindView(View view,Context context,Cursor cursor){
  CheckedTextView text=(CheckedTextView)view.findViewById(R.id.text1);
  text.setText(cursor.getString(mLabelIndex));
  listView.setItemChecked(cursor.getPosition(),cursor.getInt(mIsCheckedIndex) == 1);
}

Fixed version (ground truth):
@Override public void bindView(View view,Context context,Cursor cursor){
  CheckedTextView text=(CheckedTextView)view.findViewById(R.id.text1);
  text.setText(cursor.getString(mLabelIndex));
  listView.setItemChecked(cursor.getPosition() + listView.getHeaderViewsCount(),cursor.getInt(mIsCheckedIndex) == 1);
}
Program: 191444
Project: 191444
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  View view=super.getView(position,convertView,parent);
  if (mCheckedItems != null) {
    boolean isItemChecked=mCheckedItems[position];
    if (isItemChecked) {
      listView.setItemChecked(position,true);
    }
  }
  return view;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  View view=super.getView(position,convertView,parent);
  if (mCheckedItems != null) {
    boolean isItemChecked=mCheckedItems[position];
    if (isItemChecked) {
      listView.setItemChecked(position + listView.getHeaderViewsCount(),true);
    }
  }
  return view;
}
Program: 191445
Project: 191445
Buggy source:
public int sendIntentSender(IIntentSender target,int code,Intent intent,String resolvedType,IIntentReceiver finishedReceiver,String requiredPermission,Bundle options) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeStrongBinder(target.asBinder());
  data.writeInt(code);
  if ((intent != null)) {
    data.writeInt(1);
    intent.writeToParcel(data,0);
  }
 else {
    data.writeInt(0);
  }
  data.writeString(resolvedType);
  data.writeStrongBinder((((finishedReceiver != null)) ? (finishedReceiver.asBinder()) : (null)));
  data.writeString(requiredPermission);
  if ((options != null)) {
    data.writeInt(1);
    options.writeToParcel(data,0);
  }
 else {
    data.writeInt(0);
  }
  mRemote.transact(SEND_INTENT_SENDER_TRANSACTION,data,reply,0);
  final int res=reply.readInt();
  data.recycle();
  reply.recycle();
  return res;
}

Fixed version (ground truth):
public int sendIntentSender(IIntentSender target,int code,Intent intent,String resolvedType,IIntentReceiver finishedReceiver,String requiredPermission,Bundle options) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeStrongBinder(target.asBinder());
  data.writeInt(code);
  if ((intent != null)) {
    data.writeInt(1);
    intent.writeToParcel(data,0);
  }
 else {
    data.writeInt(0);
  }
  data.writeString(resolvedType);
  data.writeStrongBinder((((finishedReceiver != null)) ? (finishedReceiver.asBinder()) : (null)));
  data.writeString(requiredPermission);
  if ((options != null)) {
    data.writeInt(1);
    options.writeToParcel(data,0);
  }
 else {
    data.writeInt(0);
  }
  mRemote.transact(SEND_INTENT_SENDER_TRANSACTION,data,reply,0);
  reply.readException();
  final int res=reply.readInt();
  data.recycle();
  reply.recycle();
  return res;
}
Program: 191446
Project: 191446
Buggy source:
/** 
 * @param hasProgress whether the progress bar should be shown and set
 */
private RemoteViews applyStandardTemplate(int resId,boolean hasProgress,CharSequence title,CharSequence text){
  RemoteViews contentView=new BuilderRemoteViews(mContext.getApplicationInfo(),resId);
  resetStandardTemplate(contentView);
  final Bundle ex=mN.extras;
  bindNotificationHeader(contentView);
  bindLargeIcon(contentView);
  if (title != null) {
    contentView.setViewVisibility(R.id.title,View.VISIBLE);
    contentView.setTextViewText(R.id.title,title);
  }
  boolean showProgress=handleProgressBar(hasProgress,contentView,ex);
  if (text != null) {
    int textId=showProgress ? com.android.internal.R.id.text_line_1 : com.android.internal.R.id.text;
    contentView.setTextViewText(textId,text);
    contentView.setViewVisibility(textId,View.VISIBLE);
  }
  setContentMinHeight(contentView,showProgress || mN.mLargeIcon != null);
  return contentView;
}

Fixed version (ground truth):
/** 
 * @param hasProgress whether the progress bar should be shown and set
 */
private RemoteViews applyStandardTemplate(int resId,boolean hasProgress,CharSequence title,CharSequence text){
  RemoteViews contentView=new BuilderRemoteViews(mContext.getApplicationInfo(),resId);
  resetStandardTemplate(contentView);
  final Bundle ex=mN.extras;
  bindNotificationHeader(contentView);
  bindLargeIcon(contentView);
  boolean showProgress=handleProgressBar(hasProgress,contentView,ex);
  if (title != null) {
    contentView.setViewVisibility(R.id.title,View.VISIBLE);
    contentView.setTextViewText(R.id.title,title);
    contentView.setViewLayoutWidth(R.id.title,showProgress ? ViewGroup.LayoutParams.WRAP_CONTENT : ViewGroup.LayoutParams.MATCH_PARENT);
  }
  if (text != null) {
    int textId=showProgress ? com.android.internal.R.id.text_line_1 : com.android.internal.R.id.text;
    contentView.setTextViewText(textId,text);
    contentView.setViewVisibility(textId,View.VISIBLE);
  }
  setContentMinHeight(contentView,showProgress || mN.mLargeIcon != null);
  return contentView;
}
Program: 191447
Project: 191447
Buggy source:
public int sendIntentSender(IIntentSender target,int code,Intent intent,String resolvedType,IIntentReceiver finishedReceiver,String requiredPermission,Bundle options) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeStrongBinder(target.asBinder());
  data.writeInt(code);
  if ((intent != null)) {
    data.writeInt(1);
    intent.writeToParcel(data,0);
  }
 else {
    data.writeInt(0);
  }
  data.writeString(resolvedType);
  data.writeStrongBinder((((finishedReceiver != null)) ? (finishedReceiver.asBinder()) : (null)));
  data.writeString(requiredPermission);
  if ((options != null)) {
    data.writeInt(1);
    options.writeToParcel(data,0);
  }
 else {
    data.writeInt(0);
  }
  mRemote.transact(SEND_INTENT_SENDER_TRANSACTION,data,reply,0);
  final int res=reply.readInt();
  data.recycle();
  reply.recycle();
  return res;
}

Fixed version (ground truth):
public int sendIntentSender(IIntentSender target,int code,Intent intent,String resolvedType,IIntentReceiver finishedReceiver,String requiredPermission,Bundle options) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeStrongBinder(target.asBinder());
  data.writeInt(code);
  if ((intent != null)) {
    data.writeInt(1);
    intent.writeToParcel(data,0);
  }
 else {
    data.writeInt(0);
  }
  data.writeString(resolvedType);
  data.writeStrongBinder((((finishedReceiver != null)) ? (finishedReceiver.asBinder()) : (null)));
  data.writeString(requiredPermission);
  if ((options != null)) {
    data.writeInt(1);
    options.writeToParcel(data,0);
  }
 else {
    data.writeInt(0);
  }
  mRemote.transact(SEND_INTENT_SENDER_TRANSACTION,data,reply,0);
  reply.readException();
  final int res=reply.readInt();
  data.recycle();
  reply.recycle();
  return res;
}
Program: 191448
Project: 191448
Buggy source:
public int sendIntentSender(IIntentSender target,int code,Intent intent,String resolvedType,IIntentReceiver finishedReceiver,String requiredPermission,Bundle options) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeStrongBinder(target.asBinder());
  data.writeInt(code);
  if ((intent != null)) {
    data.writeInt(1);
    intent.writeToParcel(data,0);
  }
 else {
    data.writeInt(0);
  }
  data.writeString(resolvedType);
  data.writeStrongBinder((((finishedReceiver != null)) ? (finishedReceiver.asBinder()) : (null)));
  data.writeString(requiredPermission);
  if ((options != null)) {
    data.writeInt(1);
    options.writeToParcel(data,0);
  }
 else {
    data.writeInt(0);
  }
  mRemote.transact(SEND_INTENT_SENDER_TRANSACTION,data,reply,0);
  final int res=reply.readInt();
  data.recycle();
  reply.recycle();
  return res;
}

Fixed version (ground truth):
public int sendIntentSender(IIntentSender target,int code,Intent intent,String resolvedType,IIntentReceiver finishedReceiver,String requiredPermission,Bundle options) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeStrongBinder(target.asBinder());
  data.writeInt(code);
  if ((intent != null)) {
    data.writeInt(1);
    intent.writeToParcel(data,0);
  }
 else {
    data.writeInt(0);
  }
  data.writeString(resolvedType);
  data.writeStrongBinder((((finishedReceiver != null)) ? (finishedReceiver.asBinder()) : (null)));
  data.writeString(requiredPermission);
  if ((options != null)) {
    data.writeInt(1);
    options.writeToParcel(data,0);
  }
 else {
    data.writeInt(0);
  }
  mRemote.transact(SEND_INTENT_SENDER_TRANSACTION,data,reply,0);
  reply.readException();
  final int res=reply.readInt();
  data.recycle();
  reply.recycle();
  return res;
}
Program: 191449
Project: 191449
Buggy source:
private void updateScrim(boolean animate,View scrim,float alpha,float currentAlpha){
  if (mKeyguardFadingOutInProgress) {
    return;
  }
  ValueAnimator previousAnimator=StackStateAnimator.getChildTag(scrim,TAG_KEY_ANIM);
  float animEndValue=-1;
  if (previousAnimator != null) {
    if (animate || alpha == currentAlpha) {
      previousAnimator.cancel();
    }
 else {
      animEndValue=StackStateAnimator.getChildTag(scrim,TAG_END_ALPHA);
    }
  }
  if (alpha != currentAlpha && alpha != animEndValue) {
    if (animate) {
      startScrimAnimation(scrim,alpha);
      scrim.setTag(TAG_START_ALPHA,currentAlpha);
      scrim.setTag(TAG_END_ALPHA,alpha);
    }
 else {
      if (previousAnimator != null) {
        float previousStartValue=StackStateAnimator.getChildTag(scrim,TAG_START_ALPHA);
        float previousEndValue=StackStateAnimator.getChildTag(scrim,TAG_END_ALPHA);
        PropertyValuesHolder[] values=previousAnimator.getValues();
        float relativeDiff=alpha - previousEndValue;
        float newStartValue=previousStartValue + relativeDiff;
        values[0].setFloatValues(newStartValue,alpha);
        scrim.setTag(TAG_START_ALPHA,newStartValue);
        scrim.setTag(TAG_END_ALPHA,alpha);
        previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
      }
 else {
        setCurrentScrimAlpha(scrim,alpha);
        updateScrimColor(scrim);
      }
    }
  }
}

Fixed version (ground truth):
private void updateScrim(boolean animate,View scrim,float alpha,float currentAlpha){
  if (mKeyguardFadingOutInProgress) {
    return;
  }
  ValueAnimator previousAnimator=StackStateAnimator.getChildTag(scrim,TAG_KEY_ANIM);
  float animEndValue=-1;
  if (previousAnimator != null) {
    if (animate || alpha == currentAlpha) {
      previousAnimator.cancel();
    }
 else {
      animEndValue=StackStateAnimator.getChildTag(scrim,TAG_END_ALPHA);
    }
  }
  if (alpha != currentAlpha && alpha != animEndValue) {
    if (animate) {
      startScrimAnimation(scrim,alpha);
      scrim.setTag(TAG_START_ALPHA,currentAlpha);
      scrim.setTag(TAG_END_ALPHA,alpha);
    }
 else {
      if (previousAnimator != null) {
        float previousStartValue=StackStateAnimator.getChildTag(scrim,TAG_START_ALPHA);
        float previousEndValue=StackStateAnimator.getChildTag(scrim,TAG_END_ALPHA);
        PropertyValuesHolder[] values=previousAnimator.getValues();
        float relativeDiff=alpha - previousEndValue;
        float newStartValue=previousStartValue + relativeDiff;
        newStartValue=Math.max(0,Math.min(1.0f,newStartValue));
        values[0].setFloatValues(newStartValue,alpha);
        scrim.setTag(TAG_START_ALPHA,newStartValue);
        scrim.setTag(TAG_END_ALPHA,alpha);
        previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
      }
 else {
        setCurrentScrimAlpha(scrim,alpha);
        updateScrimColor(scrim);
      }
    }
  }
}
Program: 191450
Project: 191450
Buggy source:
private void updateScrimColor(View scrim){
  float alpha1=getCurrentScrimAlpha(scrim);
  if (scrim instanceof ScrimView) {
    float alpha2=getDozeAlpha(scrim);
    float alpha=1 - (1 - alpha1) * (1 - alpha2);
    ((ScrimView)scrim).setScrimColor(Color.argb((int)(alpha * 255),0,0,0));
  }
 else {
    scrim.setAlpha(alpha1);
  }
}

Fixed version (ground truth):
private void updateScrimColor(View scrim){
  float alpha1=getCurrentScrimAlpha(scrim);
  if (scrim instanceof ScrimView) {
    float alpha2=getDozeAlpha(scrim);
    float alpha=1 - (1 - alpha1) * (1 - alpha2);
    alpha=Math.max(0,Math.min(1.0f,alpha));
    ((ScrimView)scrim).setScrimColor(Color.argb((int)(alpha * 255),0,0,0));
  }
 else {
    scrim.setAlpha(alpha1);
  }
}
Program: 191451
Project: 191451
Buggy source:
private void updateScrim(boolean animate,View scrim,float alpha,float currentAlpha){
  if (mKeyguardFadingOutInProgress) {
    return;
  }
  ValueAnimator previousAnimator=StackStateAnimator.getChildTag(scrim,TAG_KEY_ANIM);
  float animEndValue=-1;
  if (previousAnimator != null) {
    if (animate || alpha == currentAlpha) {
      previousAnimator.cancel();
    }
 else {
      animEndValue=StackStateAnimator.getChildTag(scrim,TAG_END_ALPHA);
    }
  }
  if (alpha != currentAlpha && alpha != animEndValue) {
    if (animate) {
      startScrimAnimation(scrim,alpha);
      scrim.setTag(TAG_START_ALPHA,currentAlpha);
      scrim.setTag(TAG_END_ALPHA,alpha);
    }
 else {
      if (previousAnimator != null) {
        float previousStartValue=StackStateAnimator.getChildTag(scrim,TAG_START_ALPHA);
        float previousEndValue=StackStateAnimator.getChildTag(scrim,TAG_END_ALPHA);
        PropertyValuesHolder[] values=previousAnimator.getValues();
        float relativeDiff=alpha - previousEndValue;
        float newStartValue=previousStartValue + relativeDiff;
        values[0].setFloatValues(newStartValue,alpha);
        scrim.setTag(TAG_START_ALPHA,newStartValue);
        scrim.setTag(TAG_END_ALPHA,alpha);
        previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
      }
 else {
        setCurrentScrimAlpha(scrim,alpha);
        updateScrimColor(scrim);
      }
    }
  }
}

Fixed version (ground truth):
private void updateScrim(boolean animate,View scrim,float alpha,float currentAlpha){
  if (mKeyguardFadingOutInProgress) {
    return;
  }
  ValueAnimator previousAnimator=StackStateAnimator.getChildTag(scrim,TAG_KEY_ANIM);
  float animEndValue=-1;
  if (previousAnimator != null) {
    if (animate || alpha == currentAlpha) {
      previousAnimator.cancel();
    }
 else {
      animEndValue=StackStateAnimator.getChildTag(scrim,TAG_END_ALPHA);
    }
  }
  if (alpha != currentAlpha && alpha != animEndValue) {
    if (animate) {
      startScrimAnimation(scrim,alpha);
      scrim.setTag(TAG_START_ALPHA,currentAlpha);
      scrim.setTag(TAG_END_ALPHA,alpha);
    }
 else {
      if (previousAnimator != null) {
        float previousStartValue=StackStateAnimator.getChildTag(scrim,TAG_START_ALPHA);
        float previousEndValue=StackStateAnimator.getChildTag(scrim,TAG_END_ALPHA);
        PropertyValuesHolder[] values=previousAnimator.getValues();
        float relativeDiff=alpha - previousEndValue;
        float newStartValue=previousStartValue + relativeDiff;
        newStartValue=Math.max(0,Math.min(1.0f,newStartValue));
        values[0].setFloatValues(newStartValue,alpha);
        scrim.setTag(TAG_START_ALPHA,newStartValue);
        scrim.setTag(TAG_END_ALPHA,alpha);
        previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
      }
 else {
        setCurrentScrimAlpha(scrim,alpha);
        updateScrimColor(scrim);
      }
    }
  }
}
Program: 191452
Project: 191452
Buggy source:
private void updateScrimColor(View scrim){
  float alpha1=getCurrentScrimAlpha(scrim);
  if (scrim instanceof ScrimView) {
    float alpha2=getDozeAlpha(scrim);
    float alpha=1 - (1 - alpha1) * (1 - alpha2);
    ((ScrimView)scrim).setScrimColor(Color.argb((int)(alpha * 255),0,0,0));
  }
 else {
    scrim.setAlpha(alpha1);
  }
}

Fixed version (ground truth):
private void updateScrimColor(View scrim){
  float alpha1=getCurrentScrimAlpha(scrim);
  if (scrim instanceof ScrimView) {
    float alpha2=getDozeAlpha(scrim);
    float alpha=1 - (1 - alpha1) * (1 - alpha2);
    alpha=Math.max(0,Math.min(1.0f,alpha));
    ((ScrimView)scrim).setScrimColor(Color.argb((int)(alpha * 255),0,0,0));
  }
 else {
    scrim.setAlpha(alpha1);
  }
}
Program: 191453
Project: 191453
Buggy source:
/** 
 * Set this view to count down to the base instead of counting up from it.
 * @param countDown whether this view should count down
 * @see #setBase(long)
 */
@android.view.RemotableViewMethod public void setCountDown(boolean countDown){
  mCountDown=countDown;
}

Fixed version (ground truth):
/** 
 * Set this view to count down to the base instead of counting up from it.
 * @param countDown whether this view should count down
 * @see #setBase(long)
 */
@android.view.RemotableViewMethod public void setCountDown(boolean countDown){
  mCountDown=countDown;
  updateText(SystemClock.elapsedRealtime());
}
Program: 191454
Project: 191454
Buggy source:
private void updateScrim(boolean animate,View scrim,float alpha,float currentAlpha){
  if (mKeyguardFadingOutInProgress) {
    return;
  }
  ValueAnimator previousAnimator=StackStateAnimator.getChildTag(scrim,TAG_KEY_ANIM);
  float animEndValue=-1;
  if (previousAnimator != null) {
    if (animate || alpha == currentAlpha) {
      previousAnimator.cancel();
    }
 else {
      animEndValue=StackStateAnimator.getChildTag(scrim,TAG_END_ALPHA);
    }
  }
  if (alpha != currentAlpha && alpha != animEndValue) {
    if (animate) {
      startScrimAnimation(scrim,alpha);
      scrim.setTag(TAG_START_ALPHA,currentAlpha);
      scrim.setTag(TAG_END_ALPHA,alpha);
    }
 else {
      if (previousAnimator != null) {
        float previousStartValue=StackStateAnimator.getChildTag(scrim,TAG_START_ALPHA);
        float previousEndValue=StackStateAnimator.getChildTag(scrim,TAG_END_ALPHA);
        PropertyValuesHolder[] values=previousAnimator.getValues();
        float relativeDiff=alpha - previousEndValue;
        float newStartValue=previousStartValue + relativeDiff;
        values[0].setFloatValues(newStartValue,alpha);
        scrim.setTag(TAG_START_ALPHA,newStartValue);
        scrim.setTag(TAG_END_ALPHA,alpha);
        previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
      }
 else {
        setCurrentScrimAlpha(scrim,alpha);
        updateScrimColor(scrim);
      }
    }
  }
}

Fixed version (ground truth):
private void updateScrim(boolean animate,View scrim,float alpha,float currentAlpha){
  if (mKeyguardFadingOutInProgress) {
    return;
  }
  ValueAnimator previousAnimator=StackStateAnimator.getChildTag(scrim,TAG_KEY_ANIM);
  float animEndValue=-1;
  if (previousAnimator != null) {
    if (animate || alpha == currentAlpha) {
      previousAnimator.cancel();
    }
 else {
      animEndValue=StackStateAnimator.getChildTag(scrim,TAG_END_ALPHA);
    }
  }
  if (alpha != currentAlpha && alpha != animEndValue) {
    if (animate) {
      startScrimAnimation(scrim,alpha);
      scrim.setTag(TAG_START_ALPHA,currentAlpha);
      scrim.setTag(TAG_END_ALPHA,alpha);
    }
 else {
      if (previousAnimator != null) {
        float previousStartValue=StackStateAnimator.getChildTag(scrim,TAG_START_ALPHA);
        float previousEndValue=StackStateAnimator.getChildTag(scrim,TAG_END_ALPHA);
        PropertyValuesHolder[] values=previousAnimator.getValues();
        float relativeDiff=alpha - previousEndValue;
        float newStartValue=previousStartValue + relativeDiff;
        newStartValue=Math.max(0,Math.min(1.0f,newStartValue));
        values[0].setFloatValues(newStartValue,alpha);
        scrim.setTag(TAG_START_ALPHA,newStartValue);
        scrim.setTag(TAG_END_ALPHA,alpha);
        previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
      }
 else {
        setCurrentScrimAlpha(scrim,alpha);
        updateScrimColor(scrim);
      }
    }
  }
}