nus-yam/ex-repair huggingface dataset:
Program: 182047
Project: 182047
Buggy source:
private void installNewPackageLI(PackageParser.Package pkg,int parseFlags,int scanMode,String installerPackageName,PackageInstalledInfo res){
  String pkgName=pkg.packageName;
  boolean dataDirExists=getDataPathForPackage(pkg).exists();
  res.name=pkgName;
synchronized (mPackages) {
    if (mPackages.containsKey(pkgName) || mAppDirs.containsKey(pkg.mPath)) {
      Slog.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
      res.returnCode=PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
      return;
    }
  }
  mLastScanError=PackageManager.INSTALL_SUCCEEDED;
  PackageParser.Package newPackage=scanPackageLI(pkg,parseFlags,scanMode);
  if (newPackage == null) {
    Slog.w(TAG,"String_Node_Str" + pkg.mPath);
    if ((res.returnCode=mLastScanError) == PackageManager.INSTALL_SUCCEEDED) {
      res.returnCode=PackageManager.INSTALL_FAILED_INVALID_APK;
    }
  }
 else {
    updateSettingsLI(newPackage,installerPackageName,res);
    if (res.returnCode != PackageManager.INSTALL_SUCCEEDED) {
      deletePackageLI(pkgName,false,dataDirExists ? PackageManager.DONT_DELETE_DATA : 0,res.removedInfo);
    }
  }
}

Fixed version (ground truth):
private void installNewPackageLI(PackageParser.Package pkg,int parseFlags,int scanMode,String installerPackageName,PackageInstalledInfo res){
  String pkgName=pkg.packageName;
  boolean dataDirExists=getDataPathForPackage(pkg).exists();
  res.name=pkgName;
synchronized (mPackages) {
    if (mSettings.mRenamedPackages.containsKey(pkgName)) {
      Slog.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ mSettings.mRenamedPackages.get(pkgName));
      res.returnCode=PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
      return;
    }
    if (mPackages.containsKey(pkgName) || mAppDirs.containsKey(pkg.mPath)) {
      Slog.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
      res.returnCode=PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
      return;
    }
  }
  mLastScanError=PackageManager.INSTALL_SUCCEEDED;
  PackageParser.Package newPackage=scanPackageLI(pkg,parseFlags,scanMode);
  if (newPackage == null) {
    Slog.w(TAG,"String_Node_Str" + pkg.mPath);
    if ((res.returnCode=mLastScanError) == PackageManager.INSTALL_SUCCEEDED) {
      res.returnCode=PackageManager.INSTALL_FAILED_INVALID_APK;
    }
  }
 else {
    updateSettingsLI(newPackage,installerPackageName,res);
    if (res.returnCode != PackageManager.INSTALL_SUCCEEDED) {
      deletePackageLI(pkgName,false,dataDirExists ? PackageManager.DONT_DELETE_DATA : 0,res.removedInfo);
    }
  }
}
Program: 182049
Project: 182049
Buggy source:
private void installNewPackageLI(PackageParser.Package pkg,int parseFlags,int scanMode,String installerPackageName,PackageInstalledInfo res){
  String pkgName=pkg.packageName;
  boolean dataDirExists=getDataPathForPackage(pkg).exists();
  res.name=pkgName;
synchronized (mPackages) {
    if (mPackages.containsKey(pkgName) || mAppDirs.containsKey(pkg.mPath)) {
      Slog.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
      res.returnCode=PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
      return;
    }
  }
  mLastScanError=PackageManager.INSTALL_SUCCEEDED;
  PackageParser.Package newPackage=scanPackageLI(pkg,parseFlags,scanMode);
  if (newPackage == null) {
    Slog.w(TAG,"String_Node_Str" + pkg.mPath);
    if ((res.returnCode=mLastScanError) == PackageManager.INSTALL_SUCCEEDED) {
      res.returnCode=PackageManager.INSTALL_FAILED_INVALID_APK;
    }
  }
 else {
    updateSettingsLI(newPackage,installerPackageName,res);
    if (res.returnCode != PackageManager.INSTALL_SUCCEEDED) {
      deletePackageLI(pkgName,false,dataDirExists ? PackageManager.DONT_DELETE_DATA : 0,res.removedInfo);
    }
  }
}

Fixed version (ground truth):
private void installNewPackageLI(PackageParser.Package pkg,int parseFlags,int scanMode,String installerPackageName,PackageInstalledInfo res){
  String pkgName=pkg.packageName;
  boolean dataDirExists=getDataPathForPackage(pkg).exists();
  res.name=pkgName;
synchronized (mPackages) {
    if (mSettings.mRenamedPackages.containsKey(pkgName)) {
      Slog.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ mSettings.mRenamedPackages.get(pkgName));
      res.returnCode=PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
      return;
    }
    if (mPackages.containsKey(pkgName) || mAppDirs.containsKey(pkg.mPath)) {
      Slog.w(TAG,"String_Node_Str" + pkgName + "String_Node_Str");
      res.returnCode=PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
      return;
    }
  }
  mLastScanError=PackageManager.INSTALL_SUCCEEDED;
  PackageParser.Package newPackage=scanPackageLI(pkg,parseFlags,scanMode);
  if (newPackage == null) {
    Slog.w(TAG,"String_Node_Str" + pkg.mPath);
    if ((res.returnCode=mLastScanError) == PackageManager.INSTALL_SUCCEEDED) {
      res.returnCode=PackageManager.INSTALL_FAILED_INVALID_APK;
    }
  }
 else {
    updateSettingsLI(newPackage,installerPackageName,res);
    if (res.returnCode != PackageManager.INSTALL_SUCCEEDED) {
      deletePackageLI(pkgName,false,dataDirExists ? PackageManager.DONT_DELETE_DATA : 0,res.removedInfo);
    }
  }
}
Program: 182060
Project: 182060
Buggy source:
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}
Program: 182061
Project: 182061
Buggy source:
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label;
    }
  }
  return ci.loadLabel(pm);
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label.toString().trim();
    }
  }
  CharSequence data=ci.loadLabel(pm);
  if (data != null)   data=data.toString().trim();
  return data;
}
Program: 182065
Project: 182065
Buggy source:
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}
Program: 182066
Project: 182066
Buggy source:
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label;
    }
  }
  return ci.loadLabel(pm);
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label.toString().trim();
    }
  }
  CharSequence data=ci.loadLabel(pm);
  if (data != null)   data=data.toString().trim();
  return data;
}
Program: 182067
Project: 182067
Buggy source:
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}
Program: 182068
Project: 182068
Buggy source:
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label;
    }
  }
  return ci.loadLabel(pm);
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label.toString().trim();
    }
  }
  CharSequence data=ci.loadLabel(pm);
  if (data != null)   data=data.toString().trim();
  return data;
}
Program: 182069
Project: 182069
Buggy source:
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this item.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the item's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  if (labelRes != 0) {
    CharSequence label=pm.getText(packageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  if (name != null) {
    return name;
  }
  return packageName;
}
Program: 182070
Project: 182070
Buggy source:
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label;
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label;
    }
  }
  return ci.loadLabel(pm);
}

Fixed version (ground truth):
/** 
 * Retrieve the current textual label associated with this resolution.  This will call back on the given PackageManager to load the label from the application.
 * @param pm A PackageManager from which the label can be loaded; usuallythe PackageManager from which you originally retrieved this item.
 * @return Returns a CharSequence containing the resolutions's label.  If theitem does not have a label, its name is returned.
 */
public CharSequence loadLabel(PackageManager pm){
  if (nonLocalizedLabel != null) {
    return nonLocalizedLabel;
  }
  CharSequence label;
  if (resolvePackageName != null && labelRes != 0) {
    label=pm.getText(resolvePackageName,labelRes,null);
    if (label != null) {
      return label.toString().trim();
    }
  }
  ComponentInfo ci=activityInfo != null ? activityInfo : serviceInfo;
  ApplicationInfo ai=ci.applicationInfo;
  if (labelRes != 0) {
    label=pm.getText(ci.packageName,labelRes,ai);
    if (label != null) {
      return label.toString().trim();
    }
  }
  CharSequence data=ci.loadLabel(pm);
  if (data != null)   data=data.toString().trim();
  return data;
}
Program: 182071
Project: 182071
Buggy source:
private static void showUsage(){
  System.err.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
private static void showUsage(){
  System.err.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 182074
Project: 182074
Buggy source:
private static void showUsage(){
  System.err.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
private static void showUsage(){
  System.err.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 182077
Project: 182077
Buggy source:
private static void showUsage(){
  System.err.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
private static void showUsage(){
  System.err.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 182080
Project: 182080
Buggy source:
void startSpringback(){
  if (mScroller.springback(0,mScrollY,0,0,0,0)) {
    mTouchMode=TOUCH_MODE_OVERFLING;
    invalidate();
    post(this);
  }
}

Fixed version (ground truth):
void startSpringback(){
  if (mScroller.springback(0,mScrollY,0,0,0,0)) {
    mTouchMode=TOUCH_MODE_OVERFLING;
    invalidate();
    post(this);
  }
 else {
    mTouchMode=TOUCH_MODE_REST;
  }
}
Program: 182081
Project: 182081
Buggy source:
void startSpringback(){
  if (mScroller.springback(0,mScrollY,0,0,0,0)) {
    mTouchMode=TOUCH_MODE_OVERFLING;
    invalidate();
    post(this);
  }
}

Fixed version (ground truth):
void startSpringback(){
  if (mScroller.springback(0,mScrollY,0,0,0,0)) {
    mTouchMode=TOUCH_MODE_OVERFLING;
    invalidate();
    post(this);
  }
 else {
    mTouchMode=TOUCH_MODE_REST;
  }
}
Program: 182083
Project: 182083
Buggy source:
/** 
 * Have the surface flinger show a surface, robustly dealing with error conditions.  In particular, if there is not enough memory to show the surface, then we will try to get rid of other surfaces in order to succeed.
 * @return Returns true if the surface was successfully shown.
 */
boolean showSurfaceRobustlyLocked(WindowState win){
  try {
    if (win.mSurface != null) {
      win.mSurface.show();
      if (win.mTurnOnScreen) {
        if (DEBUG_VISIBILITY)         Slog.v(TAG,"String_Node_Str" + win);
        win.mTurnOnScreen=false;
        mTurnOnScreen=true;
      }
    }
    return true;
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + win.mSurface + "String_Node_Str"+ win);
  }
  reclaimSomeSurfaceMemoryLocked(win,"String_Node_Str");
  return false;
}

Fixed version (ground truth):
/** 
 * Have the surface flinger show a surface, robustly dealing with error conditions.  In particular, if there is not enough memory to show the surface, then we will try to get rid of other surfaces in order to succeed.
 * @return Returns true if the surface was successfully shown.
 */
boolean showSurfaceRobustlyLocked(WindowState win){
  try {
    if (win.mSurface != null) {
      win.mSurfaceShown=true;
      win.mSurface.show();
      if (win.mTurnOnScreen) {
        if (DEBUG_VISIBILITY)         Slog.v(TAG,"String_Node_Str" + win);
        win.mTurnOnScreen=false;
        mTurnOnScreen=true;
      }
    }
    return true;
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + win.mSurface + "String_Node_Str"+ win);
  }
  reclaimSomeSurfaceMemoryLocked(win,"String_Node_Str");
  return false;
}
Program: 182085
Project: 182085
Buggy source:
/** 
 * Show the dim surface.
 */
void show(int dw,int dh){
  if (SHOW_TRANSACTIONS)   Slog.i(TAG,"String_Node_Str" + mDimSurface + "String_Node_Str"+ dw+ "String_Node_Str"+ dh+ "String_Node_Str");
  mDimShown=true;
  try {
    mDimSurface.setPosition(0,0);
    mDimSurface.setSize(dw,dh);
    mDimSurface.show();
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Show the dim surface.
 */
void show(int dw,int dh){
  if (!mDimShown) {
    if (SHOW_TRANSACTIONS)     Slog.i(TAG,"String_Node_Str" + mDimSurface + "String_Node_Str"+ dw+ "String_Node_Str"+ dh+ "String_Node_Str");
    mDimShown=true;
    try {
      mDimSurface.setPosition(0,0);
      mDimSurface.setSize(dw,dh);
      mDimSurface.show();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str",e);
    }
  }
}
Program: 182086
Project: 182086
Buggy source:
void finishExit(){
  if (DEBUG_ANIM)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mExiting+ "String_Node_Str"+ mRemoveOnExit+ "String_Node_Str"+ isWindowAnimating());
  final int N=mChildWindows.size();
  for (int i=0; i < N; i++) {
    ((WindowState)mChildWindows.get(i)).finishExit();
  }
  if (!mExiting) {
    return;
  }
  if (isWindowAnimating()) {
    return;
  }
  if (localLOGV)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mRemoveOnExit);
  if (mSurface != null) {
    mDestroySurface.add(this);
    mDestroying=true;
    if (SHOW_TRANSACTIONS)     logSurface(this,"String_Node_Str",null);
    try {
      mSurface.hide();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str" + this,e);
    }
    mLastHidden=true;
    mKeyWaiter.releasePendingPointerLocked(mSession);
  }
  mExiting=false;
  if (mRemoveOnExit) {
    mPendingRemove.add(this);
    mRemoveOnExit=false;
  }
}

Fixed version (ground truth):
void finishExit(){
  if (DEBUG_ANIM)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mExiting+ "String_Node_Str"+ mRemoveOnExit+ "String_Node_Str"+ isWindowAnimating());
  final int N=mChildWindows.size();
  for (int i=0; i < N; i++) {
    ((WindowState)mChildWindows.get(i)).finishExit();
  }
  if (!mExiting) {
    return;
  }
  if (isWindowAnimating()) {
    return;
  }
  if (localLOGV)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mRemoveOnExit);
  if (mSurface != null) {
    mDestroySurface.add(this);
    mDestroying=true;
    if (SHOW_TRANSACTIONS)     logSurface(this,"String_Node_Str",null);
    mSurfaceShown=false;
    try {
      mSurface.hide();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str" + this,e);
    }
    mLastHidden=true;
    mKeyWaiter.releasePendingPointerLocked(mSession);
  }
  mExiting=false;
  if (mRemoveOnExit) {
    mPendingRemove.add(this);
    mRemoveOnExit=false;
  }
}
Program: 182089
Project: 182089
Buggy source:
private boolean chooseNewDefaultIMELocked(){
  List<InputMethodInfo> enabled=getEnabledInputMethodListLocked();
  if (enabled != null && enabled.size() > 0) {
    Settings.Secure.putString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD,enabled.get(0).getId());
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean chooseNewDefaultIMELocked(){
  List<InputMethodInfo> enabled=getEnabledInputMethodListLocked();
  if (enabled != null && enabled.size() > 0) {
    int i=enabled.size();
    while (i > 0) {
      i--;
      if ((enabled.get(i).getServiceInfo().applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
        break;
      }
    }
    Settings.Secure.putString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD,enabled.get(i).getId());
    return true;
  }
  return false;
}
Program: 182090
Project: 182090
Buggy source:
void buildInputMethodListLocked(ArrayList<InputMethodInfo> list,HashMap<String,InputMethodInfo> map){
  list.clear();
  map.clear();
  PackageManager pm=mContext.getPackageManager();
  List<ResolveInfo> services=pm.queryIntentServices(new Intent(InputMethod.SERVICE_INTERFACE),PackageManager.GET_META_DATA);
  for (int i=0; i < services.size(); ++i) {
    ResolveInfo ri=services.get(i);
    ServiceInfo si=ri.serviceInfo;
    ComponentName compName=new ComponentName(si.packageName,si.name);
    if (!android.Manifest.permission.BIND_INPUT_METHOD.equals(si.permission)) {
      Slog.w(TAG,"String_Node_Str" + compName + "String_Node_Str"+ android.Manifest.permission.BIND_INPUT_METHOD);
      continue;
    }
    if (DEBUG)     Slog.d(TAG,"String_Node_Str" + compName);
    try {
      InputMethodInfo p=new InputMethodInfo(mContext,ri);
      list.add(p);
      map.put(p.getId(),p);
      if (isSystemIme(p)) {
        setInputMethodEnabled(p.getId(),true);
      }
      if (DEBUG) {
        Slog.d(TAG,"String_Node_Str" + p);
      }
    }
 catch (    XmlPullParserException e) {
      Slog.w(TAG,"String_Node_Str" + compName,e);
    }
catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + compName,e);
    }
  }
  String defaultIme=Settings.Secure.getString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD);
  if (!map.containsKey(defaultIme)) {
    if (chooseNewDefaultIMELocked()) {
      updateFromSettingsLocked();
    }
  }
}

Fixed version (ground truth):
void buildInputMethodListLocked(ArrayList<InputMethodInfo> list,HashMap<String,InputMethodInfo> map){
  list.clear();
  map.clear();
  PackageManager pm=mContext.getPackageManager();
  List<ResolveInfo> services=pm.queryIntentServices(new Intent(InputMethod.SERVICE_INTERFACE),PackageManager.GET_META_DATA);
  for (int i=0; i < services.size(); ++i) {
    ResolveInfo ri=services.get(i);
    ServiceInfo si=ri.serviceInfo;
    ComponentName compName=new ComponentName(si.packageName,si.name);
    if (!android.Manifest.permission.BIND_INPUT_METHOD.equals(si.permission)) {
      Slog.w(TAG,"String_Node_Str" + compName + "String_Node_Str"+ android.Manifest.permission.BIND_INPUT_METHOD);
      continue;
    }
    if (DEBUG)     Slog.d(TAG,"String_Node_Str" + compName);
    try {
      InputMethodInfo p=new InputMethodInfo(mContext,ri);
      list.add(p);
      map.put(p.getId(),p);
      if (isSystemIme(p)) {
        setInputMethodEnabledLocked(p.getId(),true);
      }
      if (DEBUG) {
        Slog.d(TAG,"String_Node_Str" + p);
      }
    }
 catch (    XmlPullParserException e) {
      Slog.w(TAG,"String_Node_Str" + compName,e);
    }
catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + compName,e);
    }
  }
  String defaultIme=Settings.Secure.getString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD);
  if (!map.containsKey(defaultIme)) {
    if (chooseNewDefaultIMELocked()) {
      updateFromSettingsLocked();
    }
  }
}
Program: 182092
Project: 182092
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float x=ev.getX(pointerIndex);
      final int xDiff=(int)Math.abs(x - mLastMotionX);
      if (xDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionX=x;
        if (mParent != null)         mParent.requestDisallowInterceptTouchEvent(true);
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float x=ev.getX();
    if (!inChild((int)x,(int)ev.getY())) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionX=x;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float x=ev.getX(pointerIndex);
      final int xDiff=(int)Math.abs(x - mLastMotionX);
      if (xDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionX=x;
        if (mParent != null)         mParent.requestDisallowInterceptTouchEvent(true);
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float x=ev.getX();
    if (!inChild((int)x,(int)ev.getY())) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionX=x;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
if (mScroller.springback(mScrollX,mScrollY,0,getScrollRange(),0,0)) {
invalidate();
}
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}
Program: 182093
Project: 182093
Buggy source:
private boolean inChild(int x,int y){
  if (getChildCount() > 0) {
    final View child=getChildAt(0);
    return !(y < child.getTop() || y >= child.getBottom() || x < child.getLeft() || x >= child.getRight());
  }
  return false;
}

Fixed version (ground truth):
private boolean inChild(int x,int y){
  if (getChildCount() > 0) {
    final int scrollX=mScrollX;
    final View child=getChildAt(0);
    return !(y < child.getTop() || y >= child.getBottom() || x < child.getLeft() - scrollX || x >= child.getRight() - scrollX);
  }
  return false;
}
Program: 182095
Project: 182095
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float y=ev.getY(pointerIndex);
      final int yDiff=(int)Math.abs(y - mLastMotionY);
      if (yDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionY=y;
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float y=ev.getY();
    if (!inChild((int)ev.getX(),(int)y)) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionY=y;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float y=ev.getY(pointerIndex);
      final int yDiff=(int)Math.abs(y - mLastMotionY);
      if (yDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionY=y;
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float y=ev.getY();
    if (!inChild((int)ev.getX(),(int)y)) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionY=y;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
if (mScroller.springback(mScrollX,mScrollY,0,0,0,getScrollRange())) {
invalidate();
}
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}
Program: 182096
Project: 182096
Buggy source:
private boolean inChild(int x,int y){
  if (getChildCount() > 0) {
    final View child=getChildAt(0);
    return !(y < child.getTop() || y >= child.getBottom() || x < child.getLeft() || x >= child.getRight());
  }
  return false;
}

Fixed version (ground truth):
private boolean inChild(int x,int y){
  if (getChildCount() > 0) {
    final int scrollY=mScrollY;
    final View child=getChildAt(0);
    return !(y < child.getTop() - scrollY || y >= child.getBottom() - scrollY || x < child.getLeft() || x >= child.getRight());
  }
  return false;
}
Program: 182097
Project: 182097
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int pointerIndex=ev.findPointerIndex(mActivePointerId);
      final float x=ev.getX(pointerIndex);
      final int xDiff=(int)Math.abs(x - mLastMotionX);
      if (xDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionX=x;
        if (mParent != null)         mParent.requestDisallowInterceptTouchEvent(true);
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float x=ev.getX();
    if (!inChild((int)x,(int)ev.getY())) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionX=x;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float x=ev.getX(pointerIndex);
      final int xDiff=(int)Math.abs(x - mLastMotionX);
      if (xDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionX=x;
        if (mParent != null)         mParent.requestDisallowInterceptTouchEvent(true);
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float x=ev.getX();
    if (!inChild((int)x,(int)ev.getY())) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionX=x;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}
Program: 182098
Project: 182098
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int pointerIndex=ev.findPointerIndex(mActivePointerId);
      final float y=ev.getY(pointerIndex);
      final int yDiff=(int)Math.abs(y - mLastMotionY);
      if (yDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionY=y;
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float y=ev.getY();
    if (!inChild((int)ev.getX(),(int)y)) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionY=y;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int activePointerId=mActivePointerId;
      if (activePointerId == INVALID_POINTER) {
        break;
      }
      final int pointerIndex=ev.findPointerIndex(activePointerId);
      final float y=ev.getY(pointerIndex);
      final int yDiff=(int)Math.abs(y - mLastMotionY);
      if (yDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionY=y;
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float y=ev.getY();
    if (!inChild((int)ev.getX(),(int)y)) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionY=y;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}
Program: 182101
Project: 182101
Buggy source:
private void doUpdateWifiState(){
  boolean wifiEnabled=getPersistedWifiEnabled();
  boolean airplaneMode=isAirplaneModeOn() && !mAirplaneModeOverwridden;
  boolean lockHeld=mLocks.hasLocks();
  int strongestLockMode;
  boolean wifiShouldBeEnabled=wifiEnabled && !airplaneMode;
  boolean wifiShouldBeStarted=!mDeviceIdle || lockHeld;
  if (mDeviceIdle && lockHeld) {
    strongestLockMode=mLocks.getStrongestLockMode();
  }
 else {
    strongestLockMode=WifiManager.WIFI_MODE_FULL;
  }
synchronized (mWifiHandler) {
    if ((mWifiStateTracker.getWifiState() == WIFI_STATE_ENABLING) && !airplaneMode) {
      return;
    }
    if (wifiShouldBeEnabled) {
      if (wifiShouldBeStarted) {
        sWakeLock.acquire();
        sendEnableMessage(true,false,mLastEnableUid);
        sWakeLock.acquire();
        sendStartMessage(strongestLockMode == WifiManager.WIFI_MODE_SCAN_ONLY);
      }
 else {
        int wakeLockTimeout=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS,DEFAULT_WAKELOCK_TIMEOUT);
        sDriverStopWakeLock.acquire();
        mWifiHandler.sendEmptyMessage(MESSAGE_STOP_WIFI);
        mWifiHandler.sendEmptyMessageDelayed(MESSAGE_RELEASE_WAKELOCK,wakeLockTimeout);
      }
    }
 else {
      sWakeLock.acquire();
      sendEnableMessage(false,false,mLastEnableUid);
    }
  }
}

Fixed version (ground truth):
private void doUpdateWifiState(){
  boolean wifiEnabled=getPersistedWifiEnabled();
  boolean airplaneMode=isAirplaneModeOn() && !mAirplaneModeOverwridden;
  boolean lockHeld=mLocks.hasLocks();
  int strongestLockMode;
  boolean wifiShouldBeEnabled=wifiEnabled && !airplaneMode;
  boolean wifiShouldBeStarted=!mDeviceIdle || lockHeld;
  if (mDeviceIdle && lockHeld) {
    strongestLockMode=mLocks.getStrongestLockMode();
  }
 else {
    strongestLockMode=WifiManager.WIFI_MODE_FULL;
  }
synchronized (mWifiHandler) {
    if ((mWifiStateTracker.getWifiState() == WIFI_STATE_ENABLING) && !airplaneMode) {
      return;
    }
    if (wifiShouldBeEnabled) {
      if (wifiShouldBeStarted) {
        sWakeLock.acquire();
        sendEnableMessage(true,false,mLastEnableUid);
        sWakeLock.acquire();
        sendStartMessage(strongestLockMode == WifiManager.WIFI_MODE_SCAN_ONLY);
      }
 else       if (!mWifiStateTracker.isDriverStopped()) {
        int wakeLockTimeout=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS,DEFAULT_WAKELOCK_TIMEOUT);
        sDriverStopWakeLock.acquire();
        mWifiHandler.sendEmptyMessage(MESSAGE_STOP_WIFI);
        mWifiHandler.sendEmptyMessageDelayed(MESSAGE_RELEASE_WAKELOCK,wakeLockTimeout);
      }
    }
 else {
      sWakeLock.acquire();
      sendEnableMessage(false,false,mLastEnableUid);
    }
  }
}