nus-yam/ex-repair huggingface dataset:
Program: 179951
Project: 179951
Buggy source:
@Override public void surfaceChanged(SurfaceHolder holder,int format,int w,int h){
  Log.d(TAG,"String_Node_Str");
  long startTime=SystemClock.uptimeMillis();
  super.surfaceChanged(holder,format,w,h);
  if (mRS == null) {
    mRS=createRenderScript(true);
    mRollo=new RolloRS();
    mRollo.init(getResources(),w,h);
    if (mAllAppsList != null) {
      mRollo.setApps(mAllAppsList);
      Log.d(TAG,"String_Node_Str");
    }
  }
  Resources res=getContext().getResources();
  int barHeight=(int)res.getDimension(R.dimen.button_bar_height);
  long endTime=SystemClock.uptimeMillis();
  Log.d(TAG,"String_Node_Str" + (endTime - startTime) + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void surfaceChanged(SurfaceHolder holder,int format,int w,int h){
  Log.d(TAG,"String_Node_Str");
  long startTime=SystemClock.uptimeMillis();
  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);
      Log.d(TAG,"String_Node_Str");
    }
  }
 else {
    mRollo.mHasSurface=true;
    mRollo.dirtyCheck();
  }
  Resources res=getContext().getResources();
  int barHeight=(int)res.getDimension(R.dimen.button_bar_height);
  long endTime=SystemClock.uptimeMillis();
  Log.d(TAG,"String_Node_Str" + (endTime - startTime) + "String_Node_Str");
}
Program: 179952
Project: 179952
Buggy source:
/** 
 * Handle the allocations for the new app.  Make sure you call saveAppsList when done.
 */
private void addApp(int index,ApplicationInfo item){
  final int count=mState.iconCount - index;
  final int dest=index + 1;
  System.arraycopy(mIcons,index,mIcons,dest,count);
  System.arraycopy(mIconIds,index,mIconIds,dest,count);
  System.arraycopy(mLabels,index,mLabels,dest,count);
  System.arraycopy(mLabelIds,index,mLabelIds,dest,count);
  uploadAppIcon(index,item);
}

Fixed version (ground truth):
/** 
 * Handle the allocations for the new app.  Make sure you call saveAppsList when done.
 */
private void addApp(int index,ApplicationInfo item){
  final int count=mState.iconCount - index;
  final int dest=index + 1;
  System.arraycopy(mIcons,index,mIcons,dest,count);
  System.arraycopy(mIconIds,index,mIconIds,dest,count);
  System.arraycopy(mLabels,index,mLabels,dest,count);
  System.arraycopy(mLabelIds,index,mLabelIds,dest,count);
  if (mHasSurface) {
    uploadAppIcon(index,item);
  }
 else {
    mAppsDirty=true;
  }
}
Program: 179953
Project: 179953
Buggy source:
/** 
 * Update the title and icon.  Don't keep a reference to the context!
 */
private static void updateTitleAndIcon(ResolveInfo info,ApplicationInfo application,Context context,Utilities.BubbleText bubble){
  final PackageManager packageManager=context.getPackageManager();
  application.title=info.loadLabel(packageManager);
  if (application.title == null) {
    application.title=info.activityInfo.name;
  }
  application.iconBitmap=Utilities.createAllAppsBitmap(info.activityInfo.loadIcon(packageManager),context);
  application.filtered=true;
  application.titleBitmap=bubble.createTextBitmap(application.title.toString());
}

Fixed version (ground truth):
/** 
 * Update the title and icon.  Don't keep a reference to the context!
 */
private static void updateTitleAndIcon(ResolveInfo info,ApplicationInfo application,Context context,Utilities.BubbleText bubble){
  final PackageManager packageManager=context.getPackageManager();
  application.title=info.loadLabel(packageManager);
  if (application.title == null) {
    application.title=info.activityInfo.name;
  }
  application.iconBitmap=Utilities.createAllAppsBitmap(info.activityInfo.loadIcon(packageManager),context);
  application.titleBitmap=bubble.createTextBitmap(application.title.toString());
}
Program: 179954
Project: 179954
Buggy source:
public ApplicationsAdapter(Context context,ArrayList<ApplicationInfo> apps){
  super(context,0,apps);
  mInflater=LayoutInflater.from(context);
}

Fixed version (ground truth):
public ApplicationsAdapter(Context context,ArrayList<ApplicationInfo> apps){
  super(context,0,apps);
  mPackageManager=context.getPackageManager();
  mInflater=LayoutInflater.from(context);
}
Program: 179955
Project: 179955
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  final ApplicationInfo info=getItem(position);
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.application_boxed,parent,false);
  }
  if (!info.filtered) {
    info.icon=Utilities.createIconThumbnail(info.icon,getContext());
    info.filtered=true;
  }
  final TextView textView=(TextView)convertView;
  textView.setCompoundDrawablesWithIntrinsicBounds(null,info.icon,null,null);
  textView.setText(info.title);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  final ApplicationInfo info=getItem(position);
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.application_boxed,parent,false);
  }
  if (info.icon == null) {
    info.icon=AppInfoCache.getIconDrawable(mPackageManager,info);
  }
  if (!info.filtered) {
    info.icon=Utilities.createIconThumbnail(info.icon,getContext());
    info.filtered=true;
  }
  final TextView textView=(TextView)convertView;
  textView.setCompoundDrawablesWithIntrinsicBounds(null,info.icon,null,null);
  textView.setText(info.title);
  return convertView;
}
Program: 179956
Project: 179956
Buggy source:
/** 
 * Update the title and icon.  Don't keep a reference to the context!
 */
private static void updateTitleAndIcon(ResolveInfo info,ApplicationInfo application,Context context,Utilities.BubbleText bubble){
  final PackageManager packageManager=context.getPackageManager();
  application.title=info.loadLabel(packageManager);
  if (application.title == null) {
    application.title=info.activityInfo.name;
  }
  application.iconBitmap=Utilities.createAllAppsBitmap(info.activityInfo.loadIcon(packageManager),context);
  application.filtered=true;
  application.titleBitmap=bubble.createTextBitmap(application.title.toString());
}

Fixed version (ground truth):
/** 
 * Update the title and icon.  Don't keep a reference to the context!
 */
private static void updateTitleAndIcon(ResolveInfo info,ApplicationInfo application,Context context,Utilities.BubbleText bubble){
  final PackageManager packageManager=context.getPackageManager();
  application.title=info.loadLabel(packageManager);
  if (application.title == null) {
    application.title=info.activityInfo.name;
  }
  application.iconBitmap=Utilities.createAllAppsBitmap(info.activityInfo.loadIcon(packageManager),context);
  application.titleBitmap=bubble.createTextBitmap(application.title.toString());
}
Program: 179957
Project: 179957
Buggy source:
public ApplicationsAdapter(Context context,ArrayList<ApplicationInfo> apps){
  super(context,0,apps);
  mInflater=LayoutInflater.from(context);
}

Fixed version (ground truth):
public ApplicationsAdapter(Context context,ArrayList<ApplicationInfo> apps){
  super(context,0,apps);
  mPackageManager=context.getPackageManager();
  mInflater=LayoutInflater.from(context);
}
Program: 179958
Project: 179958
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  final ApplicationInfo info=getItem(position);
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.application_boxed,parent,false);
  }
  if (!info.filtered) {
    info.icon=Utilities.createIconThumbnail(info.icon,getContext());
    info.filtered=true;
  }
  final TextView textView=(TextView)convertView;
  textView.setCompoundDrawablesWithIntrinsicBounds(null,info.icon,null,null);
  textView.setText(info.title);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  final ApplicationInfo info=getItem(position);
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.application_boxed,parent,false);
  }
  if (info.icon == null) {
    info.icon=AppInfoCache.getIconDrawable(mPackageManager,info);
  }
  if (!info.filtered) {
    info.icon=Utilities.createIconThumbnail(info.icon,getContext());
    info.filtered=true;
  }
  final TextView textView=(TextView)convertView;
  textView.setCompoundDrawablesWithIntrinsicBounds(null,info.icon,null,null);
  textView.setText(info.title);
  return convertView;
}
Program: 179959
Project: 179959
Buggy source:
/** 
 * Update the title and icon.  Don't keep a reference to the context!
 */
private static void updateTitleAndIcon(ResolveInfo info,ApplicationInfo application,Context context,Utilities.BubbleText bubble){
  final PackageManager packageManager=context.getPackageManager();
  application.title=info.loadLabel(packageManager);
  if (application.title == null) {
    application.title=info.activityInfo.name;
  }
  application.iconBitmap=Utilities.createAllAppsBitmap(info.activityInfo.loadIcon(packageManager),context);
  application.filtered=true;
  application.titleBitmap=bubble.createTextBitmap(application.title.toString());
}

Fixed version (ground truth):
/** 
 * Update the title and icon.  Don't keep a reference to the context!
 */
private static void updateTitleAndIcon(ResolveInfo info,ApplicationInfo application,Context context,Utilities.BubbleText bubble){
  final PackageManager packageManager=context.getPackageManager();
  application.title=info.loadLabel(packageManager);
  if (application.title == null) {
    application.title=info.activityInfo.name;
  }
  application.iconBitmap=Utilities.createAllAppsBitmap(info.activityInfo.loadIcon(packageManager),context);
  application.titleBitmap=bubble.createTextBitmap(application.title.toString());
}
Program: 179960
Project: 179960
Buggy source:
public ApplicationsAdapter(Context context,ArrayList<ApplicationInfo> apps){
  super(context,0,apps);
  mInflater=LayoutInflater.from(context);
}

Fixed version (ground truth):
public ApplicationsAdapter(Context context,ArrayList<ApplicationInfo> apps){
  super(context,0,apps);
  mPackageManager=context.getPackageManager();
  mInflater=LayoutInflater.from(context);
}
Program: 179961
Project: 179961
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  final ApplicationInfo info=getItem(position);
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.application_boxed,parent,false);
  }
  if (!info.filtered) {
    info.icon=Utilities.createIconThumbnail(info.icon,getContext());
    info.filtered=true;
  }
  final TextView textView=(TextView)convertView;
  textView.setCompoundDrawablesWithIntrinsicBounds(null,info.icon,null,null);
  textView.setText(info.title);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  final ApplicationInfo info=getItem(position);
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.application_boxed,parent,false);
  }
  if (info.icon == null) {
    info.icon=AppInfoCache.getIconDrawable(mPackageManager,info);
  }
  if (!info.filtered) {
    info.icon=Utilities.createIconThumbnail(info.icon,getContext());
    info.filtered=true;
  }
  final TextView textView=(TextView)convertView;
  textView.setCompoundDrawablesWithIntrinsicBounds(null,info.icon,null,null);
  textView.setText(info.title);
  return convertView;
}
Program: 179962
Project: 179962
Buggy source:
/** 
 * Update the title and icon.  Don't keep a reference to the context!
 */
private static void updateTitleAndIcon(ResolveInfo info,ApplicationInfo application,Context context,Utilities.BubbleText bubble){
  final PackageManager packageManager=context.getPackageManager();
  application.title=info.loadLabel(packageManager);
  if (application.title == null) {
    application.title=info.activityInfo.name;
  }
  application.iconBitmap=Utilities.createAllAppsBitmap(info.activityInfo.loadIcon(packageManager),context);
  application.filtered=true;
  application.titleBitmap=bubble.createTextBitmap(application.title.toString());
}

Fixed version (ground truth):
/** 
 * Update the title and icon.  Don't keep a reference to the context!
 */
private static void updateTitleAndIcon(ResolveInfo info,ApplicationInfo application,Context context,Utilities.BubbleText bubble){
  final PackageManager packageManager=context.getPackageManager();
  application.title=info.loadLabel(packageManager);
  if (application.title == null) {
    application.title=info.activityInfo.name;
  }
  application.iconBitmap=Utilities.createAllAppsBitmap(info.activityInfo.loadIcon(packageManager),context);
  application.titleBitmap=bubble.createTextBitmap(application.title.toString());
}
Program: 179963
Project: 179963
Buggy source:
public ApplicationsAdapter(Context context,ArrayList<ApplicationInfo> apps){
  super(context,0,apps);
  mInflater=LayoutInflater.from(context);
}

Fixed version (ground truth):
public ApplicationsAdapter(Context context,ArrayList<ApplicationInfo> apps){
  super(context,0,apps);
  mPackageManager=context.getPackageManager();
  mInflater=LayoutInflater.from(context);
}
Program: 179964
Project: 179964
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  final ApplicationInfo info=getItem(position);
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.application_boxed,parent,false);
  }
  if (!info.filtered) {
    info.icon=Utilities.createIconThumbnail(info.icon,getContext());
    info.filtered=true;
  }
  final TextView textView=(TextView)convertView;
  textView.setCompoundDrawablesWithIntrinsicBounds(null,info.icon,null,null);
  textView.setText(info.title);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  final ApplicationInfo info=getItem(position);
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.application_boxed,parent,false);
  }
  if (info.icon == null) {
    info.icon=AppInfoCache.getIconDrawable(mPackageManager,info);
  }
  if (!info.filtered) {
    info.icon=Utilities.createIconThumbnail(info.icon,getContext());
    info.filtered=true;
  }
  final TextView textView=(TextView)convertView;
  textView.setCompoundDrawablesWithIntrinsicBounds(null,info.icon,null,null);
  textView.setText(info.title);
  return convertView;
}
Program: 179966
Project: 179966
Buggy source:
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (gainFocus) {
    if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
      mArrowNavigation=true;
      mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE);
      mRollo.mState.save();
    }
  }
 else {
    if (mArrowNavigation) {
      mRollo.clearSelectedIcon();
      mRollo.mState.save();
      mArrowNavigation=false;
    }
  }
}

Fixed version (ground truth):
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (!isVisible()) {
    return;
  }
  if (gainFocus) {
    if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
      mArrowNavigation=true;
      mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE);
      mRollo.mState.save();
    }
  }
 else {
    if (mArrowNavigation) {
      mRollo.clearSelectedIcon();
      mRollo.mState.save();
      mArrowNavigation=false;
    }
  }
}
Program: 179968
Project: 179968
Buggy source:
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (gainFocus) {
    if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
      mArrowNavigation=true;
      mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE);
      mRollo.mState.save();
    }
  }
 else {
    if (mArrowNavigation) {
      mRollo.clearSelectedIcon();
      mRollo.mState.save();
      mArrowNavigation=false;
    }
  }
}

Fixed version (ground truth):
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (!isVisible()) {
    return;
  }
  if (gainFocus) {
    if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
      mArrowNavigation=true;
      mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE);
      mRollo.mState.save();
    }
  }
 else {
    if (mArrowNavigation) {
      mRollo.clearSelectedIcon();
      mRollo.mState.save();
      mArrowNavigation=false;
    }
  }
}
Program: 179970
Project: 179970
Buggy source:
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (gainFocus) {
    if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
      mArrowNavigation=true;
      mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE);
      mRollo.mState.save();
    }
  }
 else {
    if (mArrowNavigation) {
      mRollo.clearSelectedIcon();
      mRollo.mState.save();
      mArrowNavigation=false;
    }
  }
}

Fixed version (ground truth):
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (!isVisible()) {
    return;
  }
  if (gainFocus) {
    if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
      mArrowNavigation=true;
      mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE);
      mRollo.mState.save();
    }
  }
 else {
    if (mArrowNavigation) {
      mRollo.clearSelectedIcon();
      mRollo.mState.save();
      mArrowNavigation=false;
    }
  }
}
Program: 179972
Project: 179972
Buggy source:
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (gainFocus) {
    if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
      mArrowNavigation=true;
      mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE);
      mRollo.mState.save();
    }
  }
 else {
    if (mArrowNavigation) {
      mRollo.clearSelectedIcon();
      mRollo.mState.save();
      mArrowNavigation=false;
    }
  }
}

Fixed version (ground truth):
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (!isVisible()) {
    return;
  }
  if (gainFocus) {
    if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
      mArrowNavigation=true;
      mRollo.selectIcon(Math.round(mRollo.mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE);
      mRollo.mState.save();
    }
  }
 else {
    if (mArrowNavigation) {
      mRollo.clearSelectedIcon();
      mRollo.mState.save();
      mArrowNavigation=false;
    }
  }
}
Program: 179974
Project: 179974
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mModel=((LauncherApplication)getApplication()).setLauncher(this);
  mInflater=getLayoutInflater();
  mAppWidgetManager=AppWidgetManager.getInstance(this);
  mAppWidgetHost=new LauncherAppWidgetHost(this,APPWIDGET_HOST_ID);
  mAppWidgetHost.startListening();
  if (PROFILE_STARTUP) {
    android.os.Debug.startMethodTracing("String_Node_Str");
  }
  checkForLocaleChange();
  setWallpaperDimension();
  setContentView(R.layout.launcher);
  setupViews();
  lockAllApps();
  mSavedState=savedInstanceState;
  restoreState(mSavedState);
  if (PROFILE_STARTUP) {
    android.os.Debug.stopMethodTracing();
  }
  if (!mRestoring) {
    mModel.startLoader(this,true);
  }
  mDefaultKeySsb=new SpannableStringBuilder();
  Selection.setSelection(mDefaultKeySsb,0);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mModel=((LauncherApplication)getApplication()).setLauncher(this);
  mInflater=getLayoutInflater();
  mAppWidgetManager=AppWidgetManager.getInstance(this);
  mAppWidgetHost=new LauncherAppWidgetHost(this,APPWIDGET_HOST_ID);
  mAppWidgetHost.startListening();
  if (PROFILE_STARTUP) {
    android.os.Debug.startMethodTracing("String_Node_Str");
  }
  checkForLocaleChange();
  setWallpaperDimension();
  setContentView(R.layout.launcher);
  setupViews();
  lockAllApps();
  mSavedState=savedInstanceState;
  restoreState(mSavedState);
  if (PROFILE_STARTUP) {
    android.os.Debug.stopMethodTracing();
  }
  mModel.setAllAppsDirty();
  mModel.setWorkspaceDirty();
  if (!mRestoring) {
    mModel.startLoader(this,true);
  }
  mDefaultKeySsb=new SpannableStringBuilder();
  Selection.setSelection(mDefaultKeySsb,0);
}
Program: 179975
Project: 179975
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mModel=((LauncherApplication)getApplication()).setLauncher(this);
  mInflater=getLayoutInflater();
  mAppWidgetManager=AppWidgetManager.getInstance(this);
  mAppWidgetHost=new LauncherAppWidgetHost(this,APPWIDGET_HOST_ID);
  mAppWidgetHost.startListening();
  if (PROFILE_STARTUP) {
    android.os.Debug.startMethodTracing("String_Node_Str");
  }
  checkForLocaleChange();
  setWallpaperDimension();
  setContentView(R.layout.launcher);
  setupViews();
  lockAllApps();
  mSavedState=savedInstanceState;
  restoreState(mSavedState);
  if (PROFILE_STARTUP) {
    android.os.Debug.stopMethodTracing();
  }
  if (!mRestoring) {
    mModel.startLoader(this,true);
  }
  mDefaultKeySsb=new SpannableStringBuilder();
  Selection.setSelection(mDefaultKeySsb,0);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mModel=((LauncherApplication)getApplication()).setLauncher(this);
  mInflater=getLayoutInflater();
  mAppWidgetManager=AppWidgetManager.getInstance(this);
  mAppWidgetHost=new LauncherAppWidgetHost(this,APPWIDGET_HOST_ID);
  mAppWidgetHost.startListening();
  if (PROFILE_STARTUP) {
    android.os.Debug.startMethodTracing("String_Node_Str");
  }
  checkForLocaleChange();
  setWallpaperDimension();
  setContentView(R.layout.launcher);
  setupViews();
  lockAllApps();
  mSavedState=savedInstanceState;
  restoreState(mSavedState);
  if (PROFILE_STARTUP) {
    android.os.Debug.stopMethodTracing();
  }
  mModel.setAllAppsDirty();
  mModel.setWorkspaceDirty();
  if (!mRestoring) {
    mModel.startLoader(this,true);
  }
  mDefaultKeySsb=new SpannableStringBuilder();
  Selection.setSelection(mDefaultKeySsb,0);
}
Program: 179976
Project: 179976
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mModel=((LauncherApplication)getApplication()).setLauncher(this);
  mInflater=getLayoutInflater();
  mAppWidgetManager=AppWidgetManager.getInstance(this);
  mAppWidgetHost=new LauncherAppWidgetHost(this,APPWIDGET_HOST_ID);
  mAppWidgetHost.startListening();
  if (PROFILE_STARTUP) {
    android.os.Debug.startMethodTracing("String_Node_Str");
  }
  checkForLocaleChange();
  setWallpaperDimension();
  setContentView(R.layout.launcher);
  setupViews();
  lockAllApps();
  mSavedState=savedInstanceState;
  restoreState(mSavedState);
  if (PROFILE_STARTUP) {
    android.os.Debug.stopMethodTracing();
  }
  if (!mRestoring) {
    mModel.startLoader(this,true);
  }
  mDefaultKeySsb=new SpannableStringBuilder();
  Selection.setSelection(mDefaultKeySsb,0);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mModel=((LauncherApplication)getApplication()).setLauncher(this);
  mInflater=getLayoutInflater();
  mAppWidgetManager=AppWidgetManager.getInstance(this);
  mAppWidgetHost=new LauncherAppWidgetHost(this,APPWIDGET_HOST_ID);
  mAppWidgetHost.startListening();
  if (PROFILE_STARTUP) {
    android.os.Debug.startMethodTracing("String_Node_Str");
  }
  checkForLocaleChange();
  setWallpaperDimension();
  setContentView(R.layout.launcher);
  setupViews();
  lockAllApps();
  mSavedState=savedInstanceState;
  restoreState(mSavedState);
  if (PROFILE_STARTUP) {
    android.os.Debug.stopMethodTracing();
  }
  mModel.setAllAppsDirty();
  mModel.setWorkspaceDirty();
  if (!mRestoring) {
    mModel.startLoader(this,true);
  }
  mDefaultKeySsb=new SpannableStringBuilder();
  Selection.setSelection(mDefaultKeySsb,0);
}
Program: 179977
Project: 179977
Buggy source:
public void onClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return;
  }
  int index=mRollo.mState.selectedIconIndex;
  if (mRollo.checkClickOK() && index >= 0 && index < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(index);
    mLauncher.startActivitySafely(app.intent);
  }
}

Fixed version (ground truth):
public void onClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return;
  }
  if (mRollo.checkClickOK() && mCurrentIconIndex == mDownIconIndex && mCurrentIconIndex >= 0 && mCurrentIconIndex < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(mCurrentIconIndex);
    mLauncher.startActivitySafely(app.intent);
  }
}
Program: 179979
Project: 179979
Buggy source:
void selectIcon(int index){
  int iconCount=mAllAppsList.size();
  if (index < 0 || index >= iconCount) {
    mState.selectedIconIndex=-1;
    return;
  }
 else {
    mState.selectedIconIndex=index;
    Bitmap selectionBitmap=mSelectionBitmap;
    Utilities.drawSelectedAllAppsBitmap(mSelectionCanvas,selectionBitmap.getWidth(),selectionBitmap.getHeight(),mAllAppsList.get(index).iconBitmap);
    mSelectedIcon=Allocation.createFromBitmap(mRS,selectionBitmap,Element.RGBA_8888(mRS),false);
    mSelectedIcon.uploadToTexture(0);
    mState.selectedIconTexture=mSelectedIcon.getID();
  }
}

Fixed version (ground truth):
void selectIcon(int index){
  if (index < 0) {
    mState.selectedIconIndex=-1;
  }
 else {
    mState.selectedIconIndex=index;
    Bitmap selectionBitmap=mSelectionBitmap;
    Utilities.drawSelectedAllAppsBitmap(mSelectionCanvas,selectionBitmap.getWidth(),selectionBitmap.getHeight(),mAllAppsList.get(index).iconBitmap);
    mSelectedIcon=Allocation.createFromBitmap(mRS,selectionBitmap,Element.RGBA_8888(mRS),false);
    mSelectedIcon.uploadToTexture(0);
    mState.selectedIconTexture=mSelectedIcon.getID();
  }
}
Program: 179980
Project: 179980
Buggy source:
public boolean onLongClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return true;
  }
  int index=mRollo.mState.selectedIconIndex;
  if (mRollo.checkClickOK() && index >= 0 && index < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(index);
    int screenX=mMotionDownRawX - (mDefines.ICON_WIDTH_PX / 2);
    int screenY=mMotionDownRawY - mDefines.ICON_HEIGHT_PX;
    int left=(mDefines.ICON_TEXTURE_WIDTH_PX - mDefines.ICON_WIDTH_PX) / 2;
    int top=(mDefines.ICON_TEXTURE_HEIGHT_PX - mDefines.ICON_HEIGHT_PX) / 2;
    mDragController.startDrag(app.iconBitmap,screenX,screenY,left,top,mDefines.ICON_WIDTH_PX,mDefines.ICON_HEIGHT_PX,this,app,DragController.DRAG_ACTION_COPY);
    mLauncher.closeAllApps(true);
  }
  return true;
}

Fixed version (ground truth):
public boolean onLongClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return true;
  }
  if (mRollo.checkClickOK() && mCurrentIconIndex == mDownIconIndex && mCurrentIconIndex >= 0 && mCurrentIconIndex < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(mCurrentIconIndex);
    int screenX=mMotionDownRawX - (mDefines.ICON_WIDTH_PX / 2);
    int screenY=mMotionDownRawY - mDefines.ICON_HEIGHT_PX;
    int left=(mDefines.ICON_TEXTURE_WIDTH_PX - mDefines.ICON_WIDTH_PX) / 2;
    int top=(mDefines.ICON_TEXTURE_HEIGHT_PX - mDefines.ICON_HEIGHT_PX) / 2;
    mDragController.startDrag(app.iconBitmap,screenX,screenY,left,top,mDefines.ICON_WIDTH_PX,mDefines.ICON_HEIGHT_PX,this,app,DragController.DRAG_ACTION_COPY);
    mLauncher.closeAllApps(true);
  }
  return true;
}
Program: 179981
Project: 179981
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mModel=((LauncherApplication)getApplication()).setLauncher(this);
  mInflater=getLayoutInflater();
  mAppWidgetManager=AppWidgetManager.getInstance(this);
  mAppWidgetHost=new LauncherAppWidgetHost(this,APPWIDGET_HOST_ID);
  mAppWidgetHost.startListening();
  if (PROFILE_STARTUP) {
    android.os.Debug.startMethodTracing("String_Node_Str");
  }
  checkForLocaleChange();
  setWallpaperDimension();
  setContentView(R.layout.launcher);
  setupViews();
  lockAllApps();
  mSavedState=savedInstanceState;
  restoreState(mSavedState);
  if (PROFILE_STARTUP) {
    android.os.Debug.stopMethodTracing();
  }
  if (!mRestoring) {
    mModel.startLoader(this,true);
  }
  mDefaultKeySsb=new SpannableStringBuilder();
  Selection.setSelection(mDefaultKeySsb,0);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mModel=((LauncherApplication)getApplication()).setLauncher(this);
  mInflater=getLayoutInflater();
  mAppWidgetManager=AppWidgetManager.getInstance(this);
  mAppWidgetHost=new LauncherAppWidgetHost(this,APPWIDGET_HOST_ID);
  mAppWidgetHost.startListening();
  if (PROFILE_STARTUP) {
    android.os.Debug.startMethodTracing("String_Node_Str");
  }
  checkForLocaleChange();
  setWallpaperDimension();
  setContentView(R.layout.launcher);
  setupViews();
  lockAllApps();
  mSavedState=savedInstanceState;
  restoreState(mSavedState);
  if (PROFILE_STARTUP) {
    android.os.Debug.stopMethodTracing();
  }
  mModel.setAllAppsDirty();
  mModel.setWorkspaceDirty();
  if (!mRestoring) {
    mModel.startLoader(this,true);
  }
  mDefaultKeySsb=new SpannableStringBuilder();
  Selection.setSelection(mDefaultKeySsb,0);
}
Program: 179982
Project: 179982
Buggy source:
public void onClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return;
  }
  int index=mRollo.mState.selectedIconIndex;
  if (mRollo.checkClickOK() && index >= 0 && index < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(index);
    mLauncher.startActivitySafely(app.intent);
  }
}

Fixed version (ground truth):
public void onClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return;
  }
  if (mRollo.checkClickOK() && mCurrentIconIndex == mDownIconIndex && mCurrentIconIndex >= 0 && mCurrentIconIndex < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(mCurrentIconIndex);
    mLauncher.startActivitySafely(app.intent);
  }
}
Program: 179984
Project: 179984
Buggy source:
void selectIcon(int index){
  int iconCount=mAllAppsList.size();
  if (index < 0 || index >= iconCount) {
    mState.selectedIconIndex=-1;
    return;
  }
 else {
    mState.selectedIconIndex=index;
    Bitmap selectionBitmap=mSelectionBitmap;
    Utilities.drawSelectedAllAppsBitmap(mSelectionCanvas,selectionBitmap.getWidth(),selectionBitmap.getHeight(),mAllAppsList.get(index).iconBitmap);
    mSelectedIcon=Allocation.createFromBitmap(mRS,selectionBitmap,Element.RGBA_8888(mRS),false);
    mSelectedIcon.uploadToTexture(0);
    mState.selectedIconTexture=mSelectedIcon.getID();
  }
}

Fixed version (ground truth):
void selectIcon(int index){
  if (index < 0) {
    mState.selectedIconIndex=-1;
  }
 else {
    mState.selectedIconIndex=index;
    Bitmap selectionBitmap=mSelectionBitmap;
    Utilities.drawSelectedAllAppsBitmap(mSelectionCanvas,selectionBitmap.getWidth(),selectionBitmap.getHeight(),mAllAppsList.get(index).iconBitmap);
    mSelectedIcon=Allocation.createFromBitmap(mRS,selectionBitmap,Element.RGBA_8888(mRS),false);
    mSelectedIcon.uploadToTexture(0);
    mState.selectedIconTexture=mSelectedIcon.getID();
  }
}
Program: 179985
Project: 179985
Buggy source:
public boolean onLongClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return true;
  }
  int index=mRollo.mState.selectedIconIndex;
  if (mRollo.checkClickOK() && index >= 0 && index < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(index);
    int screenX=mMotionDownRawX - (mDefines.ICON_WIDTH_PX / 2);
    int screenY=mMotionDownRawY - mDefines.ICON_HEIGHT_PX;
    int left=(mDefines.ICON_TEXTURE_WIDTH_PX - mDefines.ICON_WIDTH_PX) / 2;
    int top=(mDefines.ICON_TEXTURE_HEIGHT_PX - mDefines.ICON_HEIGHT_PX) / 2;
    mDragController.startDrag(app.iconBitmap,screenX,screenY,left,top,mDefines.ICON_WIDTH_PX,mDefines.ICON_HEIGHT_PX,this,app,DragController.DRAG_ACTION_COPY);
    mLauncher.closeAllApps(true);
  }
  return true;
}

Fixed version (ground truth):
public boolean onLongClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return true;
  }
  if (mRollo.checkClickOK() && mCurrentIconIndex == mDownIconIndex && mCurrentIconIndex >= 0 && mCurrentIconIndex < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(mCurrentIconIndex);
    int screenX=mMotionDownRawX - (mDefines.ICON_WIDTH_PX / 2);
    int screenY=mMotionDownRawY - mDefines.ICON_HEIGHT_PX;
    int left=(mDefines.ICON_TEXTURE_WIDTH_PX - mDefines.ICON_WIDTH_PX) / 2;
    int top=(mDefines.ICON_TEXTURE_HEIGHT_PX - mDefines.ICON_HEIGHT_PX) / 2;
    mDragController.startDrag(app.iconBitmap,screenX,screenY,left,top,mDefines.ICON_WIDTH_PX,mDefines.ICON_HEIGHT_PX,this,app,DragController.DRAG_ACTION_COPY);
    mLauncher.closeAllApps(true);
  }
  return true;
}
Program: 179988
Project: 179988
Buggy source:
public void onClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return;
  }
  int index=mRollo.mState.selectedIconIndex;
  if (mRollo.checkClickOK() && index >= 0 && index < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(index);
    mLauncher.startActivitySafely(app.intent);
  }
}

Fixed version (ground truth):
public void onClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return;
  }
  if (mRollo.checkClickOK() && mCurrentIconIndex == mDownIconIndex && mCurrentIconIndex >= 0 && mCurrentIconIndex < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(mCurrentIconIndex);
    mLauncher.startActivitySafely(app.intent);
  }
}
Program: 179990
Project: 179990
Buggy source:
void selectIcon(int index){
  int iconCount=mAllAppsList.size();
  if (index < 0 || index >= iconCount) {
    mState.selectedIconIndex=-1;
    return;
  }
 else {
    mState.selectedIconIndex=index;
    Bitmap selectionBitmap=mSelectionBitmap;
    Utilities.drawSelectedAllAppsBitmap(mSelectionCanvas,selectionBitmap.getWidth(),selectionBitmap.getHeight(),mAllAppsList.get(index).iconBitmap);
    mSelectedIcon=Allocation.createFromBitmap(mRS,selectionBitmap,Element.RGBA_8888(mRS),false);
    mSelectedIcon.uploadToTexture(0);
    mState.selectedIconTexture=mSelectedIcon.getID();
  }
}

Fixed version (ground truth):
void selectIcon(int index){
  if (index < 0) {
    mState.selectedIconIndex=-1;
  }
 else {
    mState.selectedIconIndex=index;
    Bitmap selectionBitmap=mSelectionBitmap;
    Utilities.drawSelectedAllAppsBitmap(mSelectionCanvas,selectionBitmap.getWidth(),selectionBitmap.getHeight(),mAllAppsList.get(index).iconBitmap);
    mSelectedIcon=Allocation.createFromBitmap(mRS,selectionBitmap,Element.RGBA_8888(mRS),false);
    mSelectedIcon.uploadToTexture(0);
    mState.selectedIconTexture=mSelectedIcon.getID();
  }
}
Program: 179991
Project: 179991
Buggy source:
public boolean onLongClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return true;
  }
  int index=mRollo.mState.selectedIconIndex;
  if (mRollo.checkClickOK() && index >= 0 && index < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(index);
    int screenX=mMotionDownRawX - (mDefines.ICON_WIDTH_PX / 2);
    int screenY=mMotionDownRawY - mDefines.ICON_HEIGHT_PX;
    int left=(mDefines.ICON_TEXTURE_WIDTH_PX - mDefines.ICON_WIDTH_PX) / 2;
    int top=(mDefines.ICON_TEXTURE_HEIGHT_PX - mDefines.ICON_HEIGHT_PX) / 2;
    mDragController.startDrag(app.iconBitmap,screenX,screenY,left,top,mDefines.ICON_WIDTH_PX,mDefines.ICON_HEIGHT_PX,this,app,DragController.DRAG_ACTION_COPY);
    mLauncher.closeAllApps(true);
  }
  return true;
}

Fixed version (ground truth):
public boolean onLongClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return true;
  }
  if (mRollo.checkClickOK() && mCurrentIconIndex == mDownIconIndex && mCurrentIconIndex >= 0 && mCurrentIconIndex < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(mCurrentIconIndex);
    int screenX=mMotionDownRawX - (mDefines.ICON_WIDTH_PX / 2);
    int screenY=mMotionDownRawY - mDefines.ICON_HEIGHT_PX;
    int left=(mDefines.ICON_TEXTURE_WIDTH_PX - mDefines.ICON_WIDTH_PX) / 2;
    int top=(mDefines.ICON_TEXTURE_HEIGHT_PX - mDefines.ICON_HEIGHT_PX) / 2;
    mDragController.startDrag(app.iconBitmap,screenX,screenY,left,top,mDefines.ICON_WIDTH_PX,mDefines.ICON_HEIGHT_PX,this,app,DragController.DRAG_ACTION_COPY);
    mLauncher.closeAllApps(true);
  }
  return true;
}
Program: 179992
Project: 179992
Buggy source:
public void onClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return;
  }
  int index=mRollo.mState.selectedIconIndex;
  if (mRollo.checkClickOK() && index >= 0 && index < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(index);
    mLauncher.startActivitySafely(app.intent);
  }
}

Fixed version (ground truth):
public void onClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return;
  }
  if (mRollo.checkClickOK() && mCurrentIconIndex == mDownIconIndex && mCurrentIconIndex >= 0 && mCurrentIconIndex < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(mCurrentIconIndex);
    mLauncher.startActivitySafely(app.intent);
  }
}
Program: 179994
Project: 179994
Buggy source:
void selectIcon(int index){
  int iconCount=mAllAppsList.size();
  if (index < 0 || index >= iconCount) {
    mState.selectedIconIndex=-1;
    return;
  }
 else {
    mState.selectedIconIndex=index;
    Bitmap selectionBitmap=mSelectionBitmap;
    Utilities.drawSelectedAllAppsBitmap(mSelectionCanvas,selectionBitmap.getWidth(),selectionBitmap.getHeight(),mAllAppsList.get(index).iconBitmap);
    mSelectedIcon=Allocation.createFromBitmap(mRS,selectionBitmap,Element.RGBA_8888(mRS),false);
    mSelectedIcon.uploadToTexture(0);
    mState.selectedIconTexture=mSelectedIcon.getID();
  }
}

Fixed version (ground truth):
void selectIcon(int index){
  if (index < 0) {
    mState.selectedIconIndex=-1;
  }
 else {
    mState.selectedIconIndex=index;
    Bitmap selectionBitmap=mSelectionBitmap;
    Utilities.drawSelectedAllAppsBitmap(mSelectionCanvas,selectionBitmap.getWidth(),selectionBitmap.getHeight(),mAllAppsList.get(index).iconBitmap);
    mSelectedIcon=Allocation.createFromBitmap(mRS,selectionBitmap,Element.RGBA_8888(mRS),false);
    mSelectedIcon.uploadToTexture(0);
    mState.selectedIconTexture=mSelectedIcon.getID();
  }
}
Program: 179995
Project: 179995
Buggy source:
public boolean onLongClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return true;
  }
  int index=mRollo.mState.selectedIconIndex;
  if (mRollo.checkClickOK() && index >= 0 && index < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(index);
    int screenX=mMotionDownRawX - (mDefines.ICON_WIDTH_PX / 2);
    int screenY=mMotionDownRawY - mDefines.ICON_HEIGHT_PX;
    int left=(mDefines.ICON_TEXTURE_WIDTH_PX - mDefines.ICON_WIDTH_PX) / 2;
    int top=(mDefines.ICON_TEXTURE_HEIGHT_PX - mDefines.ICON_HEIGHT_PX) / 2;
    mDragController.startDrag(app.iconBitmap,screenX,screenY,left,top,mDefines.ICON_WIDTH_PX,mDefines.ICON_HEIGHT_PX,this,app,DragController.DRAG_ACTION_COPY);
    mLauncher.closeAllApps(true);
  }
  return true;
}

Fixed version (ground truth):
public boolean onLongClick(View v){
  if (mLocks != 0 || !isVisible()) {
    return true;
  }
  if (mRollo.checkClickOK() && mCurrentIconIndex == mDownIconIndex && mCurrentIconIndex >= 0 && mCurrentIconIndex < mAllAppsList.size()) {
    ApplicationInfo app=mAllAppsList.get(mCurrentIconIndex);
    int screenX=mMotionDownRawX - (mDefines.ICON_WIDTH_PX / 2);
    int screenY=mMotionDownRawY - mDefines.ICON_HEIGHT_PX;
    int left=(mDefines.ICON_TEXTURE_WIDTH_PX - mDefines.ICON_WIDTH_PX) / 2;
    int top=(mDefines.ICON_TEXTURE_HEIGHT_PX - mDefines.ICON_HEIGHT_PX) / 2;
    mDragController.startDrag(app.iconBitmap,screenX,screenY,left,top,mDefines.ICON_WIDTH_PX,mDefines.ICON_HEIGHT_PX,this,app,DragController.DRAG_ACTION_COPY);
    mLauncher.closeAllApps(true);
  }
  return true;
}
Program: 179999
Project: 179999
Buggy source:
public boolean onTouchEvent(MotionEvent ev){
  if (mVelocityTracker == null) {
    mVelocityTracker=VelocityTracker.obtain();
  }
  mVelocityTracker.addMovement(ev);
  final int screenX=(int)ev.getRawX();
  final int screenY=(int)ev.getRawY();
  final int deltaX=screenX - mDownX;
  final int deltaY=screenY - mDownY;
  final int action=ev.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
    mCanceled=false;
  mTracking=false;
mDownX=screenX;
mDownY=screenY;
mAllAppsView.setZoomSwipeInProgress(true,true);
break;
case MotionEvent.ACTION_MOVE:
if (!mCanceled && !mTracking) {
if (Math.abs(deltaX) > mSlop) {
mCanceled=true;
mTracking=false;
mAllAppsView.setZoomSwipeInProgress(false,true);
}
if (Math.abs(deltaY) > mSlop) {
mTracking=true;
}
}
if (mTracking && !mCanceled) {
track(screenY);
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (mTracking && !mCanceled) {
fling(screenY);
mAllAppsView.setZoomSwipeInProgress(false,false);
}
mVelocityTracker.recycle();
mVelocityTracker=null;
break;
}
return mTracking || mCanceled;
}

Fixed version (ground truth):
public boolean onTouchEvent(MotionEvent ev){
  if (mVelocityTracker == null) {
    mVelocityTracker=VelocityTracker.obtain();
  }
  mVelocityTracker.addMovement(ev);
  final int screenX=(int)ev.getRawX();
  final int screenY=(int)ev.getRawY();
  final int deltaX=screenX - mDownX;
  final int deltaY=screenY - mDownY;
  final int action=ev.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
    mCanceled=false;
  mTracking=false;
mDownX=screenX;
mDownY=screenY;
mAllAppsView.setZoomSwipeInProgress(true,true);
break;
case MotionEvent.ACTION_MOVE:
if (!mCanceled && !mTracking) {
if (Math.abs(deltaX) > mSlopX) {
mCanceled=true;
mTracking=false;
mAllAppsView.setZoomSwipeInProgress(false,true);
}
 else if (Math.abs(deltaY) > mSlopY) {
mTracking=true;
}
}
if (mTracking && !mCanceled) {
track(screenY);
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (mTracking && !mCanceled) {
fling(screenY);
mAllAppsView.setZoomSwipeInProgress(false,false);
}
mVelocityTracker.recycle();
mVelocityTracker=null;
break;
}
return mTracking || mCanceled;
}
Program: 180000
Project: 180000
Buggy source:
public SwipeController(Context context){
  ViewConfiguration config=ViewConfiguration.get(context);
  mSlop=config.getScaledTouchSlop();
  DisplayMetrics display=context.getResources().getDisplayMetrics();
  mSwipeDistance=display.heightPixels / 2;
  setMode(MODE_WORKSPACE,false);
}

Fixed version (ground truth):
public SwipeController(Context context){
  ViewConfiguration config=ViewConfiguration.get(context);
  mSlopX=config.getScaledTouchSlop();
  mSlopY=3 * mSlopX / 2;
  DisplayMetrics display=context.getResources().getDisplayMetrics();
  mSwipeDistance=display.heightPixels / 2;
  setMode(MODE_WORKSPACE,false);
}
Program: 180003
Project: 180003
Buggy source:
public boolean onTouchEvent(MotionEvent ev){
  if (mVelocityTracker == null) {
    mVelocityTracker=VelocityTracker.obtain();
  }
  mVelocityTracker.addMovement(ev);
  final int screenX=(int)ev.getRawX();
  final int screenY=(int)ev.getRawY();
  final int deltaX=screenX - mDownX;
  final int deltaY=screenY - mDownY;
  final int action=ev.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
    mCanceled=false;
  mTracking=false;
mDownX=screenX;
mDownY=screenY;
mAllAppsView.setZoomSwipeInProgress(true,true);
break;
case MotionEvent.ACTION_MOVE:
if (!mCanceled && !mTracking) {
if (Math.abs(deltaX) > mSlop) {
mCanceled=true;
mTracking=false;
mAllAppsView.setZoomSwipeInProgress(false,true);
}
if (Math.abs(deltaY) > mSlop) {
mTracking=true;
}
}
if (mTracking && !mCanceled) {
track(screenY);
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (mTracking && !mCanceled) {
fling(screenY);
mAllAppsView.setZoomSwipeInProgress(false,false);
}
mVelocityTracker.recycle();
mVelocityTracker=null;
break;
}
return mTracking || mCanceled;
}

Fixed version (ground truth):
public boolean onTouchEvent(MotionEvent ev){
  if (mVelocityTracker == null) {
    mVelocityTracker=VelocityTracker.obtain();
  }
  mVelocityTracker.addMovement(ev);
  final int screenX=(int)ev.getRawX();
  final int screenY=(int)ev.getRawY();
  final int deltaX=screenX - mDownX;
  final int deltaY=screenY - mDownY;
  final int action=ev.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
    mCanceled=false;
  mTracking=false;
mDownX=screenX;
mDownY=screenY;
mAllAppsView.setZoomSwipeInProgress(true,true);
break;
case MotionEvent.ACTION_MOVE:
if (!mCanceled && !mTracking) {
if (Math.abs(deltaX) > mSlopX) {
mCanceled=true;
mTracking=false;
mAllAppsView.setZoomSwipeInProgress(false,true);
}
 else if (Math.abs(deltaY) > mSlopY) {
mTracking=true;
}
}
if (mTracking && !mCanceled) {
track(screenY);
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (mTracking && !mCanceled) {
fling(screenY);
mAllAppsView.setZoomSwipeInProgress(false,false);
}
mVelocityTracker.recycle();
mVelocityTracker=null;
break;
}
return mTracking || mCanceled;
}
Program: 180004
Project: 180004
Buggy source:
public SwipeController(Context context){
  ViewConfiguration config=ViewConfiguration.get(context);
  mSlop=config.getScaledTouchSlop();
  DisplayMetrics display=context.getResources().getDisplayMetrics();
  mSwipeDistance=display.heightPixels / 2;
  setMode(MODE_WORKSPACE,false);
}

Fixed version (ground truth):
public SwipeController(Context context){
  ViewConfiguration config=ViewConfiguration.get(context);
  mSlopX=config.getScaledTouchSlop();
  mSlopY=3 * mSlopX / 2;
  DisplayMetrics display=context.getResources().getDisplayMetrics();
  mSwipeDistance=display.heightPixels / 2;
  setMode(MODE_WORKSPACE,false);
}
Program: 180005
Project: 180005
Buggy source:
public void onDrop(DragSource source,int x,int y,int xOffset,int yOffset,DragView dragView,Object dragInfo){
  final CellLayout cellLayout=getCurrentDropLayout();
  if (source != this) {
    onDropExternal(x - xOffset,y - yOffset,dragInfo,cellLayout);
  }
 else {
    if (mDragInfo != null) {
      final View cell=mDragInfo.cell;
      if (mCurrentScreen != mDragInfo.screen) {
        final CellLayout originalCellLayout=(CellLayout)getChildAt(mDragInfo.screen);
        originalCellLayout.removeView(cell);
        cellLayout.addView(cell);
      }
      mTargetCell=estimateDropCell(x - xOffset,y - yOffset,mDragInfo.spanX,mDragInfo.spanY,cell,cellLayout,mTargetCell);
      cellLayout.onDropChild(cell,mTargetCell);
      final ItemInfo info=(ItemInfo)cell.getTag();
      CellLayout.LayoutParams lp=(CellLayout.LayoutParams)cell.getLayoutParams();
      LauncherModel.moveItemInDatabase(mLauncher,info,LauncherSettings.Favorites.CONTAINER_DESKTOP,mCurrentScreen,lp.cellX,lp.cellY);
    }
  }
}

Fixed version (ground truth):
public void onDrop(DragSource source,int x,int y,int xOffset,int yOffset,DragView dragView,Object dragInfo){
  final CellLayout cellLayout=getCurrentDropLayout();
  if (source != this) {
    onDropExternal(x - xOffset,y - yOffset,dragInfo,cellLayout);
  }
 else {
    if (mDragInfo != null) {
      final View cell=mDragInfo.cell;
      int index=mScroller.isFinished() ? mCurrentScreen : mNextScreen;
      if (index != mDragInfo.screen) {
        final CellLayout originalCellLayout=(CellLayout)getChildAt(mDragInfo.screen);
        originalCellLayout.removeView(cell);
        cellLayout.addView(cell);
      }
      mTargetCell=estimateDropCell(x - xOffset,y - yOffset,mDragInfo.spanX,mDragInfo.spanY,cell,cellLayout,mTargetCell);
      cellLayout.onDropChild(cell,mTargetCell);
      final ItemInfo info=(ItemInfo)cell.getTag();
      CellLayout.LayoutParams lp=(CellLayout.LayoutParams)cell.getLayoutParams();
      LauncherModel.moveItemInDatabase(mLauncher,info,LauncherSettings.Favorites.CONTAINER_DESKTOP,index,lp.cellX,lp.cellY);
    }
  }
}