nus-yam/ex-repair huggingface dataset:
Program: 195057
Project: 195057
Buggy source:
private int getWordStart(int offset){
  int retOffset=getWordIteratorWithText().prevBoundary(offset);
  if (isPunctBoundaryBehind(retOffset,true)) {
    retOffset=getWordIteratorWithText().prevBoundary(retOffset);
    while (!isPunctBoundaryBehind(retOffset,false) && retOffset != BreakIterator.DONE) {
      retOffset=getWordIteratorWithText().prevBoundary(retOffset);
    }
  }
  if (retOffset == BreakIterator.DONE) {
    return offset;
  }
  return retOffset;
}

Fixed version (ground truth):
private int getWordStart(int offset){
  int retOffset=getWordIteratorWithText().prevBoundary(offset);
  if (getWordIteratorWithText().isOnPunctuation(retOffset)) {
    retOffset=getWordIteratorWithText().getPunctuationBeginning(offset);
  }
 else {
    retOffset=getWordIteratorWithText().getBeginning(offset);
  }
  if (retOffset == BreakIterator.DONE) {
    return offset;
  }
  return retOffset;
}
Program: 195058
Project: 195058
Buggy source:
private int getWordEnd(int offset){
  int retOffset=getWordIteratorWithText().nextBoundary(offset);
  if (isPunctBoundaryForward(retOffset,true)) {
    retOffset=getWordIteratorWithText().nextBoundary(retOffset);
    while (!isPunctBoundaryForward(retOffset,false) && retOffset != BreakIterator.DONE) {
      retOffset=getWordIteratorWithText().nextBoundary(retOffset);
    }
  }
  if (retOffset == BreakIterator.DONE) {
    return offset;
  }
  return retOffset;
}

Fixed version (ground truth):
private int getWordEnd(int offset){
  int retOffset=getWordIteratorWithText().nextBoundary(offset);
  if (getWordIteratorWithText().isAfterPunctuation(retOffset)) {
    retOffset=getWordIteratorWithText().getPunctuationEnd(offset);
  }
 else {
    retOffset=getWordIteratorWithText().getEnd(offset);
  }
  if (retOffset == BreakIterator.DONE) {
    return offset;
  }
  return retOffset;
}
Program: 195059
Project: 195059
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: 195061
Project: 195061
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: 195062
Project: 195062
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: 195063
Project: 195063
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: 195064
Project: 195064
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: 195065
Project: 195065
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: 195066
Project: 195066
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: 195067
Project: 195067
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: 195068
Project: 195068
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: 195070
Project: 195070
Buggy source:
public void install(MenuItem menu){
  assert(mMenu == null);
  mMenu=menu;
  mView=(SearchView)menu.getActionView();
  mMenu.setOnActionExpandListener(this);
  mView.setOnQueryTextListener(this);
  mView.setOnCloseListener(this);
}

Fixed version (ground truth):
public void install(MenuItem menu){
  mMenu=menu;
  mView=(SearchView)menu.getActionView();
  mMenu.setOnActionExpandListener(this);
  mView.setOnQueryTextListener(this);
  mView.setOnCloseListener(this);
}
Program: 195071
Project: 195071
Buggy source:
@Override public boolean onPrepareOptionsMenu(Menu menu){
  super.onPrepareOptionsMenu(menu);
  final RootInfo root=getCurrentRoot();
  final DocumentInfo cwd=getCurrentDirectory();
  final MenuItem createDir=menu.findItem(R.id.menu_create_dir);
  final MenuItem grid=menu.findItem(R.id.menu_grid);
  final MenuItem list=menu.findItem(R.id.menu_list);
  final MenuItem advanced=menu.findItem(R.id.menu_advanced);
  final MenuItem fileSize=menu.findItem(R.id.menu_file_size);
  final MenuItem settings=menu.findItem(R.id.menu_settings);
  boolean fileSizeVisible=!(mState.action == ACTION_MANAGE || mState.action == ACTION_BROWSE);
  if (mState.action == ACTION_CREATE || mState.action == ACTION_OPEN_TREE) {
    createDir.setVisible(cwd != null && cwd.isCreateSupported());
    mSearchManager.showMenu(false);
    if (cwd == null) {
      grid.setVisible(false);
      list.setVisible(false);
      fileSizeVisible=false;
    }
    if (mState.action == ACTION_CREATE) {
      final FragmentManager fm=getFragmentManager();
      SaveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isCreateSupported());
    }
  }
 else {
    createDir.setVisible(false);
  }
  advanced.setVisible(!(mState.action == ACTION_MANAGE || mState.action == ACTION_BROWSE));
  fileSize.setVisible(fileSizeVisible);
  settings.setVisible((mState.action == ACTION_MANAGE || mState.action == ACTION_BROWSE) && (root.flags & Root.FLAG_HAS_SETTINGS) != 0);
  return true;
}

Fixed version (ground truth):
@Override public boolean onPrepareOptionsMenu(Menu menu){
  super.onPrepareOptionsMenu(menu);
  final RootInfo root=getCurrentRoot();
  final DocumentInfo cwd=getCurrentDirectory();
  final MenuItem createDir=menu.findItem(R.id.menu_create_dir);
  final MenuItem grid=menu.findItem(R.id.menu_grid);
  final MenuItem list=menu.findItem(R.id.menu_list);
  final MenuItem advanced=menu.findItem(R.id.menu_advanced);
  final MenuItem fileSize=menu.findItem(R.id.menu_file_size);
  final MenuItem settings=menu.findItem(R.id.menu_settings);
  boolean fileSizeVisible=!(mState.action == ACTION_MANAGE || mState.action == ACTION_BROWSE);
  if (mState.action == ACTION_CREATE || mState.action == ACTION_OPEN_TREE) {
    createDir.setVisible(cwd != null && cwd.isCreateSupported());
    mSearchManager.showMenu(false);
    if (cwd == null) {
      grid.setVisible(false);
      list.setVisible(false);
      fileSizeVisible=false;
    }
    if (mState.action == ACTION_CREATE) {
      final FragmentManager fm=getFragmentManager();
      SaveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isCreateSupported());
    }
  }
 else {
    createDir.setVisible(false);
  }
  advanced.setVisible(!(mState.action == ACTION_MANAGE || mState.action == ACTION_BROWSE) && !mState.forceAdvanced);
  fileSize.setVisible(fileSizeVisible);
  settings.setVisible((mState.action == ACTION_MANAGE || mState.action == ACTION_BROWSE) && (root.flags & Root.FLAG_HAS_SETTINGS) != 0);
  return true;
}
Program: 195072
Project: 195072
Buggy source:
private State buildDefaultState(){
  State state=new State();
  final Intent intent=getIntent();
  state.action=State.ACTION_BROWSE_ALL;
  state.acceptMimes=new String[]{"String_Node_Str"};
  state.allowMultiple=true;
  state.acceptMimes=new String[]{intent.getType()};
  state.localOnly=intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY,false);
  state.forceAdvanced=intent.getBooleanExtra(DocumentsContract.EXTRA_SHOW_ADVANCED,false);
  state.showAdvanced=state.forceAdvanced | LocalPreferences.getDisplayAdvancedDevices(this);
  state.showSize=LocalPreferences.getDisplayFileSize(this);
  final DocumentStack stack=intent.getParcelableExtra(CopyService.EXTRA_STACK);
  if (stack != null)   state.stack=stack;
  return state;
}

Fixed version (ground truth):
private State buildDefaultState(){
  State state=new State();
  final Intent intent=getIntent();
  state.action=State.ACTION_BROWSE_ALL;
  state.acceptMimes=new String[]{"String_Node_Str"};
  state.allowMultiple=true;
  state.acceptMimes=new String[]{intent.getType()};
  Preconditions.checkArgument(!intent.hasExtra(Intent.EXTRA_LOCAL_ONLY));
  Preconditions.checkArgument(!intent.hasExtra(DocumentsContract.EXTRA_SHOW_ADVANCED));
  state.showAdvanced=LocalPreferences.getDisplayAdvancedDevices(this);
  state.showSize=LocalPreferences.getDisplayFileSize(this);
  final DocumentStack stack=intent.getParcelableExtra(CopyService.EXTRA_STACK);
  if (stack != null)   state.stack=stack;
  return state;
}
Program: 195073
Project: 195073
Buggy source:
public void install(MenuItem menu){
  assert(mMenu == null);
  mMenu=menu;
  mView=(SearchView)menu.getActionView();
  mMenu.setOnActionExpandListener(this);
  mView.setOnQueryTextListener(this);
  mView.setOnCloseListener(this);
}

Fixed version (ground truth):
public void install(MenuItem menu){
  mMenu=menu;
  mView=(SearchView)menu.getActionView();
  mMenu.setOnActionExpandListener(this);
  mView.setOnQueryTextListener(this);
  mView.setOnCloseListener(this);
}
Program: 195074
Project: 195074
Buggy source:
@Override public boolean onPrepareOptionsMenu(Menu menu){
  super.onPrepareOptionsMenu(menu);
  final RootInfo root=getCurrentRoot();
  final DocumentInfo cwd=getCurrentDirectory();
  final MenuItem createDir=menu.findItem(R.id.menu_create_dir);
  final MenuItem grid=menu.findItem(R.id.menu_grid);
  final MenuItem list=menu.findItem(R.id.menu_list);
  final MenuItem advanced=menu.findItem(R.id.menu_advanced);
  final MenuItem fileSize=menu.findItem(R.id.menu_file_size);
  final MenuItem settings=menu.findItem(R.id.menu_settings);
  boolean fileSizeVisible=!(mState.action == ACTION_MANAGE || mState.action == ACTION_BROWSE);
  if (mState.action == ACTION_CREATE || mState.action == ACTION_OPEN_TREE) {
    createDir.setVisible(cwd != null && cwd.isCreateSupported());
    mSearchManager.showMenu(false);
    if (cwd == null) {
      grid.setVisible(false);
      list.setVisible(false);
      fileSizeVisible=false;
    }
    if (mState.action == ACTION_CREATE) {
      final FragmentManager fm=getFragmentManager();
      SaveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isCreateSupported());
    }
  }
 else {
    createDir.setVisible(false);
  }
  advanced.setVisible(!(mState.action == ACTION_MANAGE || mState.action == ACTION_BROWSE));
  fileSize.setVisible(fileSizeVisible);
  settings.setVisible((mState.action == ACTION_MANAGE || mState.action == ACTION_BROWSE) && (root.flags & Root.FLAG_HAS_SETTINGS) != 0);
  return true;
}

Fixed version (ground truth):
@Override public boolean onPrepareOptionsMenu(Menu menu){
  super.onPrepareOptionsMenu(menu);
  final RootInfo root=getCurrentRoot();
  final DocumentInfo cwd=getCurrentDirectory();
  final MenuItem createDir=menu.findItem(R.id.menu_create_dir);
  final MenuItem grid=menu.findItem(R.id.menu_grid);
  final MenuItem list=menu.findItem(R.id.menu_list);
  final MenuItem advanced=menu.findItem(R.id.menu_advanced);
  final MenuItem fileSize=menu.findItem(R.id.menu_file_size);
  final MenuItem settings=menu.findItem(R.id.menu_settings);
  boolean fileSizeVisible=!(mState.action == ACTION_MANAGE || mState.action == ACTION_BROWSE);
  if (mState.action == ACTION_CREATE || mState.action == ACTION_OPEN_TREE) {
    createDir.setVisible(cwd != null && cwd.isCreateSupported());
    mSearchManager.showMenu(false);
    if (cwd == null) {
      grid.setVisible(false);
      list.setVisible(false);
      fileSizeVisible=false;
    }
    if (mState.action == ACTION_CREATE) {
      final FragmentManager fm=getFragmentManager();
      SaveFragment.get(fm).setSaveEnabled(cwd != null && cwd.isCreateSupported());
    }
  }
 else {
    createDir.setVisible(false);
  }
  advanced.setVisible(!(mState.action == ACTION_MANAGE || mState.action == ACTION_BROWSE) && !mState.forceAdvanced);
  fileSize.setVisible(fileSizeVisible);
  settings.setVisible((mState.action == ACTION_MANAGE || mState.action == ACTION_BROWSE) && (root.flags & Root.FLAG_HAS_SETTINGS) != 0);
  return true;
}
Program: 195075
Project: 195075
Buggy source:
private State buildDefaultState(){
  State state=new State();
  final Intent intent=getIntent();
  state.action=State.ACTION_BROWSE_ALL;
  state.acceptMimes=new String[]{"String_Node_Str"};
  state.allowMultiple=true;
  state.acceptMimes=new String[]{intent.getType()};
  state.localOnly=intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY,false);
  state.forceAdvanced=intent.getBooleanExtra(DocumentsContract.EXTRA_SHOW_ADVANCED,false);
  state.showAdvanced=state.forceAdvanced | LocalPreferences.getDisplayAdvancedDevices(this);
  state.showSize=LocalPreferences.getDisplayFileSize(this);
  final DocumentStack stack=intent.getParcelableExtra(CopyService.EXTRA_STACK);
  if (stack != null)   state.stack=stack;
  return state;
}

Fixed version (ground truth):
private State buildDefaultState(){
  State state=new State();
  final Intent intent=getIntent();
  state.action=State.ACTION_BROWSE_ALL;
  state.acceptMimes=new String[]{"String_Node_Str"};
  state.allowMultiple=true;
  state.acceptMimes=new String[]{intent.getType()};
  Preconditions.checkArgument(!intent.hasExtra(Intent.EXTRA_LOCAL_ONLY));
  Preconditions.checkArgument(!intent.hasExtra(DocumentsContract.EXTRA_SHOW_ADVANCED));
  state.showAdvanced=LocalPreferences.getDisplayAdvancedDevices(this);
  state.showSize=LocalPreferences.getDisplayFileSize(this);
  final DocumentStack stack=intent.getParcelableExtra(CopyService.EXTRA_STACK);
  if (stack != null)   state.stack=stack;
  return state;
}
Program: 195076
Project: 195076
Buggy source:
@Override public boolean activeServiceSupportsLaunchFromKeyguard() throws RemoteException {
  enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
synchronized (this) {
    return mImpl != null && mImpl.mInfo.getSupportsLaunchFromKeyguard();
  }
}

Fixed version (ground truth):
@Override public boolean activeServiceSupportsLaunchFromKeyguard() throws RemoteException {
  enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
synchronized (this) {
    return mImpl != null && mImpl.mInfo != null && mImpl.mInfo.getSupportsLaunchFromKeyguard();
  }
}
Program: 195077
Project: 195077
Buggy source:
@Override public boolean activeServiceSupportsAssist(){
  enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
synchronized (this) {
    return mImpl != null && mImpl.mInfo.getSupportsAssist();
  }
}

Fixed version (ground truth):
@Override public boolean activeServiceSupportsAssist(){
  enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
synchronized (this) {
    return mImpl != null && mImpl.mInfo != null && mImpl.mInfo.getSupportsAssist();
  }
}
Program: 195078
Project: 195078
Buggy source:
public void setSystemUiVisibility(int vis,int mask){
synchronized (mList) {
    mHandler.removeMessages(MSG_SET_SYSTEMUI_VISIBILITY);
    mHandler.obtainMessage(MSG_SET_SYSTEMUI_VISIBILITY,vis,mask,null).sendToTarget();
  }
}

Fixed version (ground truth):
public void setSystemUiVisibility(int vis,int mask){
synchronized (mList) {
    mHandler.obtainMessage(MSG_SET_SYSTEMUI_VISIBILITY,vis,mask,null).sendToTarget();
  }
}
Program: 195079
Project: 195079
Buggy source:
@Override public void onHeadsUpPinnedModeChanged(boolean inPinnedMode){
  if (inPinnedMode) {
    mStatusBarWindowManager.setHeadsUpShowing(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) {
    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);
    }
  }
}
Program: 195080
Project: 195080
Buggy source:
private void checkBarModes(){
  if (mDemoMode)   return;
  checkBarMode(mStatusBarMode,mStatusBarWindowState,mStatusBarView.getBarTransitions());
  if (mNavigationBarView != null) {
    checkBarMode(mNavigationBarMode,mNavigationBarWindowState,mNavigationBarView.getBarTransitions());
  }
}

Fixed version (ground truth):
private void checkBarModes(){
  if (mDemoMode)   return;
  checkBarMode(mStatusBarMode,mStatusBarWindowState,mStatusBarView.getBarTransitions(),mNoAnimationOnNextBarModeChange);
  if (mNavigationBarView != null) {
    checkBarMode(mNavigationBarMode,mNavigationBarWindowState,mNavigationBarView.getBarTransitions(),mNoAnimationOnNextBarModeChange);
  }
  mNoAnimationOnNextBarModeChange=false;
}
Program: 195081
Project: 195081
Buggy source:
private void checkBarMode(int mode,int windowState,BarTransitions transitions){
  final boolean powerSave=mBatteryController.isPowerSave();
  final boolean anim=(mScreenOn == null || mScreenOn) && windowState != WINDOW_STATE_HIDDEN && !powerSave;
  if (powerSave && getBarState() == StatusBarState.SHADE) {
    mode=MODE_WARNING;
  }
  transitions.transitionTo(mode,anim);
}

Fixed version (ground truth):
private void checkBarMode(int mode,int windowState,BarTransitions transitions,boolean noAnimation){
  final boolean powerSave=mBatteryController.isPowerSave();
  final boolean anim=!noAnimation && (mScreenOn == null || mScreenOn) && windowState != WINDOW_STATE_HIDDEN && !powerSave;
  if (powerSave && getBarState() == StatusBarState.SHADE) {
    mode=MODE_WARNING;
  }
  transitions.transitionTo(mode,anim);
}
Program: 195084
Project: 195084
Buggy source:
void makeExpandedInvisible(){
  if (SPEW)   Log.d(TAG,"String_Node_Str" + mExpandedVisible + "String_Node_Str"+ mExpandedVisible);
  if (!mExpandedVisible || mStatusBarWindow == null) {
    return;
  }
  mStatusBarView.collapseAllPanels(false,false,1.0f);
  mNotificationPanel.closeQs();
  mExpandedVisible=false;
  if (mNavigationBarView != null)   mNavigationBarView.setSlippery(false);
  visibilityChanged(false);
  mStatusBarWindowManager.setStatusBarExpanded(false);
  mStatusBarView.setFocusable(true);
  dismissPopups();
  runPostCollapseRunnables();
  setInteracting(StatusBarManager.WINDOW_STATUS_BAR,false);
  showBouncer();
  disable(mDisabledUnmodified1,mDisabledUnmodified2,true);
  if (!mStatusBarKeyguardViewManager.isShowing()) {
    WindowManagerGlobal.getInstance().trimMemory(ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN);
  }
}

Fixed version (ground truth):
void makeExpandedInvisible(){
  if (SPEW)   Log.d(TAG,"String_Node_Str" + mExpandedVisible + "String_Node_Str"+ mExpandedVisible);
  if (!mExpandedVisible || mStatusBarWindow == null) {
    return;
  }
  mStatusBarView.collapseAllPanels(false,false,1.0f);
  mNotificationPanel.closeQs();
  mExpandedVisible=false;
  if (mNavigationBarView != null)   mNavigationBarView.setSlippery(false);
  visibilityChanged(false);
  mStatusBarWindowManager.setStatusBarExpanded(false);
  mStatusBarWindowManager.setForceStatusBarVisible(false);
  mStatusBarView.setFocusable(true);
  dismissPopups();
  runPostCollapseRunnables();
  setInteracting(StatusBarManager.WINDOW_STATUS_BAR,false);
  showBouncer();
  disable(mDisabledUnmodified1,mDisabledUnmodified2,true);
  if (!mStatusBarKeyguardViewManager.isShowing()) {
    WindowManagerGlobal.getInstance().trimMemory(ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN);
  }
}
Program: 195085
Project: 195085
Buggy source:
private void apply(State state){
  applyKeyguardFlags(state);
  applyFocusableFlag(state);
  adjustScreenOrientation(state);
  applyHeight(state);
  applyUserActivityTimeout(state);
  applyInputFeatures(state);
  applyFitsSystemWindows(state);
  applyModalFlag(state);
  if (mLp.copyFrom(mLpChanged) != 0) {
    mWindowManager.updateViewLayout(mStatusBarView,mLp);
  }
}

Fixed version (ground truth):
private void apply(State state){
  applyKeyguardFlags(state);
  applyForceStatusBarVisibleFlag(state);
  applyFocusableFlag(state);
  adjustScreenOrientation(state);
  applyHeight(state);
  applyUserActivityTimeout(state);
  applyInputFeatures(state);
  applyFitsSystemWindows(state);
  applyModalFlag(state);
  if (mLp.copyFrom(mLpChanged) != 0) {
    mWindowManager.updateViewLayout(mStatusBarView,mLp);
  }
}
Program: 195086
Project: 195086
Buggy source:
public int updateVisibilityLw(boolean transientAllowed,int oldVis,int vis){
  if (mWin == null)   return vis;
  if (isTransientShowing() || isTransientShowRequested()) {
    if (transientAllowed) {
      vis|=mTransientFlag;
      if ((oldVis & mTransientFlag) == 0) {
        vis|=mUnhideFlag;
      }
      setTransientBarState(TRANSIENT_BAR_SHOWING);
    }
 else {
      setTransientBarState(TRANSIENT_BAR_NONE);
    }
  }
  if (mTransientBarState != TRANSIENT_BAR_NONE) {
    vis|=mTransientFlag;
    vis&=~View.SYSTEM_UI_FLAG_LOW_PROFILE;
  }
  if ((vis & mTranslucentFlag) != 0 || (oldVis & mTranslucentFlag) != 0 || ((vis | oldVis) & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0) {
    mLastTranslucent=SystemClock.uptimeMillis();
  }
  return vis;
}

Fixed version (ground truth):
public int updateVisibilityLw(boolean transientAllowed,int oldVis,int vis){
  if (mWin == null)   return vis;
  if (isTransientShowing() || isTransientShowRequested()) {
    if (transientAllowed) {
      vis|=mTransientFlag;
      if ((oldVis & mTransientFlag) == 0) {
        vis|=mUnhideFlag;
      }
      setTransientBarState(TRANSIENT_BAR_SHOWING);
    }
 else {
      setTransientBarState(TRANSIENT_BAR_NONE);
    }
  }
  if (mShowTransparent) {
    vis|=View.SYSTEM_UI_TRANSPARENT;
    if (mSetUnHideFlagWhenNextTransparent) {
      vis|=mUnhideFlag;
      mSetUnHideFlagWhenNextTransparent=false;
    }
  }
  if (mTransientBarState != TRANSIENT_BAR_NONE) {
    vis|=mTransientFlag;
    vis&=~View.SYSTEM_UI_FLAG_LOW_PROFILE;
  }
  if ((vis & mTranslucentFlag) != 0 || (oldVis & mTranslucentFlag) != 0 || ((vis | oldVis) & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0) {
    mLastTranslucent=SystemClock.uptimeMillis();
  }
  return vis;
}
Program: 195087
Project: 195087
Buggy source:
public boolean setBarShowingLw(final boolean show){
  if (mWin == null)   return false;
  if (show && mTransientBarState == TRANSIENT_BAR_HIDING) {
    mPendingShow=true;
    return false;
  }
  final boolean wasVis=mWin.isVisibleLw();
  final boolean wasAnim=mWin.isAnimatingLw();
  final boolean change=show ? mWin.showLw(true) : mWin.hideLw(true);
  final int state=computeStateLw(wasVis,wasAnim,mWin,change);
  final boolean stateChanged=updateStateLw(state);
  return change || stateChanged;
}

Fixed version (ground truth):
public boolean setBarShowingLw(final boolean show){
  if (mWin == null)   return false;
  if (show && mTransientBarState == TRANSIENT_BAR_HIDING) {
    mPendingShow=true;
    return false;
  }
  final boolean wasVis=mWin.isVisibleLw();
  final boolean wasAnim=mWin.isAnimatingLw();
  final boolean change=show ? mWin.showLw(!mNoAnimationOnNextShow) : mWin.hideLw(!mNoAnimationOnNextShow);
  mNoAnimationOnNextShow=false;
  final int state=computeStateLw(wasVis,wasAnim,mWin,change);
  final boolean stateChanged=updateStateLw(state);
  return change || stateChanged;
}
Program: 195088
Project: 195088
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public void beginPostLayoutPolicyLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mTopFullscreenOpaqueOrDimmingWindowState=null;
  mAppsToBeHidden.clear();
  mAppsThatDismissKeyguard.clear();
  mForceStatusBar=false;
  mForceStatusBarFromKeyguard=false;
  mForcingShowNavBar=false;
  mForcingShowNavBarLayer=-1;
  mHideLockScreen=false;
  mAllowLockscreenWhenOn=false;
  mDismissKeyguard=DISMISS_KEYGUARD_NONE;
  mShowingLockscreen=false;
  mShowingDream=false;
  mWinShowWhenLocked=null;
  mKeyguardSecure=isKeyguardSecure();
  mKeyguardSecureIncludingHidden=mKeyguardSecure && (mKeyguardDelegate != null && mKeyguardDelegate.isShowing());
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public void beginPostLayoutPolicyLw(int displayWidth,int displayHeight){
  mTopFullscreenOpaqueWindowState=null;
  mTopFullscreenOpaqueOrDimmingWindowState=null;
  mAppsToBeHidden.clear();
  mAppsThatDismissKeyguard.clear();
  mForceStatusBar=false;
  mForceStatusBarFromKeyguard=false;
  mForceStatusBarTransparent=false;
  mForcingShowNavBar=false;
  mForcingShowNavBarLayer=-1;
  mHideLockScreen=false;
  mAllowLockscreenWhenOn=false;
  mDismissKeyguard=DISMISS_KEYGUARD_NONE;
  mShowingLockscreen=false;
  mShowingDream=false;
  mWinShowWhenLocked=null;
  mKeyguardSecure=isKeyguardSecure();
  mKeyguardSecureIncludingHidden=mKeyguardSecure && (mKeyguardDelegate != null && mKeyguardDelegate.isShowing());
}
Program: 195092
Project: 195092
Buggy source:
private int getMaxAllowedChildHeight(View child,AmbientState ambientState){
  if (child instanceof ExpandableNotificationRow) {
    ExpandableNotificationRow row=(ExpandableNotificationRow)child;
    if (ambientState == null && row.isHeadsUp() || ambientState != null && ambientState.getTopHeadsUpEntry() == child) {
      int extraSize=row.getIntrinsicHeight() - row.getHeadsUpHeight();
      return mCollapsedSize + extraSize;
    }
    return row.getIntrinsicHeight();
  }
 else   if (child instanceof ExpandableView) {
    ExpandableView expandableView=(ExpandableView)child;
    return expandableView.getActualHeight();
  }
  return child == null ? mCollapsedSize : child.getHeight();
}

Fixed version (ground truth):
private int getMaxAllowedChildHeight(View child,AmbientState ambientState){
  if (child instanceof ExpandableNotificationRow) {
    ExpandableNotificationRow row=(ExpandableNotificationRow)child;
    if (ambientState == null && row.isHeadsUp() || ambientState != null && ambientState.getTopHeadsUpEntry() == child) {
      int extraSize=row.getIntrinsicHeight() - row.getHeadsUpHeight();
      return mCollapsedSize + extraSize;
    }
    return row.getIntrinsicHeight();
  }
 else   if (child instanceof ExpandableView) {
    ExpandableView expandableView=(ExpandableView)child;
    return expandableView.getIntrinsicHeight();
  }
  return child == null ? mCollapsedSize : child.getHeight();
}
Program: 195093
Project: 195093
Buggy source:
private int getWordStart(int offset){
  int retOffset=getWordIteratorWithText().prevBoundary(offset);
  if (isPunctBoundaryBehind(retOffset,true)) {
    retOffset=getWordIteratorWithText().prevBoundary(retOffset);
    while (!isPunctBoundaryBehind(retOffset,false) && retOffset != BreakIterator.DONE) {
      retOffset=getWordIteratorWithText().prevBoundary(retOffset);
    }
  }
  if (retOffset == BreakIterator.DONE) {
    return offset;
  }
  return retOffset;
}

Fixed version (ground truth):
private int getWordStart(int offset){
  int retOffset=getWordIteratorWithText().prevBoundary(offset);
  if (getWordIteratorWithText().isOnPunctuation(retOffset)) {
    retOffset=getWordIteratorWithText().getPunctuationBeginning(offset);
  }
 else {
    retOffset=getWordIteratorWithText().getBeginning(offset);
  }
  if (retOffset == BreakIterator.DONE) {
    return offset;
  }
  return retOffset;
}
Program: 195094
Project: 195094
Buggy source:
private int getWordEnd(int offset){
  int retOffset=getWordIteratorWithText().nextBoundary(offset);
  if (isPunctBoundaryForward(retOffset,true)) {
    retOffset=getWordIteratorWithText().nextBoundary(retOffset);
    while (!isPunctBoundaryForward(retOffset,false) && retOffset != BreakIterator.DONE) {
      retOffset=getWordIteratorWithText().nextBoundary(retOffset);
    }
  }
  if (retOffset == BreakIterator.DONE) {
    return offset;
  }
  return retOffset;
}

Fixed version (ground truth):
private int getWordEnd(int offset){
  int retOffset=getWordIteratorWithText().nextBoundary(offset);
  if (getWordIteratorWithText().isAfterPunctuation(retOffset)) {
    retOffset=getWordIteratorWithText().getPunctuationEnd(offset);
  }
 else {
    retOffset=getWordIteratorWithText().getEnd(offset);
  }
  if (retOffset == BreakIterator.DONE) {
    return offset;
  }
  return retOffset;
}
Program: 195095
Project: 195095
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: 195097
Project: 195097
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: 195098
Project: 195098
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: 195099
Project: 195099
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: 195100
Project: 195100
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);
  }
}