nus-yam/ex-repair huggingface dataset:
Program: 195101
Project: 195101
Buggy source:
public HeadsUpManager(final Context context,ViewTreeObserver observer){
  Resources resources=context.getResources();
  mTouchAcceptanceDelay=resources.getInteger(R.integer.touch_acceptance_delay);
  mSnoozedPackages=new ArrayMap<>();
  mDefaultSnoozeLengthMs=resources.getInteger(R.integer.heads_up_default_snooze_length_ms);
  mSnoozeLengthMs=mDefaultSnoozeLengthMs;
  mMinimumDisplayTime=resources.getInteger(R.integer.heads_up_notification_minimum_time);
  mHeadsUpNotificationDecay=resources.getInteger(R.integer.heads_up_notification_decay);
  mClock=new Clock();
  mSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,mDefaultSnoozeLengthMs);
  mSettingsObserver=new ContentObserver(mHandler){
    @Override public void onChange(    boolean selfChange){
      final int packageSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,-1);
      if (packageSnoozeLengthMs > -1 && packageSnoozeLengthMs != mSnoozeLengthMs) {
        mSnoozeLengthMs=packageSnoozeLengthMs;
        if (DEBUG)         Log.v(TAG,"String_Node_Str" + mSnoozeLengthMs);
      }
    }
  }
;
  context.getContentResolver().registerContentObserver(Settings.Global.getUriFor(SETTING_HEADS_UP_SNOOZE_LENGTH_MS),false,mSettingsObserver);
  observer.addOnComputeInternalInsetsListener(this);
}

Fixed version (ground truth):
public HeadsUpManager(final Context context,View statusBarWindowView){
  Resources resources=context.getResources();
  mTouchAcceptanceDelay=resources.getInteger(R.integer.touch_acceptance_delay);
  mSnoozedPackages=new ArrayMap<>();
  mDefaultSnoozeLengthMs=resources.getInteger(R.integer.heads_up_default_snooze_length_ms);
  mSnoozeLengthMs=mDefaultSnoozeLengthMs;
  mMinimumDisplayTime=resources.getInteger(R.integer.heads_up_notification_minimum_time);
  mHeadsUpNotificationDecay=resources.getInteger(R.integer.heads_up_notification_decay);
  mClock=new Clock();
  mSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,mDefaultSnoozeLengthMs);
  mSettingsObserver=new ContentObserver(mHandler){
    @Override public void onChange(    boolean selfChange){
      final int packageSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,-1);
      if (packageSnoozeLengthMs > -1 && packageSnoozeLengthMs != mSnoozeLengthMs) {
        mSnoozeLengthMs=packageSnoozeLengthMs;
        if (DEBUG)         Log.v(TAG,"String_Node_Str" + mSnoozeLengthMs);
      }
    }
  }
;
  context.getContentResolver().registerContentObserver(Settings.Global.getUriFor(SETTING_HEADS_UP_SNOOZE_LENGTH_MS),false,mSettingsObserver);
  mStatusBarWindowView=statusBarWindowView;
  mStatusBarHeight=resources.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
}
Program: 195102
Project: 195102
Buggy source:
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info){
  if (!mIsExpanded && mHasPinnedNotification) {
    int minX=Integer.MAX_VALUE;
    int maxX=0;
    int minY=Integer.MAX_VALUE;
    int maxY=0;
    for (    HeadsUpEntry entry : mSortedEntries) {
      ExpandableNotificationRow row=entry.entry.row;
      if (row.isPinned()) {
        row.getLocationOnScreen(mTmpTwoArray);
        minX=Math.min(minX,mTmpTwoArray[0]);
        minY=Math.min(minY,0);
        maxX=Math.max(maxX,mTmpTwoArray[0] + row.getWidth());
        maxY=Math.max(maxY,row.getHeadsUpHeight());
      }
    }
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(minX,minY,maxX,maxY);
  }
}

Fixed version (ground truth):
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info){
  if (mHasPinnedNotification) {
    int minX=Integer.MAX_VALUE;
    int maxX=0;
    int minY=Integer.MAX_VALUE;
    int maxY=0;
    for (    HeadsUpEntry entry : mSortedEntries) {
      ExpandableNotificationRow row=entry.entry.row;
      if (row.isPinned()) {
        row.getLocationOnScreen(mTmpTwoArray);
        minX=Math.min(minX,mTmpTwoArray[0]);
        minY=Math.min(minY,0);
        maxX=Math.max(maxX,mTmpTwoArray[0] + row.getWidth());
        maxY=Math.max(maxY,row.getHeadsUpHeight());
      }
    }
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(minX,minY,maxX,maxY);
  }
 else   if (mHeadsUpGoingAway || mWaitingOnCollapseWhenGoingAway) {
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(0,0,mStatusBarWindowView.getWidth(),mStatusBarHeight);
  }
}
Program: 195104
Project: 195104
Buggy source:
@Override public void onHeadsUpPinnedModeChanged(boolean inPinnedMode){
  if (inPinnedMode) {
    mStatusBarWindowManager.setHeadsUpShowing(true);
    mStatusBarWindowManager.setForceStatusBarVisible(true);
  }
 else {
    Runnable endRunnable=new Runnable(){
      @Override public void run(){
        if (!mHeadsUpManager.hasPinnedHeadsUp()) {
          mStatusBarWindowManager.setHeadsUpShowing(false);
        }
      }
    }
;
    if (!mNotificationPanel.isFullyCollapsed()) {
      endRunnable.run();
    }
 else {
      mStackScroller.runAfterAnimationFinished(endRunnable);
    }
  }
}

Fixed version (ground truth):
@Override public void onHeadsUpPinnedModeChanged(boolean inPinnedMode){
  if (inPinnedMode) {
    mNotificationPanel.requestLayout();
    mStatusBarWindowManager.setHeadsUpShowing(true);
    mStatusBarWindowManager.setForceStatusBarVisible(true);
    mStatusBarWindowManager.setForceWindowCollapsed(true);
    mNotificationPanel.post(new Runnable(){
      @Override public void run(){
        mStatusBarWindowManager.setForceWindowCollapsed(false);
      }
    }
);
  }
 else {
    if (!mNotificationPanel.isFullyCollapsed()) {
      mStatusBarWindowManager.setHeadsUpShowing(false);
    }
 else {
      mHeadsUpManager.setHeadsUpGoingAway(true);
      mStackScroller.runAfterAnimationFinished(new Runnable(){
        @Override public void run(){
          if (!mHeadsUpManager.hasPinnedHeadsUp()) {
            mStatusBarWindowManager.setHeadsUpShowing(false);
            mHeadsUpManager.setHeadsUpGoingAway(false);
          }
        }
      }
);
    }
  }
}
Program: 195106
Project: 195106
Buggy source:
private void updateHeadsUpScrim(boolean animate){
  float alpha=calculateHeadsUpAlpha();
  ValueAnimator previousAnimator=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_KEY_ANIM);
  float animEndValue=-1;
  if (previousAnimator != null) {
    if (animate || alpha == mCurrentHeadsUpAlpha) {
      previousAnimator.cancel();
    }
    animEndValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_START_ALPHA);
  }
  if (alpha != mCurrentHeadsUpAlpha && alpha != animEndValue) {
    if (animate) {
      startScrimAnimation(mHeadsUpScrim,alpha);
      mHeadsUpScrim.setTag(TAG_HUN_START_ALPHA,mCurrentHeadsUpAlpha);
      mHeadsUpScrim.setTag(TAG_HUN_END_ALPHA,alpha);
    }
 else {
      if (previousAnimator != null) {
        float previousStartValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_START_ALPHA);
        float previousEndValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_END_ALPHA);
        PropertyValuesHolder[] values=previousAnimator.getValues();
        float relativeDiff=alpha - previousEndValue;
        float newStartValue=previousStartValue + relativeDiff;
        values[0].setFloatValues(newStartValue,alpha);
        mHeadsUpScrim.setTag(TAG_HUN_START_ALPHA,newStartValue);
        mHeadsUpScrim.setTag(TAG_HUN_END_ALPHA,alpha);
        previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
      }
 else {
        setCurrentScrimAlpha(mHeadsUpScrim,alpha);
        updateScrimColor(mHeadsUpScrim);
      }
    }
  }
}

Fixed version (ground truth):
private void updateHeadsUpScrim(boolean animate){
  float alpha=calculateHeadsUpAlpha();
  ValueAnimator previousAnimator=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_KEY_ANIM);
  float animEndValue=-1;
  if (previousAnimator != null) {
    if (animate || alpha == mCurrentHeadsUpAlpha) {
      previousAnimator.cancel();
    }
 else {
      animEndValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_END_ALPHA);
    }
  }
  if (alpha != mCurrentHeadsUpAlpha && alpha != animEndValue) {
    if (animate) {
      startScrimAnimation(mHeadsUpScrim,alpha);
      mHeadsUpScrim.setTag(TAG_HUN_START_ALPHA,mCurrentHeadsUpAlpha);
      mHeadsUpScrim.setTag(TAG_HUN_END_ALPHA,alpha);
    }
 else {
      if (previousAnimator != null) {
        float previousStartValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_START_ALPHA);
        float previousEndValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_END_ALPHA);
        PropertyValuesHolder[] values=previousAnimator.getValues();
        float relativeDiff=alpha - previousEndValue;
        float newStartValue=previousStartValue + relativeDiff;
        values[0].setFloatValues(newStartValue,alpha);
        mHeadsUpScrim.setTag(TAG_HUN_START_ALPHA,newStartValue);
        mHeadsUpScrim.setTag(TAG_HUN_END_ALPHA,alpha);
        previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
      }
 else {
        setCurrentScrimAlpha(mHeadsUpScrim,alpha);
        updateScrimColor(mHeadsUpScrim);
      }
    }
  }
}
Program: 195107
Project: 195107
Buggy source:
private void applyHeight(State state){
  boolean expanded=state.isKeyguardShowingAndNotOccluded() || state.statusBarExpanded || state.keyguardFadingAway|| state.bouncerShowing|| state.headsUpShowing;
  if (expanded) {
    mLpChanged.height=ViewGroup.LayoutParams.MATCH_PARENT;
  }
 else {
    mLpChanged.height=mBarHeight;
  }
}

Fixed version (ground truth):
private void applyHeight(State state){
  boolean expanded=!state.forceCollapsed && (state.isKeyguardShowingAndNotOccluded() || state.statusBarExpanded || state.keyguardFadingAway|| state.bouncerShowing|| state.headsUpShowing);
  if (expanded) {
    mLpChanged.height=ViewGroup.LayoutParams.MATCH_PARENT;
  }
 else {
    mLpChanged.height=mBarHeight;
  }
}
Program: 195108
Project: 195108
Buggy source:
public void setIsExpanded(boolean isExpanded){
  if (isExpanded != mIsExpanded) {
    mIsExpanded=isExpanded;
    if (isExpanded) {
      unpinAll();
    }
  }
}

Fixed version (ground truth):
public void setIsExpanded(boolean isExpanded){
  if (isExpanded != mIsExpanded) {
    mIsExpanded=isExpanded;
    if (isExpanded) {
      unpinAll();
      mWaitingOnCollapseWhenGoingAway=false;
      mHeadsUpGoingAway=false;
      updateTouchableRegionListener();
    }
  }
}
Program: 195109
Project: 195109
Buggy source:
private void updatePinnedMode(){
  boolean hasPinnedNotification=hasPinnedNotificationInternal();
  if (hasPinnedNotification == mHasPinnedNotification) {
    return;
  }
  mHasPinnedNotification=hasPinnedNotification;
  for (  OnHeadsUpChangedListener listener : mListeners) {
    listener.onHeadsUpPinnedModeChanged(hasPinnedNotification);
  }
}

Fixed version (ground truth):
private void updatePinnedMode(){
  boolean hasPinnedNotification=hasPinnedNotificationInternal();
  if (hasPinnedNotification == mHasPinnedNotification) {
    return;
  }
  mHasPinnedNotification=hasPinnedNotification;
  updateTouchableRegionListener();
  for (  OnHeadsUpChangedListener listener : mListeners) {
    listener.onHeadsUpPinnedModeChanged(hasPinnedNotification);
  }
}
Program: 195110
Project: 195110
Buggy source:
public HeadsUpManager(final Context context,ViewTreeObserver observer){
  Resources resources=context.getResources();
  mTouchAcceptanceDelay=resources.getInteger(R.integer.touch_acceptance_delay);
  mSnoozedPackages=new ArrayMap<>();
  mDefaultSnoozeLengthMs=resources.getInteger(R.integer.heads_up_default_snooze_length_ms);
  mSnoozeLengthMs=mDefaultSnoozeLengthMs;
  mMinimumDisplayTime=resources.getInteger(R.integer.heads_up_notification_minimum_time);
  mHeadsUpNotificationDecay=resources.getInteger(R.integer.heads_up_notification_decay);
  mClock=new Clock();
  mSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,mDefaultSnoozeLengthMs);
  mSettingsObserver=new ContentObserver(mHandler){
    @Override public void onChange(    boolean selfChange){
      final int packageSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,-1);
      if (packageSnoozeLengthMs > -1 && packageSnoozeLengthMs != mSnoozeLengthMs) {
        mSnoozeLengthMs=packageSnoozeLengthMs;
        if (DEBUG)         Log.v(TAG,"String_Node_Str" + mSnoozeLengthMs);
      }
    }
  }
;
  context.getContentResolver().registerContentObserver(Settings.Global.getUriFor(SETTING_HEADS_UP_SNOOZE_LENGTH_MS),false,mSettingsObserver);
  observer.addOnComputeInternalInsetsListener(this);
}

Fixed version (ground truth):
public HeadsUpManager(final Context context,View statusBarWindowView){
  Resources resources=context.getResources();
  mTouchAcceptanceDelay=resources.getInteger(R.integer.touch_acceptance_delay);
  mSnoozedPackages=new ArrayMap<>();
  mDefaultSnoozeLengthMs=resources.getInteger(R.integer.heads_up_default_snooze_length_ms);
  mSnoozeLengthMs=mDefaultSnoozeLengthMs;
  mMinimumDisplayTime=resources.getInteger(R.integer.heads_up_notification_minimum_time);
  mHeadsUpNotificationDecay=resources.getInteger(R.integer.heads_up_notification_decay);
  mClock=new Clock();
  mSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,mDefaultSnoozeLengthMs);
  mSettingsObserver=new ContentObserver(mHandler){
    @Override public void onChange(    boolean selfChange){
      final int packageSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,-1);
      if (packageSnoozeLengthMs > -1 && packageSnoozeLengthMs != mSnoozeLengthMs) {
        mSnoozeLengthMs=packageSnoozeLengthMs;
        if (DEBUG)         Log.v(TAG,"String_Node_Str" + mSnoozeLengthMs);
      }
    }
  }
;
  context.getContentResolver().registerContentObserver(Settings.Global.getUriFor(SETTING_HEADS_UP_SNOOZE_LENGTH_MS),false,mSettingsObserver);
  mStatusBarWindowView=statusBarWindowView;
  mStatusBarHeight=resources.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
}
Program: 195111
Project: 195111
Buggy source:
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info){
  if (!mIsExpanded && mHasPinnedNotification) {
    int minX=Integer.MAX_VALUE;
    int maxX=0;
    int minY=Integer.MAX_VALUE;
    int maxY=0;
    for (    HeadsUpEntry entry : mSortedEntries) {
      ExpandableNotificationRow row=entry.entry.row;
      if (row.isPinned()) {
        row.getLocationOnScreen(mTmpTwoArray);
        minX=Math.min(minX,mTmpTwoArray[0]);
        minY=Math.min(minY,0);
        maxX=Math.max(maxX,mTmpTwoArray[0] + row.getWidth());
        maxY=Math.max(maxY,row.getHeadsUpHeight());
      }
    }
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(minX,minY,maxX,maxY);
  }
}

Fixed version (ground truth):
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info){
  if (mHasPinnedNotification) {
    int minX=Integer.MAX_VALUE;
    int maxX=0;
    int minY=Integer.MAX_VALUE;
    int maxY=0;
    for (    HeadsUpEntry entry : mSortedEntries) {
      ExpandableNotificationRow row=entry.entry.row;
      if (row.isPinned()) {
        row.getLocationOnScreen(mTmpTwoArray);
        minX=Math.min(minX,mTmpTwoArray[0]);
        minY=Math.min(minY,0);
        maxX=Math.max(maxX,mTmpTwoArray[0] + row.getWidth());
        maxY=Math.max(maxY,row.getHeadsUpHeight());
      }
    }
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(minX,minY,maxX,maxY);
  }
 else   if (mHeadsUpGoingAway || mWaitingOnCollapseWhenGoingAway) {
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(0,0,mStatusBarWindowView.getWidth(),mStatusBarHeight);
  }
}
Program: 195113
Project: 195113
Buggy source:
@Override public void onHeadsUpPinnedModeChanged(boolean inPinnedMode){
  if (inPinnedMode) {
    mStatusBarWindowManager.setHeadsUpShowing(true);
    mStatusBarWindowManager.setForceStatusBarVisible(true);
  }
 else {
    Runnable endRunnable=new Runnable(){
      @Override public void run(){
        if (!mHeadsUpManager.hasPinnedHeadsUp()) {
          mStatusBarWindowManager.setHeadsUpShowing(false);
        }
      }
    }
;
    if (!mNotificationPanel.isFullyCollapsed()) {
      endRunnable.run();
    }
 else {
      mStackScroller.runAfterAnimationFinished(endRunnable);
    }
  }
}

Fixed version (ground truth):
@Override public void onHeadsUpPinnedModeChanged(boolean inPinnedMode){
  if (inPinnedMode) {
    mNotificationPanel.requestLayout();
    mStatusBarWindowManager.setHeadsUpShowing(true);
    mStatusBarWindowManager.setForceStatusBarVisible(true);
    mStatusBarWindowManager.setForceWindowCollapsed(true);
    mNotificationPanel.post(new Runnable(){
      @Override public void run(){
        mStatusBarWindowManager.setForceWindowCollapsed(false);
      }
    }
);
  }
 else {
    if (!mNotificationPanel.isFullyCollapsed()) {
      mStatusBarWindowManager.setHeadsUpShowing(false);
    }
 else {
      mHeadsUpManager.setHeadsUpGoingAway(true);
      mStackScroller.runAfterAnimationFinished(new Runnable(){
        @Override public void run(){
          if (!mHeadsUpManager.hasPinnedHeadsUp()) {
            mStatusBarWindowManager.setHeadsUpShowing(false);
            mHeadsUpManager.setHeadsUpGoingAway(false);
          }
        }
      }
);
    }
  }
}
Program: 195115
Project: 195115
Buggy source:
private void updateHeadsUpScrim(boolean animate){
  float alpha=calculateHeadsUpAlpha();
  ValueAnimator previousAnimator=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_KEY_ANIM);
  float animEndValue=-1;
  if (previousAnimator != null) {
    if (animate || alpha == mCurrentHeadsUpAlpha) {
      previousAnimator.cancel();
    }
    animEndValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_START_ALPHA);
  }
  if (alpha != mCurrentHeadsUpAlpha && alpha != animEndValue) {
    if (animate) {
      startScrimAnimation(mHeadsUpScrim,alpha);
      mHeadsUpScrim.setTag(TAG_HUN_START_ALPHA,mCurrentHeadsUpAlpha);
      mHeadsUpScrim.setTag(TAG_HUN_END_ALPHA,alpha);
    }
 else {
      if (previousAnimator != null) {
        float previousStartValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_START_ALPHA);
        float previousEndValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_END_ALPHA);
        PropertyValuesHolder[] values=previousAnimator.getValues();
        float relativeDiff=alpha - previousEndValue;
        float newStartValue=previousStartValue + relativeDiff;
        values[0].setFloatValues(newStartValue,alpha);
        mHeadsUpScrim.setTag(TAG_HUN_START_ALPHA,newStartValue);
        mHeadsUpScrim.setTag(TAG_HUN_END_ALPHA,alpha);
        previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
      }
 else {
        setCurrentScrimAlpha(mHeadsUpScrim,alpha);
        updateScrimColor(mHeadsUpScrim);
      }
    }
  }
}

Fixed version (ground truth):
private void updateHeadsUpScrim(boolean animate){
  float alpha=calculateHeadsUpAlpha();
  ValueAnimator previousAnimator=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_KEY_ANIM);
  float animEndValue=-1;
  if (previousAnimator != null) {
    if (animate || alpha == mCurrentHeadsUpAlpha) {
      previousAnimator.cancel();
    }
 else {
      animEndValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_END_ALPHA);
    }
  }
  if (alpha != mCurrentHeadsUpAlpha && alpha != animEndValue) {
    if (animate) {
      startScrimAnimation(mHeadsUpScrim,alpha);
      mHeadsUpScrim.setTag(TAG_HUN_START_ALPHA,mCurrentHeadsUpAlpha);
      mHeadsUpScrim.setTag(TAG_HUN_END_ALPHA,alpha);
    }
 else {
      if (previousAnimator != null) {
        float previousStartValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_START_ALPHA);
        float previousEndValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_END_ALPHA);
        PropertyValuesHolder[] values=previousAnimator.getValues();
        float relativeDiff=alpha - previousEndValue;
        float newStartValue=previousStartValue + relativeDiff;
        values[0].setFloatValues(newStartValue,alpha);
        mHeadsUpScrim.setTag(TAG_HUN_START_ALPHA,newStartValue);
        mHeadsUpScrim.setTag(TAG_HUN_END_ALPHA,alpha);
        previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
      }
 else {
        setCurrentScrimAlpha(mHeadsUpScrim,alpha);
        updateScrimColor(mHeadsUpScrim);
      }
    }
  }
}
Program: 195116
Project: 195116
Buggy source:
private void applyHeight(State state){
  boolean expanded=state.isKeyguardShowingAndNotOccluded() || state.statusBarExpanded || state.keyguardFadingAway|| state.bouncerShowing|| state.headsUpShowing;
  if (expanded) {
    mLpChanged.height=ViewGroup.LayoutParams.MATCH_PARENT;
  }
 else {
    mLpChanged.height=mBarHeight;
  }
}

Fixed version (ground truth):
private void applyHeight(State state){
  boolean expanded=!state.forceCollapsed && (state.isKeyguardShowingAndNotOccluded() || state.statusBarExpanded || state.keyguardFadingAway|| state.bouncerShowing|| state.headsUpShowing);
  if (expanded) {
    mLpChanged.height=ViewGroup.LayoutParams.MATCH_PARENT;
  }
 else {
    mLpChanged.height=mBarHeight;
  }
}
Program: 195117
Project: 195117
Buggy source:
public void setIsExpanded(boolean isExpanded){
  if (isExpanded != mIsExpanded) {
    mIsExpanded=isExpanded;
    if (isExpanded) {
      unpinAll();
    }
  }
}

Fixed version (ground truth):
public void setIsExpanded(boolean isExpanded){
  if (isExpanded != mIsExpanded) {
    mIsExpanded=isExpanded;
    if (isExpanded) {
      unpinAll();
      mWaitingOnCollapseWhenGoingAway=false;
      mHeadsUpGoingAway=false;
      updateTouchableRegionListener();
    }
  }
}
Program: 195118
Project: 195118
Buggy source:
private void updatePinnedMode(){
  boolean hasPinnedNotification=hasPinnedNotificationInternal();
  if (hasPinnedNotification == mHasPinnedNotification) {
    return;
  }
  mHasPinnedNotification=hasPinnedNotification;
  for (  OnHeadsUpChangedListener listener : mListeners) {
    listener.onHeadsUpPinnedModeChanged(hasPinnedNotification);
  }
}

Fixed version (ground truth):
private void updatePinnedMode(){
  boolean hasPinnedNotification=hasPinnedNotificationInternal();
  if (hasPinnedNotification == mHasPinnedNotification) {
    return;
  }
  mHasPinnedNotification=hasPinnedNotification;
  updateTouchableRegionListener();
  for (  OnHeadsUpChangedListener listener : mListeners) {
    listener.onHeadsUpPinnedModeChanged(hasPinnedNotification);
  }
}
Program: 195119
Project: 195119
Buggy source:
public HeadsUpManager(final Context context,ViewTreeObserver observer){
  Resources resources=context.getResources();
  mTouchAcceptanceDelay=resources.getInteger(R.integer.touch_acceptance_delay);
  mSnoozedPackages=new ArrayMap<>();
  mDefaultSnoozeLengthMs=resources.getInteger(R.integer.heads_up_default_snooze_length_ms);
  mSnoozeLengthMs=mDefaultSnoozeLengthMs;
  mMinimumDisplayTime=resources.getInteger(R.integer.heads_up_notification_minimum_time);
  mHeadsUpNotificationDecay=resources.getInteger(R.integer.heads_up_notification_decay);
  mClock=new Clock();
  mSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,mDefaultSnoozeLengthMs);
  mSettingsObserver=new ContentObserver(mHandler){
    @Override public void onChange(    boolean selfChange){
      final int packageSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,-1);
      if (packageSnoozeLengthMs > -1 && packageSnoozeLengthMs != mSnoozeLengthMs) {
        mSnoozeLengthMs=packageSnoozeLengthMs;
        if (DEBUG)         Log.v(TAG,"String_Node_Str" + mSnoozeLengthMs);
      }
    }
  }
;
  context.getContentResolver().registerContentObserver(Settings.Global.getUriFor(SETTING_HEADS_UP_SNOOZE_LENGTH_MS),false,mSettingsObserver);
  observer.addOnComputeInternalInsetsListener(this);
}

Fixed version (ground truth):
public HeadsUpManager(final Context context,View statusBarWindowView){
  Resources resources=context.getResources();
  mTouchAcceptanceDelay=resources.getInteger(R.integer.touch_acceptance_delay);
  mSnoozedPackages=new ArrayMap<>();
  mDefaultSnoozeLengthMs=resources.getInteger(R.integer.heads_up_default_snooze_length_ms);
  mSnoozeLengthMs=mDefaultSnoozeLengthMs;
  mMinimumDisplayTime=resources.getInteger(R.integer.heads_up_notification_minimum_time);
  mHeadsUpNotificationDecay=resources.getInteger(R.integer.heads_up_notification_decay);
  mClock=new Clock();
  mSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,mDefaultSnoozeLengthMs);
  mSettingsObserver=new ContentObserver(mHandler){
    @Override public void onChange(    boolean selfChange){
      final int packageSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,-1);
      if (packageSnoozeLengthMs > -1 && packageSnoozeLengthMs != mSnoozeLengthMs) {
        mSnoozeLengthMs=packageSnoozeLengthMs;
        if (DEBUG)         Log.v(TAG,"String_Node_Str" + mSnoozeLengthMs);
      }
    }
  }
;
  context.getContentResolver().registerContentObserver(Settings.Global.getUriFor(SETTING_HEADS_UP_SNOOZE_LENGTH_MS),false,mSettingsObserver);
  mStatusBarWindowView=statusBarWindowView;
  mStatusBarHeight=resources.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
}
Program: 195120
Project: 195120
Buggy source:
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info){
  if (!mIsExpanded && mHasPinnedNotification) {
    int minX=Integer.MAX_VALUE;
    int maxX=0;
    int minY=Integer.MAX_VALUE;
    int maxY=0;
    for (    HeadsUpEntry entry : mSortedEntries) {
      ExpandableNotificationRow row=entry.entry.row;
      if (row.isPinned()) {
        row.getLocationOnScreen(mTmpTwoArray);
        minX=Math.min(minX,mTmpTwoArray[0]);
        minY=Math.min(minY,0);
        maxX=Math.max(maxX,mTmpTwoArray[0] + row.getWidth());
        maxY=Math.max(maxY,row.getHeadsUpHeight());
      }
    }
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(minX,minY,maxX,maxY);
  }
}

Fixed version (ground truth):
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info){
  if (mHasPinnedNotification) {
    int minX=Integer.MAX_VALUE;
    int maxX=0;
    int minY=Integer.MAX_VALUE;
    int maxY=0;
    for (    HeadsUpEntry entry : mSortedEntries) {
      ExpandableNotificationRow row=entry.entry.row;
      if (row.isPinned()) {
        row.getLocationOnScreen(mTmpTwoArray);
        minX=Math.min(minX,mTmpTwoArray[0]);
        minY=Math.min(minY,0);
        maxX=Math.max(maxX,mTmpTwoArray[0] + row.getWidth());
        maxY=Math.max(maxY,row.getHeadsUpHeight());
      }
    }
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(minX,minY,maxX,maxY);
  }
 else   if (mHeadsUpGoingAway || mWaitingOnCollapseWhenGoingAway) {
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(0,0,mStatusBarWindowView.getWidth(),mStatusBarHeight);
  }
}
Program: 195123
Project: 195123
Buggy source:
@Override public ComponentName getHomeActivityForUser(int userId){
synchronized (ActivityManagerService.this) {
    ActivityRecord homeActivity=mStackSupervisor.getHomeActivityForUser(userId);
    return homeActivity.realActivity;
  }
}

Fixed version (ground truth):
@Override public ComponentName getHomeActivityForUser(int userId){
synchronized (ActivityManagerService.this) {
    ActivityRecord homeActivity=mStackSupervisor.getHomeActivityForUser(userId);
    return homeActivity == null ? null : homeActivity.realActivity;
  }
}
Program: 195124
Project: 195124
Buggy source:
private void killBackgroundUserProcessesWithRecordAudioPermission(UserInfo oldUser){
  PackageManager pm=mContext.getPackageManager();
  ComponentName homeActivityName=null;
  if (!oldUser.isManagedProfile()) {
    homeActivityName=LocalServices.getService(ActivityManagerInternal.class).getHomeActivityForUser(oldUser.id);
  }
  final String[] permissions={Manifest.permission.RECORD_AUDIO};
  List<PackageInfo> packages;
  try {
    packages=AppGlobals.getPackageManager().getPackagesHoldingPermissions(permissions,0,oldUser.id).getList();
  }
 catch (  RemoteException e) {
    throw new AndroidRuntimeException(e);
  }
  for (int j=packages.size() - 1; j >= 0; j--) {
    PackageInfo pkg=packages.get(j);
    if (homeActivityName != null && pkg.packageName.equals(homeActivityName.getPackageName()) && pkg.applicationInfo.isSystemApp()) {
      continue;
    }
    try {
      ActivityManagerNative.getDefault().killUid(pkg.applicationInfo.uid,"String_Node_Str");
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
private void killBackgroundUserProcessesWithRecordAudioPermission(UserInfo oldUser){
  PackageManager pm=mContext.getPackageManager();
  ComponentName homeActivityName=null;
  if (!oldUser.isManagedProfile()) {
    homeActivityName=LocalServices.getService(ActivityManagerInternal.class).getHomeActivityForUser(oldUser.id);
  }
  final String[] permissions={Manifest.permission.RECORD_AUDIO};
  List<PackageInfo> packages;
  try {
    packages=AppGlobals.getPackageManager().getPackagesHoldingPermissions(permissions,0,oldUser.id).getList();
  }
 catch (  RemoteException e) {
    throw new AndroidRuntimeException(e);
  }
  for (int j=packages.size() - 1; j >= 0; j--) {
    PackageInfo pkg=packages.get(j);
    if (UserHandle.getAppId(pkg.applicationInfo.uid) < FIRST_APPLICATION_UID) {
      continue;
    }
    if (homeActivityName != null && pkg.packageName.equals(homeActivityName.getPackageName()) && pkg.applicationInfo.isSystemApp()) {
      continue;
    }
    try {
      ActivityManagerNative.getDefault().killUid(pkg.applicationInfo.uid,"String_Node_Str");
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str",e);
    }
  }
}
Program: 195125
Project: 195125
Buggy source:
@Override public ComponentName getHomeActivityForUser(int userId){
synchronized (ActivityManagerService.this) {
    ActivityRecord homeActivity=mStackSupervisor.getHomeActivityForUser(userId);
    return homeActivity.realActivity;
  }
}

Fixed version (ground truth):
@Override public ComponentName getHomeActivityForUser(int userId){
synchronized (ActivityManagerService.this) {
    ActivityRecord homeActivity=mStackSupervisor.getHomeActivityForUser(userId);
    return homeActivity == null ? null : homeActivity.realActivity;
  }
}
Program: 195126
Project: 195126
Buggy source:
private void killBackgroundUserProcessesWithRecordAudioPermission(UserInfo oldUser){
  PackageManager pm=mContext.getPackageManager();
  ComponentName homeActivityName=null;
  if (!oldUser.isManagedProfile()) {
    homeActivityName=LocalServices.getService(ActivityManagerInternal.class).getHomeActivityForUser(oldUser.id);
  }
  final String[] permissions={Manifest.permission.RECORD_AUDIO};
  List<PackageInfo> packages;
  try {
    packages=AppGlobals.getPackageManager().getPackagesHoldingPermissions(permissions,0,oldUser.id).getList();
  }
 catch (  RemoteException e) {
    throw new AndroidRuntimeException(e);
  }
  for (int j=packages.size() - 1; j >= 0; j--) {
    PackageInfo pkg=packages.get(j);
    if (homeActivityName != null && pkg.packageName.equals(homeActivityName.getPackageName()) && pkg.applicationInfo.isSystemApp()) {
      continue;
    }
    try {
      ActivityManagerNative.getDefault().killUid(pkg.applicationInfo.uid,"String_Node_Str");
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
private void killBackgroundUserProcessesWithRecordAudioPermission(UserInfo oldUser){
  PackageManager pm=mContext.getPackageManager();
  ComponentName homeActivityName=null;
  if (!oldUser.isManagedProfile()) {
    homeActivityName=LocalServices.getService(ActivityManagerInternal.class).getHomeActivityForUser(oldUser.id);
  }
  final String[] permissions={Manifest.permission.RECORD_AUDIO};
  List<PackageInfo> packages;
  try {
    packages=AppGlobals.getPackageManager().getPackagesHoldingPermissions(permissions,0,oldUser.id).getList();
  }
 catch (  RemoteException e) {
    throw new AndroidRuntimeException(e);
  }
  for (int j=packages.size() - 1; j >= 0; j--) {
    PackageInfo pkg=packages.get(j);
    if (UserHandle.getAppId(pkg.applicationInfo.uid) < FIRST_APPLICATION_UID) {
      continue;
    }
    if (homeActivityName != null && pkg.packageName.equals(homeActivityName.getPackageName()) && pkg.applicationInfo.isSystemApp()) {
      continue;
    }
    try {
      ActivityManagerNative.getDefault().killUid(pkg.applicationInfo.uid,"String_Node_Str");
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str",e);
    }
  }
}
Program: 195127
Project: 195127
Buggy source:
@Override public ComponentName getHomeActivityForUser(int userId){
synchronized (ActivityManagerService.this) {
    ActivityRecord homeActivity=mStackSupervisor.getHomeActivityForUser(userId);
    return homeActivity.realActivity;
  }
}

Fixed version (ground truth):
@Override public ComponentName getHomeActivityForUser(int userId){
synchronized (ActivityManagerService.this) {
    ActivityRecord homeActivity=mStackSupervisor.getHomeActivityForUser(userId);
    return homeActivity == null ? null : homeActivity.realActivity;
  }
}
Program: 195128
Project: 195128
Buggy source:
private void killBackgroundUserProcessesWithRecordAudioPermission(UserInfo oldUser){
  PackageManager pm=mContext.getPackageManager();
  ComponentName homeActivityName=null;
  if (!oldUser.isManagedProfile()) {
    homeActivityName=LocalServices.getService(ActivityManagerInternal.class).getHomeActivityForUser(oldUser.id);
  }
  final String[] permissions={Manifest.permission.RECORD_AUDIO};
  List<PackageInfo> packages;
  try {
    packages=AppGlobals.getPackageManager().getPackagesHoldingPermissions(permissions,0,oldUser.id).getList();
  }
 catch (  RemoteException e) {
    throw new AndroidRuntimeException(e);
  }
  for (int j=packages.size() - 1; j >= 0; j--) {
    PackageInfo pkg=packages.get(j);
    if (homeActivityName != null && pkg.packageName.equals(homeActivityName.getPackageName()) && pkg.applicationInfo.isSystemApp()) {
      continue;
    }
    try {
      ActivityManagerNative.getDefault().killUid(pkg.applicationInfo.uid,"String_Node_Str");
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
private void killBackgroundUserProcessesWithRecordAudioPermission(UserInfo oldUser){
  PackageManager pm=mContext.getPackageManager();
  ComponentName homeActivityName=null;
  if (!oldUser.isManagedProfile()) {
    homeActivityName=LocalServices.getService(ActivityManagerInternal.class).getHomeActivityForUser(oldUser.id);
  }
  final String[] permissions={Manifest.permission.RECORD_AUDIO};
  List<PackageInfo> packages;
  try {
    packages=AppGlobals.getPackageManager().getPackagesHoldingPermissions(permissions,0,oldUser.id).getList();
  }
 catch (  RemoteException e) {
    throw new AndroidRuntimeException(e);
  }
  for (int j=packages.size() - 1; j >= 0; j--) {
    PackageInfo pkg=packages.get(j);
    if (UserHandle.getAppId(pkg.applicationInfo.uid) < FIRST_APPLICATION_UID) {
      continue;
    }
    if (homeActivityName != null && pkg.packageName.equals(homeActivityName.getPackageName()) && pkg.applicationInfo.isSystemApp()) {
      continue;
    }
    try {
      ActivityManagerNative.getDefault().killUid(pkg.applicationInfo.uid,"String_Node_Str");
    }
 catch (    RemoteException e) {
      Log.w(TAG,"String_Node_Str",e);
    }
  }
}
Program: 195129
Project: 195129
Buggy source:
@Override public void onHeadsUpPinnedModeChanged(boolean inPinnedMode){
  if (inPinnedMode) {
    mStatusBarWindowManager.setHeadsUpShowing(true);
    mStatusBarWindowManager.setForceStatusBarVisible(true);
  }
 else {
    Runnable endRunnable=new Runnable(){
      @Override public void run(){
        if (!mHeadsUpManager.hasPinnedHeadsUp()) {
          mStatusBarWindowManager.setHeadsUpShowing(false);
        }
      }
    }
;
    if (!mNotificationPanel.isFullyCollapsed()) {
      endRunnable.run();
    }
 else {
      mStackScroller.runAfterAnimationFinished(endRunnable);
    }
  }
}

Fixed version (ground truth):
@Override public void onHeadsUpPinnedModeChanged(boolean inPinnedMode){
  if (inPinnedMode) {
    mNotificationPanel.requestLayout();
    mStatusBarWindowManager.setHeadsUpShowing(true);
    mStatusBarWindowManager.setForceStatusBarVisible(true);
    mStatusBarWindowManager.setForceWindowCollapsed(true);
    mNotificationPanel.post(new Runnable(){
      @Override public void run(){
        mStatusBarWindowManager.setForceWindowCollapsed(false);
      }
    }
);
  }
 else {
    if (!mNotificationPanel.isFullyCollapsed()) {
      mStatusBarWindowManager.setHeadsUpShowing(false);
    }
 else {
      mHeadsUpManager.setHeadsUpGoingAway(true);
      mStackScroller.runAfterAnimationFinished(new Runnable(){
        @Override public void run(){
          if (!mHeadsUpManager.hasPinnedHeadsUp()) {
            mStatusBarWindowManager.setHeadsUpShowing(false);
            mHeadsUpManager.setHeadsUpGoingAway(false);
          }
        }
      }
);
    }
  }
}
Program: 195131
Project: 195131
Buggy source:
private void updateHeadsUpScrim(boolean animate){
  float alpha=calculateHeadsUpAlpha();
  ValueAnimator previousAnimator=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_KEY_ANIM);
  float animEndValue=-1;
  if (previousAnimator != null) {
    if (animate || alpha == mCurrentHeadsUpAlpha) {
      previousAnimator.cancel();
    }
    animEndValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_START_ALPHA);
  }
  if (alpha != mCurrentHeadsUpAlpha && alpha != animEndValue) {
    if (animate) {
      startScrimAnimation(mHeadsUpScrim,alpha);
      mHeadsUpScrim.setTag(TAG_HUN_START_ALPHA,mCurrentHeadsUpAlpha);
      mHeadsUpScrim.setTag(TAG_HUN_END_ALPHA,alpha);
    }
 else {
      if (previousAnimator != null) {
        float previousStartValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_START_ALPHA);
        float previousEndValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_END_ALPHA);
        PropertyValuesHolder[] values=previousAnimator.getValues();
        float relativeDiff=alpha - previousEndValue;
        float newStartValue=previousStartValue + relativeDiff;
        values[0].setFloatValues(newStartValue,alpha);
        mHeadsUpScrim.setTag(TAG_HUN_START_ALPHA,newStartValue);
        mHeadsUpScrim.setTag(TAG_HUN_END_ALPHA,alpha);
        previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
      }
 else {
        setCurrentScrimAlpha(mHeadsUpScrim,alpha);
        updateScrimColor(mHeadsUpScrim);
      }
    }
  }
}

Fixed version (ground truth):
private void updateHeadsUpScrim(boolean animate){
  float alpha=calculateHeadsUpAlpha();
  ValueAnimator previousAnimator=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_KEY_ANIM);
  float animEndValue=-1;
  if (previousAnimator != null) {
    if (animate || alpha == mCurrentHeadsUpAlpha) {
      previousAnimator.cancel();
    }
 else {
      animEndValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_END_ALPHA);
    }
  }
  if (alpha != mCurrentHeadsUpAlpha && alpha != animEndValue) {
    if (animate) {
      startScrimAnimation(mHeadsUpScrim,alpha);
      mHeadsUpScrim.setTag(TAG_HUN_START_ALPHA,mCurrentHeadsUpAlpha);
      mHeadsUpScrim.setTag(TAG_HUN_END_ALPHA,alpha);
    }
 else {
      if (previousAnimator != null) {
        float previousStartValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_START_ALPHA);
        float previousEndValue=StackStateAnimator.getChildTag(mHeadsUpScrim,TAG_HUN_END_ALPHA);
        PropertyValuesHolder[] values=previousAnimator.getValues();
        float relativeDiff=alpha - previousEndValue;
        float newStartValue=previousStartValue + relativeDiff;
        values[0].setFloatValues(newStartValue,alpha);
        mHeadsUpScrim.setTag(TAG_HUN_START_ALPHA,newStartValue);
        mHeadsUpScrim.setTag(TAG_HUN_END_ALPHA,alpha);
        previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
      }
 else {
        setCurrentScrimAlpha(mHeadsUpScrim,alpha);
        updateScrimColor(mHeadsUpScrim);
      }
    }
  }
}
Program: 195132
Project: 195132
Buggy source:
private void applyHeight(State state){
  boolean expanded=state.isKeyguardShowingAndNotOccluded() || state.statusBarExpanded || state.keyguardFadingAway|| state.bouncerShowing|| state.headsUpShowing;
  if (expanded) {
    mLpChanged.height=ViewGroup.LayoutParams.MATCH_PARENT;
  }
 else {
    mLpChanged.height=mBarHeight;
  }
}

Fixed version (ground truth):
private void applyHeight(State state){
  boolean expanded=!state.forceCollapsed && (state.isKeyguardShowingAndNotOccluded() || state.statusBarExpanded || state.keyguardFadingAway|| state.bouncerShowing|| state.headsUpShowing);
  if (expanded) {
    mLpChanged.height=ViewGroup.LayoutParams.MATCH_PARENT;
  }
 else {
    mLpChanged.height=mBarHeight;
  }
}
Program: 195133
Project: 195133
Buggy source:
public void setIsExpanded(boolean isExpanded){
  if (isExpanded != mIsExpanded) {
    mIsExpanded=isExpanded;
    if (isExpanded) {
      unpinAll();
    }
  }
}

Fixed version (ground truth):
public void setIsExpanded(boolean isExpanded){
  if (isExpanded != mIsExpanded) {
    mIsExpanded=isExpanded;
    if (isExpanded) {
      unpinAll();
      mWaitingOnCollapseWhenGoingAway=false;
      mHeadsUpGoingAway=false;
      updateTouchableRegionListener();
    }
  }
}
Program: 195134
Project: 195134
Buggy source:
private void updatePinnedMode(){
  boolean hasPinnedNotification=hasPinnedNotificationInternal();
  if (hasPinnedNotification == mHasPinnedNotification) {
    return;
  }
  mHasPinnedNotification=hasPinnedNotification;
  for (  OnHeadsUpChangedListener listener : mListeners) {
    listener.onHeadsUpPinnedModeChanged(hasPinnedNotification);
  }
}

Fixed version (ground truth):
private void updatePinnedMode(){
  boolean hasPinnedNotification=hasPinnedNotificationInternal();
  if (hasPinnedNotification == mHasPinnedNotification) {
    return;
  }
  mHasPinnedNotification=hasPinnedNotification;
  updateTouchableRegionListener();
  for (  OnHeadsUpChangedListener listener : mListeners) {
    listener.onHeadsUpPinnedModeChanged(hasPinnedNotification);
  }
}
Program: 195135
Project: 195135
Buggy source:
public HeadsUpManager(final Context context,ViewTreeObserver observer){
  Resources resources=context.getResources();
  mTouchAcceptanceDelay=resources.getInteger(R.integer.touch_acceptance_delay);
  mSnoozedPackages=new ArrayMap<>();
  mDefaultSnoozeLengthMs=resources.getInteger(R.integer.heads_up_default_snooze_length_ms);
  mSnoozeLengthMs=mDefaultSnoozeLengthMs;
  mMinimumDisplayTime=resources.getInteger(R.integer.heads_up_notification_minimum_time);
  mHeadsUpNotificationDecay=resources.getInteger(R.integer.heads_up_notification_decay);
  mClock=new Clock();
  mSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,mDefaultSnoozeLengthMs);
  mSettingsObserver=new ContentObserver(mHandler){
    @Override public void onChange(    boolean selfChange){
      final int packageSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,-1);
      if (packageSnoozeLengthMs > -1 && packageSnoozeLengthMs != mSnoozeLengthMs) {
        mSnoozeLengthMs=packageSnoozeLengthMs;
        if (DEBUG)         Log.v(TAG,"String_Node_Str" + mSnoozeLengthMs);
      }
    }
  }
;
  context.getContentResolver().registerContentObserver(Settings.Global.getUriFor(SETTING_HEADS_UP_SNOOZE_LENGTH_MS),false,mSettingsObserver);
  observer.addOnComputeInternalInsetsListener(this);
}

Fixed version (ground truth):
public HeadsUpManager(final Context context,View statusBarWindowView){
  Resources resources=context.getResources();
  mTouchAcceptanceDelay=resources.getInteger(R.integer.touch_acceptance_delay);
  mSnoozedPackages=new ArrayMap<>();
  mDefaultSnoozeLengthMs=resources.getInteger(R.integer.heads_up_default_snooze_length_ms);
  mSnoozeLengthMs=mDefaultSnoozeLengthMs;
  mMinimumDisplayTime=resources.getInteger(R.integer.heads_up_notification_minimum_time);
  mHeadsUpNotificationDecay=resources.getInteger(R.integer.heads_up_notification_decay);
  mClock=new Clock();
  mSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,mDefaultSnoozeLengthMs);
  mSettingsObserver=new ContentObserver(mHandler){
    @Override public void onChange(    boolean selfChange){
      final int packageSnoozeLengthMs=Settings.Global.getInt(context.getContentResolver(),SETTING_HEADS_UP_SNOOZE_LENGTH_MS,-1);
      if (packageSnoozeLengthMs > -1 && packageSnoozeLengthMs != mSnoozeLengthMs) {
        mSnoozeLengthMs=packageSnoozeLengthMs;
        if (DEBUG)         Log.v(TAG,"String_Node_Str" + mSnoozeLengthMs);
      }
    }
  }
;
  context.getContentResolver().registerContentObserver(Settings.Global.getUriFor(SETTING_HEADS_UP_SNOOZE_LENGTH_MS),false,mSettingsObserver);
  mStatusBarWindowView=statusBarWindowView;
  mStatusBarHeight=resources.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
}
Program: 195136
Project: 195136
Buggy source:
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info){
  if (!mIsExpanded && mHasPinnedNotification) {
    int minX=Integer.MAX_VALUE;
    int maxX=0;
    int minY=Integer.MAX_VALUE;
    int maxY=0;
    for (    HeadsUpEntry entry : mSortedEntries) {
      ExpandableNotificationRow row=entry.entry.row;
      if (row.isPinned()) {
        row.getLocationOnScreen(mTmpTwoArray);
        minX=Math.min(minX,mTmpTwoArray[0]);
        minY=Math.min(minY,0);
        maxX=Math.max(maxX,mTmpTwoArray[0] + row.getWidth());
        maxY=Math.max(maxY,row.getHeadsUpHeight());
      }
    }
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(minX,minY,maxX,maxY);
  }
}

Fixed version (ground truth):
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info){
  if (mHasPinnedNotification) {
    int minX=Integer.MAX_VALUE;
    int maxX=0;
    int minY=Integer.MAX_VALUE;
    int maxY=0;
    for (    HeadsUpEntry entry : mSortedEntries) {
      ExpandableNotificationRow row=entry.entry.row;
      if (row.isPinned()) {
        row.getLocationOnScreen(mTmpTwoArray);
        minX=Math.min(minX,mTmpTwoArray[0]);
        minY=Math.min(minY,0);
        maxX=Math.max(maxX,mTmpTwoArray[0] + row.getWidth());
        maxY=Math.max(maxY,row.getHeadsUpHeight());
      }
    }
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(minX,minY,maxX,maxY);
  }
 else   if (mHeadsUpGoingAway || mWaitingOnCollapseWhenGoingAway) {
    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
    info.touchableRegion.set(0,0,mStatusBarWindowView.getWidth(),mStatusBarHeight);
  }
}
Program: 195137
Project: 195137
Buggy source:
@Override public ComponentName getHomeActivityForUser(int userId){
synchronized (ActivityManagerService.this) {
    ActivityRecord homeActivity=mStackSupervisor.getHomeActivityForUser(userId);
    return homeActivity.realActivity;
  }
}

Fixed version (ground truth):
@Override public ComponentName getHomeActivityForUser(int userId){
synchronized (ActivityManagerService.this) {
    ActivityRecord homeActivity=mStackSupervisor.getHomeActivityForUser(userId);
    return homeActivity == null ? null : homeActivity.realActivity;
  }
}