nus-yam/ex-repair huggingface dataset:
Program: 83741
Project: 83741
Buggy source:
void closeSystemDialogs(){
  closeAllApps(false);
  getWindow().closeAllPanels();
  try {
    dismissDialog(DIALOG_CREATE_SHORTCUT);
  }
 catch (  Exception e) {
  }
  try {
    dismissDialog(DIALOG_RENAME_FOLDER);
  }
 catch (  Exception e) {
  }
  mWaitingForResult=false;
}

Fixed version (ground truth):
void closeSystemDialogs(){
  closeAllApps(true);
  getWindow().closeAllPanels();
  try {
    dismissDialog(DIALOG_CREATE_SHORTCUT);
  }
 catch (  Exception e) {
  }
  try {
    dismissDialog(DIALOG_RENAME_FOLDER);
  }
 catch (  Exception e) {
  }
  mWaitingForResult=false;
}
Program: 83742
Project: 83742
Buggy source:
void moveToDefaultScreen(){
  snapToScreen(mDefaultScreen);
  getChildAt(mDefaultScreen).requestFocus();
}

Fixed version (ground truth):
void moveToDefaultScreen(boolean animate){
  snapToScreen(mDefaultScreen,animate);
  getChildAt(mDefaultScreen).requestFocus();
}
Program: 83743
Project: 83743
Buggy source:
void snapToScreen(int whichScreen){
  whichScreen=Math.max(0,Math.min(whichScreen,getChildCount() - 1));
  clearVacantCache();
  enableChildrenCache(mCurrentScreen,whichScreen);
  final int screenDelta=Math.abs(whichScreen - mCurrentScreen);
  mNextScreen=whichScreen;
  mPreviousIndicator.setLevel(mNextScreen);
  mNextIndicator.setLevel(mNextScreen);
  View focusedChild=getFocusedChild();
  if (focusedChild != null && screenDelta != 0 && focusedChild == getChildAt(mCurrentScreen)) {
    focusedChild.clearFocus();
  }
  final int newX=whichScreen * getWidth();
  final int delta=newX - mScrollX;
  final int duration=screenDelta * 300;
  awakenScrollBars(duration);
  mScroller.startScroll(mScrollX,0,delta,0,duration);
  invalidate();
}

Fixed version (ground truth):
void snapToScreen(int whichScreen,boolean animate){
  whichScreen=Math.max(0,Math.min(whichScreen,getChildCount() - 1));
  clearVacantCache();
  enableChildrenCache(mCurrentScreen,whichScreen);
  final int screenDelta=Math.abs(whichScreen - mCurrentScreen);
  mNextScreen=whichScreen;
  mPreviousIndicator.setLevel(mNextScreen);
  mNextIndicator.setLevel(mNextScreen);
  View focusedChild=getFocusedChild();
  if (focusedChild != null && screenDelta != 0 && focusedChild == getChildAt(mCurrentScreen)) {
    focusedChild.clearFocus();
  }
  final int newX=whichScreen * getWidth();
  final int delta=newX - mScrollX;
  final int duration=screenDelta * 300;
  awakenScrollBars(duration);
  mScroller.startScroll(mScrollX,0,delta,0,animate ? duration : 1);
  invalidate();
}
Program: 83745
Project: 83745
Buggy source:
@Override public boolean dispatchKeyEvent(KeyEvent event){
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
      return true;
case KeyEvent.KEYCODE_HOME:
    return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
  if (SystemProperties.getInt("String_Node_Str",0) != 0) {
    dumpState();
    return true;
  }
break;
}
}
 else if (event.getAction() == KeyEvent.ACTION_UP) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (!event.isCanceled()) {
mWorkspace.dispatchKeyEvent(event);
if (isAllAppsVisible()) {
  closeAllApps(true);
}
 else {
  closeFolder();
}
dismissPreview(mPreviousView);
dismissPreview(mNextView);
}
return true;
case KeyEvent.KEYCODE_HOME:
return true;
}
}
return super.dispatchKeyEvent(event);
}

Fixed version (ground truth):
@Override public boolean dispatchKeyEvent(KeyEvent event){
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
      return true;
case KeyEvent.KEYCODE_HOME:
    return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
  if (SystemProperties.getInt("String_Node_Str",0) != 0) {
    dumpState();
    return true;
  }
break;
}
}
 else if (event.getAction() == KeyEvent.ACTION_UP) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (event.isTracking() && !event.isCanceled()) {
mWorkspace.dispatchKeyEvent(event);
if (isAllAppsVisible()) {
  closeAllApps(true);
}
 else {
  closeFolder();
}
dismissPreview(mPreviousView);
dismissPreview(mNextView);
}
return true;
case KeyEvent.KEYCODE_HOME:
return true;
}
}
return super.dispatchKeyEvent(event);
}
Program: 83746
Project: 83746
Buggy source:
@Override public boolean dispatchKeyEvent(KeyEvent event){
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
      return true;
case KeyEvent.KEYCODE_HOME:
    return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
  if (SystemProperties.getInt("String_Node_Str",0) != 0) {
    dumpState();
    return true;
  }
break;
}
}
 else if (event.getAction() == KeyEvent.ACTION_UP) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (!event.isCanceled()) {
mWorkspace.dispatchKeyEvent(event);
if (isAllAppsVisible()) {
  closeAllApps(true);
}
 else {
  closeFolder();
}
dismissPreview(mPreviousView);
dismissPreview(mNextView);
}
return true;
case KeyEvent.KEYCODE_HOME:
return true;
}
}
return super.dispatchKeyEvent(event);
}

Fixed version (ground truth):
@Override public boolean dispatchKeyEvent(KeyEvent event){
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
      return true;
case KeyEvent.KEYCODE_HOME:
    return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
  if (SystemProperties.getInt("String_Node_Str",0) != 0) {
    dumpState();
    return true;
  }
break;
}
}
 else if (event.getAction() == KeyEvent.ACTION_UP) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (event.isTracking() && !event.isCanceled()) {
mWorkspace.dispatchKeyEvent(event);
if (isAllAppsVisible()) {
  closeAllApps(true);
}
 else {
  closeFolder();
}
dismissPreview(mPreviousView);
dismissPreview(mNextView);
}
return true;
case KeyEvent.KEYCODE_HOME:
return true;
}
}
return super.dispatchKeyEvent(event);
}
Program: 83747
Project: 83747
Buggy source:
@Override public boolean dispatchKeyEvent(KeyEvent event){
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
      return true;
case KeyEvent.KEYCODE_HOME:
    return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
  if (SystemProperties.getInt("String_Node_Str",0) != 0) {
    dumpState();
    return true;
  }
break;
}
}
 else if (event.getAction() == KeyEvent.ACTION_UP) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (!event.isCanceled()) {
mWorkspace.dispatchKeyEvent(event);
if (isAllAppsVisible()) {
  closeAllApps(true);
}
 else {
  closeFolder();
}
dismissPreview(mPreviousView);
dismissPreview(mNextView);
}
return true;
case KeyEvent.KEYCODE_HOME:
return true;
}
}
return super.dispatchKeyEvent(event);
}

Fixed version (ground truth):
@Override public boolean dispatchKeyEvent(KeyEvent event){
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
      return true;
case KeyEvent.KEYCODE_HOME:
    return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
  if (SystemProperties.getInt("String_Node_Str",0) != 0) {
    dumpState();
    return true;
  }
break;
}
}
 else if (event.getAction() == KeyEvent.ACTION_UP) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (event.isTracking() && !event.isCanceled()) {
mWorkspace.dispatchKeyEvent(event);
if (isAllAppsVisible()) {
  closeAllApps(true);
}
 else {
  closeFolder();
}
dismissPreview(mPreviousView);
dismissPreview(mNextView);
}
return true;
case KeyEvent.KEYCODE_HOME:
return true;
}
}
return super.dispatchKeyEvent(event);
}
Program: 83748
Project: 83748
Buggy source:
private void bindAllApps(){
synchronized (mLock) {
    final ArrayList<ApplicationInfo> results=mAllAppsList.added;
    mAllAppsList.added=new ArrayList<ApplicationInfo>();
    mHandler.post(new Runnable(){
      public void run(){
        final long t=SystemClock.uptimeMillis();
        final int count=results.size();
        Callbacks callbacks=tryGetCallbacks();
        if (callbacks != null) {
          callbacks.bindAllApplications(results);
        }
        if (DEBUG_LOADERS) {
          Log.d(TAG,"String_Node_Str" + count + "String_Node_Str"+ (SystemClock.uptimeMillis() - t)+ "String_Node_Str");
        }
      }
    }
);
  }
}

Fixed version (ground truth):
private void bindAllApps(){
synchronized (mLock) {
    final ArrayList<ApplicationInfo> results=(ArrayList<ApplicationInfo>)mAllAppsList.data.clone();
    mAllAppsList.added=new ArrayList<ApplicationInfo>();
    mHandler.post(new Runnable(){
      public void run(){
        final long t=SystemClock.uptimeMillis();
        final int count=results.size();
        Callbacks callbacks=tryGetCallbacks();
        if (callbacks != null) {
          callbacks.bindAllApplications(results);
        }
        if (DEBUG_LOADERS) {
          Log.d(TAG,"String_Node_Str" + count + "String_Node_Str"+ (SystemClock.uptimeMillis() - t)+ "String_Node_Str");
        }
      }
    }
);
  }
}
Program: 83749
Project: 83749
Buggy source:
@Override public boolean dispatchKeyEvent(KeyEvent event){
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
      return true;
case KeyEvent.KEYCODE_HOME:
    return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
  if (SystemProperties.getInt("String_Node_Str",0) != 0) {
    dumpState();
    return true;
  }
break;
}
}
 else if (event.getAction() == KeyEvent.ACTION_UP) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (!event.isCanceled()) {
mWorkspace.dispatchKeyEvent(event);
if (isAllAppsVisible()) {
  closeAllApps(true);
}
 else {
  closeFolder();
}
dismissPreview(mPreviousView);
dismissPreview(mNextView);
}
return true;
case KeyEvent.KEYCODE_HOME:
return true;
}
}
return super.dispatchKeyEvent(event);
}

Fixed version (ground truth):
@Override public boolean dispatchKeyEvent(KeyEvent event){
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
      return true;
case KeyEvent.KEYCODE_HOME:
    return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
  if (SystemProperties.getInt("String_Node_Str",0) != 0) {
    dumpState();
    return true;
  }
break;
}
}
 else if (event.getAction() == KeyEvent.ACTION_UP) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (event.isTracking() && !event.isCanceled()) {
mWorkspace.dispatchKeyEvent(event);
if (isAllAppsVisible()) {
  closeAllApps(true);
}
 else {
  closeFolder();
}
dismissPreview(mPreviousView);
dismissPreview(mNextView);
}
return true;
case KeyEvent.KEYCODE_HOME:
return true;
}
}
return super.dispatchKeyEvent(event);
}
Program: 83750
Project: 83750
Buggy source:
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (Intent.ACTION_MAIN.equals(intent.getAction())) {
    closeSystemDialogs();
    mWaitingForResult=false;
    mIsNewIntent=true;
    if (!mWorkspace.isDefaultScreenShowing()) {
      mWorkspace.moveToDefaultScreen();
    }
    closeAllApps(false);
    final View v=getWindow().peekDecorView();
    if (v != null && v.getWindowToken() != null) {
      InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(v.getWindowToken(),0);
    }
  }
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (Intent.ACTION_MAIN.equals(intent.getAction())) {
    closeSystemDialogs();
    mIsNewIntent=true;
    if (!mWorkspace.isDefaultScreenShowing()) {
      mWorkspace.moveToDefaultScreen();
    }
    closeAllApps(false);
    final View v=getWindow().peekDecorView();
    if (v != null && v.getWindowToken() != null) {
      InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(v.getWindowToken(),0);
    }
  }
}
Program: 83751
Project: 83751
Buggy source:
void closeSystemDialogs(){
  closeAllApps(false);
  getWindow().closeAllPanels();
  try {
    dismissDialog(DIALOG_CREATE_SHORTCUT);
  }
 catch (  Exception e) {
  }
  try {
    dismissDialog(DIALOG_RENAME_FOLDER);
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
void closeSystemDialogs(){
  closeAllApps(false);
  getWindow().closeAllPanels();
  try {
    dismissDialog(DIALOG_CREATE_SHORTCUT);
  }
 catch (  Exception e) {
  }
  try {
    dismissDialog(DIALOG_RENAME_FOLDER);
  }
 catch (  Exception e) {
  }
  mWaitingForResult=false;
}
Program: 83752
Project: 83752
Buggy source:
private void bindAllApps(){
synchronized (mLock) {
    final ArrayList<ApplicationInfo> results=mAllAppsList.added;
    mAllAppsList.added=new ArrayList<ApplicationInfo>();
    mHandler.post(new Runnable(){
      public void run(){
        final long t=SystemClock.uptimeMillis();
        final int count=results.size();
        Callbacks callbacks=tryGetCallbacks();
        if (callbacks != null) {
          callbacks.bindAllApplications(results);
        }
        if (DEBUG_LOADERS) {
          Log.d(TAG,"String_Node_Str" + count + "String_Node_Str"+ (SystemClock.uptimeMillis() - t)+ "String_Node_Str");
        }
      }
    }
);
  }
}

Fixed version (ground truth):
private void bindAllApps(){
synchronized (mLock) {
    final ArrayList<ApplicationInfo> results=(ArrayList<ApplicationInfo>)mAllAppsList.data.clone();
    mAllAppsList.added=new ArrayList<ApplicationInfo>();
    mHandler.post(new Runnable(){
      public void run(){
        final long t=SystemClock.uptimeMillis();
        final int count=results.size();
        Callbacks callbacks=tryGetCallbacks();
        if (callbacks != null) {
          callbacks.bindAllApplications(results);
        }
        if (DEBUG_LOADERS) {
          Log.d(TAG,"String_Node_Str" + count + "String_Node_Str"+ (SystemClock.uptimeMillis() - t)+ "String_Node_Str");
        }
      }
    }
);
  }
}
Program: 83753
Project: 83753
Buggy source:
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (Intent.ACTION_MAIN.equals(intent.getAction())) {
    closeSystemDialogs();
    mIsNewIntent=true;
    if (!mWorkspace.isDefaultScreenShowing()) {
      mWorkspace.moveToDefaultScreen();
    }
    closeAllApps(false);
    final View v=getWindow().peekDecorView();
    if (v != null && v.getWindowToken() != null) {
      InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(v.getWindowToken(),0);
    }
  }
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (Intent.ACTION_MAIN.equals(intent.getAction())) {
    closeSystemDialogs();
    mIsNewIntent=true;
    boolean alreadyOnHome=((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
    boolean allAppsVisible=isAllAppsVisible();
    if (!mWorkspace.isDefaultScreenShowing()) {
      mWorkspace.moveToDefaultScreen(alreadyOnHome && !allAppsVisible);
    }
    closeAllApps(alreadyOnHome && allAppsVisible);
    final View v=getWindow().peekDecorView();
    if (v != null && v.getWindowToken() != null) {
      InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(v.getWindowToken(),0);
    }
  }
}
Program: 83754
Project: 83754
Buggy source:
void closeSystemDialogs(){
  closeAllApps(false);
  getWindow().closeAllPanels();
  try {
    dismissDialog(DIALOG_CREATE_SHORTCUT);
  }
 catch (  Exception e) {
  }
  try {
    dismissDialog(DIALOG_RENAME_FOLDER);
  }
 catch (  Exception e) {
  }
  mWaitingForResult=false;
}

Fixed version (ground truth):
void closeSystemDialogs(){
  closeAllApps(true);
  getWindow().closeAllPanels();
  try {
    dismissDialog(DIALOG_CREATE_SHORTCUT);
  }
 catch (  Exception e) {
  }
  try {
    dismissDialog(DIALOG_RENAME_FOLDER);
  }
 catch (  Exception e) {
  }
  mWaitingForResult=false;
}
Program: 83755
Project: 83755
Buggy source:
void moveToDefaultScreen(){
  snapToScreen(mDefaultScreen);
  getChildAt(mDefaultScreen).requestFocus();
}

Fixed version (ground truth):
void moveToDefaultScreen(boolean animate){
  snapToScreen(mDefaultScreen,animate);
  getChildAt(mDefaultScreen).requestFocus();
}
Program: 83756
Project: 83756
Buggy source:
void snapToScreen(int whichScreen){
  whichScreen=Math.max(0,Math.min(whichScreen,getChildCount() - 1));
  clearVacantCache();
  enableChildrenCache(mCurrentScreen,whichScreen);
  final int screenDelta=Math.abs(whichScreen - mCurrentScreen);
  mNextScreen=whichScreen;
  mPreviousIndicator.setLevel(mNextScreen);
  mNextIndicator.setLevel(mNextScreen);
  View focusedChild=getFocusedChild();
  if (focusedChild != null && screenDelta != 0 && focusedChild == getChildAt(mCurrentScreen)) {
    focusedChild.clearFocus();
  }
  final int newX=whichScreen * getWidth();
  final int delta=newX - mScrollX;
  final int duration=screenDelta * 300;
  awakenScrollBars(duration);
  mScroller.startScroll(mScrollX,0,delta,0,duration);
  invalidate();
}

Fixed version (ground truth):
void snapToScreen(int whichScreen,boolean animate){
  whichScreen=Math.max(0,Math.min(whichScreen,getChildCount() - 1));
  clearVacantCache();
  enableChildrenCache(mCurrentScreen,whichScreen);
  final int screenDelta=Math.abs(whichScreen - mCurrentScreen);
  mNextScreen=whichScreen;
  mPreviousIndicator.setLevel(mNextScreen);
  mNextIndicator.setLevel(mNextScreen);
  View focusedChild=getFocusedChild();
  if (focusedChild != null && screenDelta != 0 && focusedChild == getChildAt(mCurrentScreen)) {
    focusedChild.clearFocus();
  }
  final int newX=whichScreen * getWidth();
  final int delta=newX - mScrollX;
  final int duration=screenDelta * 300;
  awakenScrollBars(duration);
  mScroller.startScroll(mScrollX,0,delta,0,animate ? duration : 1);
  invalidate();
}
Program: 83757
Project: 83757
Buggy source:
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (Intent.ACTION_MAIN.equals(intent.getAction())) {
    closeSystemDialogs();
    mWaitingForResult=false;
    mIsNewIntent=true;
    if (!mWorkspace.isDefaultScreenShowing()) {
      mWorkspace.moveToDefaultScreen();
    }
    closeAllApps(false);
    final View v=getWindow().peekDecorView();
    if (v != null && v.getWindowToken() != null) {
      InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(v.getWindowToken(),0);
    }
  }
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (Intent.ACTION_MAIN.equals(intent.getAction())) {
    closeSystemDialogs();
    mIsNewIntent=true;
    if (!mWorkspace.isDefaultScreenShowing()) {
      mWorkspace.moveToDefaultScreen();
    }
    closeAllApps(false);
    final View v=getWindow().peekDecorView();
    if (v != null && v.getWindowToken() != null) {
      InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(v.getWindowToken(),0);
    }
  }
}
Program: 83758
Project: 83758
Buggy source:
void closeSystemDialogs(){
  closeAllApps(false);
  getWindow().closeAllPanels();
  try {
    dismissDialog(DIALOG_CREATE_SHORTCUT);
  }
 catch (  Exception e) {
  }
  try {
    dismissDialog(DIALOG_RENAME_FOLDER);
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
void closeSystemDialogs(){
  closeAllApps(false);
  getWindow().closeAllPanels();
  try {
    dismissDialog(DIALOG_CREATE_SHORTCUT);
  }
 catch (  Exception e) {
  }
  try {
    dismissDialog(DIALOG_RENAME_FOLDER);
  }
 catch (  Exception e) {
  }
  mWaitingForResult=false;
}
Program: 83759
Project: 83759
Buggy source:
public boolean onLongClick(View v){
switch (v.getId()) {
case R.id.previous_screen:
    showPreviousPreview(v);
  return true;
case R.id.next_screen:
showNextPreview(v);
return true;
}
if (isWorkspaceLocked()) {
return false;
}
if (!(v instanceof CellLayout)) {
v=(View)v.getParent();
}
CellLayout.CellInfo cellInfo=(CellLayout.CellInfo)v.getTag();
if (cellInfo == null) {
return true;
}
if (mWorkspace.allowLongPress()) {
if (cellInfo.cell == null) {
if (cellInfo.valid) {
mWorkspace.setAllowLongPress(false);
showAddDialog(cellInfo);
}
}
 else {
if (!(cellInfo.cell instanceof Folder)) {
mWorkspace.startDrag(cellInfo);
}
}
}
return true;
}

Fixed version (ground truth):
public boolean onLongClick(View v){
switch (v.getId()) {
case R.id.previous_screen:
    if (!isAllAppsVisible()) {
      mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
      showPreviousPreview(v);
    }
  return true;
case R.id.next_screen:
if (!isAllAppsVisible()) {
  mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
  showNextPreview(v);
}
return true;
}
if (isWorkspaceLocked()) {
return false;
}
if (!(v instanceof CellLayout)) {
v=(View)v.getParent();
}
CellLayout.CellInfo cellInfo=(CellLayout.CellInfo)v.getTag();
if (cellInfo == null) {
return true;
}
if (mWorkspace.allowLongPress()) {
if (cellInfo.cell == null) {
if (cellInfo.valid) {
mWorkspace.setAllowLongPress(false);
showAddDialog(cellInfo);
}
}
 else {
if (!(cellInfo.cell instanceof Folder)) {
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
mWorkspace.startDrag(cellInfo);
}
}
}
return true;
}
Program: 83761
Project: 83761
Buggy source:
/** 
 * Adds the specified child in the specified screen. The position and dimension of the child are defined by x, y, spanX and spanY.
 * @param child The child to add in one of the workspace's screens.
 * @param screen The screen in which to add the child.
 * @param spanX The number of cells spanned horizontally by the child.
 * @param spanY The number of cells spanned vertically by the child.
 */
void fitInScreen(View child,int screen,int spanX,int spanY){
  if (screen < 0 || screen >= getChildCount()) {
    throw new IllegalStateException("String_Node_Str" + getChildCount());
  }
  final CellLayout group=(CellLayout)getChildAt(screen);
  boolean vacant=group.getVacantCell(mTempCell,spanX,spanY);
  if (vacant) {
    group.addView(child,new CellLayout.LayoutParams(mTempCell[0],mTempCell[1],spanX,spanY));
    child.setOnLongClickListener(mLongClickListener);
    if (!(child instanceof Folder)) {
      child.setOnLongClickListener(mLongClickListener);
    }
    if (child instanceof DropTarget) {
      mDragController.addDropTarget((DropTarget)child);
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds the specified child in the specified screen. The position and dimension of the child are defined by x, y, spanX and spanY.
 * @param child The child to add in one of the workspace's screens.
 * @param screen The screen in which to add the child.
 * @param spanX The number of cells spanned horizontally by the child.
 * @param spanY The number of cells spanned vertically by the child.
 */
void fitInScreen(View child,int screen,int spanX,int spanY){
  if (screen < 0 || screen >= getChildCount()) {
    throw new IllegalStateException("String_Node_Str" + getChildCount());
  }
  final CellLayout group=(CellLayout)getChildAt(screen);
  boolean vacant=group.getVacantCell(mTempCell,spanX,spanY);
  if (vacant) {
    group.addView(child,new CellLayout.LayoutParams(mTempCell[0],mTempCell[1],spanX,spanY));
    child.setHapticFeedbackEnabled(false);
    child.setOnLongClickListener(mLongClickListener);
    if (child instanceof DropTarget) {
      mDragController.addDropTarget((DropTarget)child);
    }
  }
}
Program: 83762
Project: 83762
Buggy source:
/** 
 * Adds the specified child in the specified screen. The position and dimension of the child are defined by x, y, spanX and spanY.
 * @param child The child to add in one of the workspace's screens.
 * @param screen The screen in which to add the child.
 * @param x The X position of the child in the screen's grid.
 * @param y The Y position of the child in the screen's grid.
 * @param spanX The number of cells spanned horizontally by the child.
 * @param spanY The number of cells spanned vertically by the child.
 * @param insert When true, the child is inserted at the beginning of the children list.
 */
void addInScreen(View child,int screen,int x,int y,int spanX,int spanY,boolean insert){
  if (screen < 0 || screen >= getChildCount()) {
    throw new IllegalStateException("String_Node_Str" + getChildCount());
  }
  clearVacantCache();
  final CellLayout group=(CellLayout)getChildAt(screen);
  CellLayout.LayoutParams lp=(CellLayout.LayoutParams)child.getLayoutParams();
  if (lp == null) {
    lp=new CellLayout.LayoutParams(x,y,spanX,spanY);
  }
 else {
    lp.cellX=x;
    lp.cellY=y;
    lp.cellHSpan=spanX;
    lp.cellVSpan=spanY;
  }
  group.addView(child,insert ? 0 : -1,lp);
  if (!(child instanceof Folder)) {
    child.setOnLongClickListener(mLongClickListener);
  }
  if (child instanceof DropTarget) {
    mDragController.addDropTarget((DropTarget)child);
  }
}

Fixed version (ground truth):
/** 
 * Adds the specified child in the specified screen. The position and dimension of the child are defined by x, y, spanX and spanY.
 * @param child The child to add in one of the workspace's screens.
 * @param screen The screen in which to add the child.
 * @param x The X position of the child in the screen's grid.
 * @param y The Y position of the child in the screen's grid.
 * @param spanX The number of cells spanned horizontally by the child.
 * @param spanY The number of cells spanned vertically by the child.
 * @param insert When true, the child is inserted at the beginning of the children list.
 */
void addInScreen(View child,int screen,int x,int y,int spanX,int spanY,boolean insert){
  if (screen < 0 || screen >= getChildCount()) {
    throw new IllegalStateException("String_Node_Str" + getChildCount());
  }
  clearVacantCache();
  final CellLayout group=(CellLayout)getChildAt(screen);
  CellLayout.LayoutParams lp=(CellLayout.LayoutParams)child.getLayoutParams();
  if (lp == null) {
    lp=new CellLayout.LayoutParams(x,y,spanX,spanY);
  }
 else {
    lp.cellX=x;
    lp.cellY=y;
    lp.cellHSpan=spanX;
    lp.cellVSpan=spanY;
  }
  group.addView(child,insert ? 0 : -1,lp);
  if (!(child instanceof Folder)) {
    child.setHapticFeedbackEnabled(false);
    child.setOnLongClickListener(mLongClickListener);
  }
  if (child instanceof DropTarget) {
    mDragController.addDropTarget((DropTarget)child);
  }
}
Program: 83763
Project: 83763
Buggy source:
private void onDropExternal(int x,int y,Object dragInfo,CellLayout cellLayout,boolean insertAtFirst){
  ItemInfo info=(ItemInfo)dragInfo;
  View view;
switch (info.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
    if (info.container == NO_ID) {
      info=new ApplicationInfo((ApplicationInfo)info);
    }
  view=mLauncher.createShortcut(R.layout.application,cellLayout,(ApplicationInfo)info);
break;
case LauncherSettings.Favorites.ITEM_TYPE_USER_FOLDER:
view=FolderIcon.fromXml(R.layout.folder_icon,mLauncher,(ViewGroup)getChildAt(mCurrentScreen),((UserFolderInfo)info));
break;
default :
throw new IllegalStateException("String_Node_Str" + info.itemType);
}
cellLayout.addView(view,insertAtFirst ? 0 : -1);
view.setOnLongClickListener(mLongClickListener);
if (view instanceof DropTarget) {
mDragController.addDropTarget((DropTarget)view);
}
mTargetCell=estimateDropCell(x,y,1,1,view,cellLayout,mTargetCell);
cellLayout.onDropChild(view,mTargetCell);
CellLayout.LayoutParams lp=(CellLayout.LayoutParams)view.getLayoutParams();
LauncherModel.addOrMoveItemInDatabase(mLauncher,info,LauncherSettings.Favorites.CONTAINER_DESKTOP,mCurrentScreen,lp.cellX,lp.cellY);
}

Fixed version (ground truth):
private void onDropExternal(int x,int y,Object dragInfo,CellLayout cellLayout,boolean insertAtFirst){
  ItemInfo info=(ItemInfo)dragInfo;
  View view;
switch (info.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
    if (info.container == NO_ID) {
      info=new ApplicationInfo((ApplicationInfo)info);
    }
  view=mLauncher.createShortcut(R.layout.application,cellLayout,(ApplicationInfo)info);
break;
case LauncherSettings.Favorites.ITEM_TYPE_USER_FOLDER:
view=FolderIcon.fromXml(R.layout.folder_icon,mLauncher,(ViewGroup)getChildAt(mCurrentScreen),((UserFolderInfo)info));
break;
default :
throw new IllegalStateException("String_Node_Str" + info.itemType);
}
cellLayout.addView(view,insertAtFirst ? 0 : -1);
view.setHapticFeedbackEnabled(false);
view.setOnLongClickListener(mLongClickListener);
if (view instanceof DropTarget) {
mDragController.addDropTarget((DropTarget)view);
}
mTargetCell=estimateDropCell(x,y,1,1,view,cellLayout,mTargetCell);
cellLayout.onDropChild(view,mTargetCell);
CellLayout.LayoutParams lp=(CellLayout.LayoutParams)view.getLayoutParams();
LauncherModel.addOrMoveItemInDatabase(mLauncher,info,LauncherSettings.Favorites.CONTAINER_DESKTOP,mCurrentScreen,lp.cellX,lp.cellY);
}
Program: 83764
Project: 83764
Buggy source:
/** 
 * Used to inflate the Workspace from XML.
 * @param context The application's context.
 * @param attrs The attribtues set containing the Workspace's customization values.
 * @param defStyle Unused.
 */
public Workspace(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mWallpaperManager=WallpaperManager.getInstance(context);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.Workspace,defStyle,0);
  mDefaultScreen=a.getInt(R.styleable.Workspace_defaultScreen,1);
  a.recycle();
  initWorkspace();
}

Fixed version (ground truth):
/** 
 * Used to inflate the Workspace from XML.
 * @param context The application's context.
 * @param attrs The attribtues set containing the Workspace's customization values.
 * @param defStyle Unused.
 */
public Workspace(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mWallpaperManager=WallpaperManager.getInstance(context);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.Workspace,defStyle,0);
  mDefaultScreen=a.getInt(R.styleable.Workspace_defaultScreen,1);
  a.recycle();
  setHapticFeedbackEnabled(false);
  initWorkspace();
}
Program: 83765
Project: 83765
Buggy source:
public boolean isOpaque(){
  if (mZoomDirty) {
    return mNextZoom > 0.999f;
  }
 else {
    if (mRollo == null) {
      return false;
    }
 else {
      return mRollo.mMessageProc.mZoom > 0.999f;
    }
  }
}

Fixed version (ground truth):
public boolean isOpaque(){
  if (mZoomDirty) {
    return mNextZoom > 0.999f;
  }
 else {
    if (mMessageProc == null) {
      return false;
    }
 else {
      return mMessageProc.mZoom > 0.999f;
    }
  }
}
Program: 83766
Project: 83766
Buggy source:
public void run(){
  mPosX=((float)mData[0]) / (1 << 16);
  mVelocity=((float)mData[1]) / (1 << 16);
  mZoom=((float)mData[2]) / (1 << 16);
}

Fixed version (ground truth):
public void run(){
  mPosX=((float)mData[0]) / (1 << 16);
  mVelocity=((float)mData[1]) / (1 << 16);
  mZoom=((float)mData[2]) / (1 << 16);
  mZoomDirty=false;
}
Program: 83767
Project: 83767
Buggy source:
private void gainFocus(){
  if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
    mArrowNavigation=true;
    mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE,SELECTED_FOCUSED);
    mRollo.mState.save();
  }
}

Fixed version (ground truth):
private void gainFocus(){
  if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
    mArrowNavigation=true;
    mRollo.selectIcon(Math.round(mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE,SELECTED_FOCUSED);
    mRollo.mState.save();
  }
}
Program: 83768
Project: 83768
Buggy source:
private void initRs(){
  ScriptC.Builder sb=new ScriptC.Builder(mRS);
  sb.setScript(mRes,R.raw.rollo3);
  sb.setRoot(true);
  sb.addDefines(mDefines);
  sb.setType(mParams.mType,"String_Node_Str",Defines.ALLOC_PARAMS);
  sb.setType(mState.mType,"String_Node_Str",Defines.ALLOC_STATE);
  mInvokeMove=sb.addInvokable("String_Node_Str");
  mInvokeFling=sb.addInvokable("String_Node_Str");
  mInvokeMoveTo=sb.addInvokable("String_Node_Str");
  mInvokeResetWAR=sb.addInvokable("String_Node_Str");
  mInvokeSetZoom=sb.addInvokable("String_Node_Str");
  mScript=sb.create();
  mScript.setClearColor(0.0f,0.0f,0.0f,0.0f);
  mScript.bindAllocation(mParams.mAlloc,Defines.ALLOC_PARAMS);
  mScript.bindAllocation(mState.mAlloc,Defines.ALLOC_STATE);
  mScript.bindAllocation(mAllocIconIds,Defines.ALLOC_ICON_IDS);
  mScript.bindAllocation(mAllocLabelIds,Defines.ALLOC_LABEL_IDS);
  mMessageProc=new AAMessage();
  mRS.mMessageCallback=mMessageProc;
  mRS.contextBindRootScript(mScript);
}

Fixed version (ground truth):
private void initRs(){
  ScriptC.Builder sb=new ScriptC.Builder(mRS);
  sb.setScript(mRes,R.raw.rollo3);
  sb.setRoot(true);
  sb.addDefines(mDefines);
  sb.setType(mParams.mType,"String_Node_Str",Defines.ALLOC_PARAMS);
  sb.setType(mState.mType,"String_Node_Str",Defines.ALLOC_STATE);
  mInvokeMove=sb.addInvokable("String_Node_Str");
  mInvokeFling=sb.addInvokable("String_Node_Str");
  mInvokeMoveTo=sb.addInvokable("String_Node_Str");
  mInvokeResetWAR=sb.addInvokable("String_Node_Str");
  mInvokeSetZoom=sb.addInvokable("String_Node_Str");
  mScript=sb.create();
  mScript.setClearColor(0.0f,0.0f,0.0f,0.0f);
  mScript.bindAllocation(mParams.mAlloc,Defines.ALLOC_PARAMS);
  mScript.bindAllocation(mState.mAlloc,Defines.ALLOC_STATE);
  mScript.bindAllocation(mAllocIconIds,Defines.ALLOC_ICON_IDS);
  mScript.bindAllocation(mAllocLabelIds,Defines.ALLOC_LABEL_IDS);
  mRS.contextBindRootScript(mScript);
}
Program: 83770
Project: 83770
Buggy source:
public boolean isVisible(){
  if (mZoomDirty) {
    return mNextZoom > 0.001f;
  }
 else {
    if (mRollo == null) {
      return false;
    }
 else {
      return mRollo.mMessageProc.mZoom > 0.001f;
    }
  }
}

Fixed version (ground truth):
public boolean isVisible(){
  if (mZoomDirty) {
    return mNextZoom > 0.001f;
  }
 else {
    if (mMessageProc == null) {
      return false;
    }
 else {
      return mMessageProc.mZoom > 0.001f;
    }
  }
}
Program: 83772
Project: 83772
Buggy source:
void dirtyCheck(){
  if (mHasSurface) {
    if (mAppsDirty) {
      uploadApps(mAllAppsList);
      saveAppsList();
      mAppsDirty=false;
    }
    if (mZoomDirty) {
      setZoom(mNextZoom,mNextAnimate);
      mZoomDirty=false;
    }
  }
}

Fixed version (ground truth):
void dirtyCheck(){
  if (mHasSurface) {
    if (mAppsDirty) {
      uploadApps(mAllAppsList);
      saveAppsList();
      mAppsDirty=false;
    }
    if (mZoomDirty) {
      setZoom(mNextZoom,mNextAnimate);
    }
  }
}
Program: 83773
Project: 83773
Buggy source:
@Override public void surfaceChanged(SurfaceHolder holder,int format,int w,int h){
  super.surfaceChanged(holder,format,w,h);
  if (mRS == null) {
    mRS=createRenderScript(true);
    mRollo=new RolloRS();
    mRollo.mHasSurface=true;
    mRollo.init(getResources(),w,h);
    if (mAllAppsList != null) {
      mRollo.setApps(mAllAppsList);
    }
    if (mShouldGainFocus) {
      gainFocus();
      mShouldGainFocus=false;
    }
    mRollo.dirtyCheck();
  }
 else {
    mRollo.mHasSurface=true;
    mRollo.dirtyCheck();
  }
  Resources res=getContext().getResources();
  int barHeight=(int)res.getDimension(R.dimen.button_bar_height);
}

Fixed version (ground truth):
@Override public void surfaceChanged(SurfaceHolder holder,int format,int w,int h){
  super.surfaceChanged(holder,format,w,h);
  if (mRS == null) {
    mRS=createRenderScript(true);
    mRollo=new RolloRS();
    mRollo.mHasSurface=true;
    mRollo.init(getResources(),w,h);
    if (mAllAppsList != null) {
      mRollo.setApps(mAllAppsList);
    }
    if (mShouldGainFocus) {
      gainFocus();
      mShouldGainFocus=false;
    }
    mRollo.dirtyCheck();
  }
 else {
    mRollo.mHasSurface=true;
    mRollo.dirtyCheck();
  }
  mRS.mMessageCallback=mMessageProc=new AAMessage();
  Resources res=getContext().getResources();
  int barHeight=(int)res.getDimension(R.dimen.button_bar_height);
}
Program: 83774
Project: 83774
Buggy source:
@Override public void onWindowFocusChanged(boolean hasWindowFocus){
  super.onWindowFocusChanged(hasWindowFocus);
  if (mArrowNavigation) {
    if (!hasWindowFocus) {
      mLastSelectedIcon=mRollo.mState.selectedIconIndex;
      mRollo.setHomeSelected(SELECTED_NONE);
      mRollo.clearSelectedIcon();
      mRollo.mState.save();
    }
 else     if (hasWindowFocus) {
      if (mRollo.mState.iconCount > 0) {
        if (mLastSelection == SELECTION_ICONS) {
          int selection=mLastSelectedIcon;
          final int firstIcon=Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE;
          if (selection < 0 || selection < firstIcon || selection >= mRollo.mState.iconCount || selection >= firstIcon + (Defines.COLUMNS_PER_PAGE * Defines.ROWS_PER_PAGE)) {
            selection=firstIcon;
          }
          mRollo.selectIcon(selection,SELECTED_FOCUSED);
          mRollo.mState.save();
        }
 else         if (mLastSelection == SELECTION_HOME) {
          mRollo.setHomeSelected(SELECTED_FOCUSED);
          mRollo.mState.save();
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onWindowFocusChanged(boolean hasWindowFocus){
  super.onWindowFocusChanged(hasWindowFocus);
  if (mArrowNavigation) {
    if (!hasWindowFocus) {
      mLastSelectedIcon=mRollo.mState.selectedIconIndex;
      mRollo.setHomeSelected(SELECTED_NONE);
      mRollo.clearSelectedIcon();
      mRollo.mState.save();
    }
 else     if (hasWindowFocus) {
      if (mRollo.mState.iconCount > 0) {
        if (mLastSelection == SELECTION_ICONS) {
          int selection=mLastSelectedIcon;
          final int firstIcon=Math.round(mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE;
          if (selection < 0 || selection < firstIcon || selection >= mRollo.mState.iconCount || selection >= firstIcon + (Defines.COLUMNS_PER_PAGE * Defines.ROWS_PER_PAGE)) {
            selection=firstIcon;
          }
          mRollo.selectIcon(selection,SELECTED_FOCUSED);
          mRollo.mState.save();
        }
 else         if (mLastSelection == SELECTION_HOME) {
          mRollo.setHomeSelected(SELECTED_FOCUSED);
          mRollo.mState.save();
        }
      }
    }
  }
}
Program: 83775
Project: 83775
Buggy source:
public boolean isOpaque(){
  if (mZoomDirty) {
    return mNextZoom > 0.999f;
  }
 else {
    if (mRollo == null) {
      return false;
    }
 else {
      return mRollo.mMessageProc.mZoom > 0.999f;
    }
  }
}

Fixed version (ground truth):
public boolean isOpaque(){
  if (mZoomDirty) {
    return mNextZoom > 0.999f;
  }
 else {
    if (mMessageProc == null) {
      return false;
    }
 else {
      return mMessageProc.mZoom > 0.999f;
    }
  }
}
Program: 83776
Project: 83776
Buggy source:
public void run(){
  mPosX=((float)mData[0]) / (1 << 16);
  mVelocity=((float)mData[1]) / (1 << 16);
  mZoom=((float)mData[2]) / (1 << 16);
}

Fixed version (ground truth):
public void run(){
  mPosX=((float)mData[0]) / (1 << 16);
  mVelocity=((float)mData[1]) / (1 << 16);
  mZoom=((float)mData[2]) / (1 << 16);
  mZoomDirty=false;
}
Program: 83777
Project: 83777
Buggy source:
private void gainFocus(){
  if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
    mArrowNavigation=true;
    mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE,SELECTED_FOCUSED);
    mRollo.mState.save();
  }
}

Fixed version (ground truth):
private void gainFocus(){
  if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
    mArrowNavigation=true;
    mRollo.selectIcon(Math.round(mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE,SELECTED_FOCUSED);
    mRollo.mState.save();
  }
}
Program: 83778
Project: 83778
Buggy source:
private void initRs(){
  ScriptC.Builder sb=new ScriptC.Builder(mRS);
  sb.setScript(mRes,R.raw.rollo3);
  sb.setRoot(true);
  sb.addDefines(mDefines);
  sb.setType(mParams.mType,"String_Node_Str",Defines.ALLOC_PARAMS);
  sb.setType(mState.mType,"String_Node_Str",Defines.ALLOC_STATE);
  mInvokeMove=sb.addInvokable("String_Node_Str");
  mInvokeFling=sb.addInvokable("String_Node_Str");
  mInvokeMoveTo=sb.addInvokable("String_Node_Str");
  mInvokeResetWAR=sb.addInvokable("String_Node_Str");
  mInvokeSetZoom=sb.addInvokable("String_Node_Str");
  mScript=sb.create();
  mScript.setClearColor(0.0f,0.0f,0.0f,0.0f);
  mScript.bindAllocation(mParams.mAlloc,Defines.ALLOC_PARAMS);
  mScript.bindAllocation(mState.mAlloc,Defines.ALLOC_STATE);
  mScript.bindAllocation(mAllocIconIds,Defines.ALLOC_ICON_IDS);
  mScript.bindAllocation(mAllocLabelIds,Defines.ALLOC_LABEL_IDS);
  mMessageProc=new AAMessage();
  mRS.mMessageCallback=mMessageProc;
  mRS.contextBindRootScript(mScript);
}

Fixed version (ground truth):
private void initRs(){
  ScriptC.Builder sb=new ScriptC.Builder(mRS);
  sb.setScript(mRes,R.raw.rollo3);
  sb.setRoot(true);
  sb.addDefines(mDefines);
  sb.setType(mParams.mType,"String_Node_Str",Defines.ALLOC_PARAMS);
  sb.setType(mState.mType,"String_Node_Str",Defines.ALLOC_STATE);
  mInvokeMove=sb.addInvokable("String_Node_Str");
  mInvokeFling=sb.addInvokable("String_Node_Str");
  mInvokeMoveTo=sb.addInvokable("String_Node_Str");
  mInvokeResetWAR=sb.addInvokable("String_Node_Str");
  mInvokeSetZoom=sb.addInvokable("String_Node_Str");
  mScript=sb.create();
  mScript.setClearColor(0.0f,0.0f,0.0f,0.0f);
  mScript.bindAllocation(mParams.mAlloc,Defines.ALLOC_PARAMS);
  mScript.bindAllocation(mState.mAlloc,Defines.ALLOC_STATE);
  mScript.bindAllocation(mAllocIconIds,Defines.ALLOC_ICON_IDS);
  mScript.bindAllocation(mAllocLabelIds,Defines.ALLOC_LABEL_IDS);
  mRS.contextBindRootScript(mScript);
}
Program: 83780
Project: 83780
Buggy source:
public boolean isVisible(){
  if (mZoomDirty) {
    return mNextZoom > 0.001f;
  }
 else {
    if (mRollo == null) {
      return false;
    }
 else {
      return mRollo.mMessageProc.mZoom > 0.001f;
    }
  }
}

Fixed version (ground truth):
public boolean isVisible(){
  if (mZoomDirty) {
    return mNextZoom > 0.001f;
  }
 else {
    if (mMessageProc == null) {
      return false;
    }
 else {
      return mMessageProc.mZoom > 0.001f;
    }
  }
}
Program: 83782
Project: 83782
Buggy source:
void dirtyCheck(){
  if (mHasSurface) {
    if (mAppsDirty) {
      uploadApps(mAllAppsList);
      saveAppsList();
      mAppsDirty=false;
    }
    if (mZoomDirty) {
      setZoom(mNextZoom,mNextAnimate);
      mZoomDirty=false;
    }
  }
}

Fixed version (ground truth):
void dirtyCheck(){
  if (mHasSurface) {
    if (mAppsDirty) {
      uploadApps(mAllAppsList);
      saveAppsList();
      mAppsDirty=false;
    }
    if (mZoomDirty) {
      setZoom(mNextZoom,mNextAnimate);
    }
  }
}
Program: 83783
Project: 83783
Buggy source:
@Override public void surfaceChanged(SurfaceHolder holder,int format,int w,int h){
  super.surfaceChanged(holder,format,w,h);
  if (mRS == null) {
    mRS=createRenderScript(true);
    mRollo=new RolloRS();
    mRollo.mHasSurface=true;
    mRollo.init(getResources(),w,h);
    if (mAllAppsList != null) {
      mRollo.setApps(mAllAppsList);
    }
    if (mShouldGainFocus) {
      gainFocus();
      mShouldGainFocus=false;
    }
    mRollo.dirtyCheck();
  }
 else {
    mRollo.mHasSurface=true;
    mRollo.dirtyCheck();
  }
  Resources res=getContext().getResources();
  int barHeight=(int)res.getDimension(R.dimen.button_bar_height);
}

Fixed version (ground truth):
@Override public void surfaceChanged(SurfaceHolder holder,int format,int w,int h){
  super.surfaceChanged(holder,format,w,h);
  if (mRS == null) {
    mRS=createRenderScript(true);
    mRollo=new RolloRS();
    mRollo.mHasSurface=true;
    mRollo.init(getResources(),w,h);
    if (mAllAppsList != null) {
      mRollo.setApps(mAllAppsList);
    }
    if (mShouldGainFocus) {
      gainFocus();
      mShouldGainFocus=false;
    }
    mRollo.dirtyCheck();
  }
 else {
    mRollo.mHasSurface=true;
    mRollo.dirtyCheck();
  }
  mRS.mMessageCallback=mMessageProc=new AAMessage();
  Resources res=getContext().getResources();
  int barHeight=(int)res.getDimension(R.dimen.button_bar_height);
}
Program: 83784
Project: 83784
Buggy source:
@Override public void onWindowFocusChanged(boolean hasWindowFocus){
  super.onWindowFocusChanged(hasWindowFocus);
  if (mArrowNavigation) {
    if (!hasWindowFocus) {
      mLastSelectedIcon=mRollo.mState.selectedIconIndex;
      mRollo.setHomeSelected(SELECTED_NONE);
      mRollo.clearSelectedIcon();
      mRollo.mState.save();
    }
 else     if (hasWindowFocus) {
      if (mRollo.mState.iconCount > 0) {
        if (mLastSelection == SELECTION_ICONS) {
          int selection=mLastSelectedIcon;
          final int firstIcon=Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE;
          if (selection < 0 || selection < firstIcon || selection >= mRollo.mState.iconCount || selection >= firstIcon + (Defines.COLUMNS_PER_PAGE * Defines.ROWS_PER_PAGE)) {
            selection=firstIcon;
          }
          mRollo.selectIcon(selection,SELECTED_FOCUSED);
          mRollo.mState.save();
        }
 else         if (mLastSelection == SELECTION_HOME) {
          mRollo.setHomeSelected(SELECTED_FOCUSED);
          mRollo.mState.save();
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onWindowFocusChanged(boolean hasWindowFocus){
  super.onWindowFocusChanged(hasWindowFocus);
  if (mArrowNavigation) {
    if (!hasWindowFocus) {
      mLastSelectedIcon=mRollo.mState.selectedIconIndex;
      mRollo.setHomeSelected(SELECTED_NONE);
      mRollo.clearSelectedIcon();
      mRollo.mState.save();
    }
 else     if (hasWindowFocus) {
      if (mRollo.mState.iconCount > 0) {
        if (mLastSelection == SELECTION_ICONS) {
          int selection=mLastSelectedIcon;
          final int firstIcon=Math.round(mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE;
          if (selection < 0 || selection < firstIcon || selection >= mRollo.mState.iconCount || selection >= firstIcon + (Defines.COLUMNS_PER_PAGE * Defines.ROWS_PER_PAGE)) {
            selection=firstIcon;
          }
          mRollo.selectIcon(selection,SELECTED_FOCUSED);
          mRollo.mState.save();
        }
 else         if (mLastSelection == SELECTION_HOME) {
          mRollo.setHomeSelected(SELECTED_FOCUSED);
          mRollo.mState.save();
        }
      }
    }
  }
}
Program: 83785
Project: 83785
Buggy source:
@Override public void surfaceDestroyed(SurfaceHolder holder){
  super.surfaceDestroyed(holder);
  mRollo.mHasSurface=false;
}

Fixed version (ground truth):
@Override public void surfaceDestroyed(SurfaceHolder holder){
  super.surfaceDestroyed(holder);
  mRollo.mHasSurface=false;
  mRS.mMessageCallback=null;
}
Program: 83786
Project: 83786
Buggy source:
@Override public void surfaceDestroyed(SurfaceHolder holder){
  super.surfaceDestroyed(holder);
  mRollo.mHasSurface=false;
}

Fixed version (ground truth):
@Override public void surfaceDestroyed(SurfaceHolder holder){
  super.surfaceDestroyed(holder);
  mRollo.mHasSurface=false;
  mRS.mMessageCallback=null;
}
Program: 83787
Project: 83787
Buggy source:
@Override public void surfaceDestroyed(SurfaceHolder holder){
  super.surfaceDestroyed(holder);
  mRollo.mHasSurface=false;
}

Fixed version (ground truth):
@Override public void surfaceDestroyed(SurfaceHolder holder){
  super.surfaceDestroyed(holder);
  mRollo.mHasSurface=false;
  mRS.mMessageCallback=null;
}
Program: 83788
Project: 83788
Buggy source:
@Override public void surfaceDestroyed(SurfaceHolder holder){
  super.surfaceDestroyed(holder);
  mRollo.mHasSurface=false;
}

Fixed version (ground truth):
@Override public void surfaceDestroyed(SurfaceHolder holder){
  super.surfaceDestroyed(holder);
  mRollo.mHasSurface=false;
  mRS.mMessageCallback=null;
}