nus-yam/ex-repair huggingface dataset:
Program: 45525
Project: 45525
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: 45526
Project: 45526
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: 45527
Project: 45527
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: 45528
Project: 45528
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: 45529
Project: 45529
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: 45530
Project: 45530
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: 45531
Project: 45531
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: 45532
Project: 45532
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: 45533
Project: 45533
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: 45534
Project: 45534
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: 45535
Project: 45535
Buggy source:
void moveToDefaultScreen(){
  snapToScreen(mDefaultScreen);
  getChildAt(mDefaultScreen).requestFocus();
}

Fixed version (ground truth):
void moveToDefaultScreen(boolean animate){
  snapToScreen(mDefaultScreen,animate);
  getChildAt(mDefaultScreen).requestFocus();
}
Program: 45536
Project: 45536
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: 45537
Project: 45537
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: 45538
Project: 45538
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: 45539
Project: 45539
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: 45540
Project: 45540
Buggy source:
void moveToDefaultScreen(){
  snapToScreen(mDefaultScreen);
  getChildAt(mDefaultScreen).requestFocus();
}

Fixed version (ground truth):
void moveToDefaultScreen(boolean animate){
  snapToScreen(mDefaultScreen,animate);
  getChildAt(mDefaultScreen).requestFocus();
}
Program: 45541
Project: 45541
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: 45542
Project: 45542
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: 45544
Project: 45544
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: 45545
Project: 45545
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: 45546
Project: 45546
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: 45547
Project: 45547
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: 45548
Project: 45548
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: 45549
Project: 45549
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: 45550
Project: 45550
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: 45551
Project: 45551
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: 45553
Project: 45553
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: 45555
Project: 45555
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: 45556
Project: 45556
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: 45557
Project: 45557
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: 45558
Project: 45558
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: 45559
Project: 45559
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: 45560
Project: 45560
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: 45561
Project: 45561
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: 45563
Project: 45563
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: 45565
Project: 45565
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: 45566
Project: 45566
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: 45567
Project: 45567
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: 45568
Project: 45568
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: 45569
Project: 45569
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: 45570
Project: 45570
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: 45571
Project: 45571
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: 45572
Project: 45572
Buggy source:
private void startWallpaper(){
  final Intent pickWallpaper=new Intent(Intent.ACTION_SET_WALLPAPER);
  Intent chooser=Intent.createChooser(pickWallpaper,getText(R.string.chooser_wallpaper));
  WallpaperManager wm=(WallpaperManager)getSystemService(Context.WALLPAPER_SERVICE);
  WallpaperInfo wi=wm.getWallpaperInfo();
  if (wi != null && wi.getSettingsActivity() != null) {
    LabeledIntent li=new LabeledIntent(getPackageName(),R.string.configure_wallpaper,0);
    li.setClassName(wi.getPackageName(),wi.getSettingsActivity());
    chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS,new Intent[]{li});
  }
  startActivityForResult(chooser,REQUEST_PICK_WALLPAPER);
}

Fixed version (ground truth):
private void startWallpaper(){
  closeAllApps(true);
  final Intent pickWallpaper=new Intent(Intent.ACTION_SET_WALLPAPER);
  Intent chooser=Intent.createChooser(pickWallpaper,getText(R.string.chooser_wallpaper));
  WallpaperManager wm=(WallpaperManager)getSystemService(Context.WALLPAPER_SERVICE);
  WallpaperInfo wi=wm.getWallpaperInfo();
  if (wi != null && wi.getSettingsActivity() != null) {
    LabeledIntent li=new LabeledIntent(getPackageName(),R.string.configure_wallpaper,0);
    li.setClassName(wi.getPackageName(),wi.getSettingsActivity());
    chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS,new Intent[]{li});
  }
  startActivityForResult(chooser,REQUEST_PICK_WALLPAPER);
}
Program: 45573
Project: 45573
Buggy source:
private void addItems(){
  showAddDialog(mMenuAddInfo);
}

Fixed version (ground truth):
private void addItems(){
  closeAllApps(true);
  showAddDialog(mMenuAddInfo);
}