nus-yam/ex-repair huggingface dataset:
Program: 198312
Project: 198312
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  Intent intent=getIntent();
  Parcelable targetParcelable=intent.getParcelableExtra(Intent.EXTRA_INTENT);
  if (!(targetParcelable instanceof Intent)) {
    Log.w("String_Node_Str","String_Node_Str" + targetParcelable);
    finish();
    super.onCreate(null);
    return;
  }
  Intent target=(Intent)targetParcelable;
  if (target != null) {
    modifyTargetIntent(target);
  }
  mReplacementExtras=intent.getBundleExtra(Intent.EXTRA_REPLACEMENT_EXTRAS);
  CharSequence title=intent.getCharSequenceExtra(Intent.EXTRA_TITLE);
  int defaultTitleRes=0;
  if (title == null) {
    defaultTitleRes=com.android.internal.R.string.chooseActivity;
  }
  Parcelable[] pa=intent.getParcelableArrayExtra(Intent.EXTRA_INITIAL_INTENTS);
  Intent[] initialIntents=null;
  if (pa != null) {
    initialIntents=new Intent[pa.length];
    for (int i=0; i < pa.length; i++) {
      if (!(pa[i] instanceof Intent)) {
        Log.w("String_Node_Str","String_Node_Str" + i + "String_Node_Str"+ pa[i]);
        finish();
        super.onCreate(null);
        return;
      }
      final Intent in=(Intent)pa[i];
      modifyTargetIntent(in);
      initialIntents[i]=in;
    }
  }
  super.onCreate(savedInstanceState,target,title,defaultTitleRes,initialIntents,null,false);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  Intent intent=getIntent();
  Parcelable targetParcelable=intent.getParcelableExtra(Intent.EXTRA_INTENT);
  if (!(targetParcelable instanceof Intent)) {
    Log.w("String_Node_Str","String_Node_Str" + targetParcelable);
    finish();
    super.onCreate(null);
    return;
  }
  Intent target=(Intent)targetParcelable;
  if (target != null) {
    modifyTargetIntent(target);
  }
  mReplacementExtras=intent.getBundleExtra(Intent.EXTRA_REPLACEMENT_EXTRAS);
  CharSequence title=intent.getCharSequenceExtra(Intent.EXTRA_TITLE);
  int defaultTitleRes=0;
  if (title == null) {
    defaultTitleRes=com.android.internal.R.string.chooseActivity;
  }
  Parcelable[] pa=intent.getParcelableArrayExtra(Intent.EXTRA_INITIAL_INTENTS);
  Intent[] initialIntents=null;
  if (pa != null) {
    initialIntents=new Intent[pa.length];
    for (int i=0; i < pa.length; i++) {
      if (!(pa[i] instanceof Intent)) {
        Log.w("String_Node_Str","String_Node_Str" + i + "String_Node_Str"+ pa[i]);
        finish();
        super.onCreate(null);
        return;
      }
      final Intent in=(Intent)pa[i];
      modifyTargetIntent(in);
      initialIntents[i]=in;
    }
  }
  setSafeForwardingMode(true);
  super.onCreate(savedInstanceState,target,title,defaultTitleRes,initialIntents,null,false);
}
Program: 198314
Project: 198314
Buggy source:
void showAppDetails(ResolveInfo ri){
  Intent in=new Intent().setAction("String_Node_Str").setData(Uri.fromParts("String_Node_Str",ri.activityInfo.packageName,null)).addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
  startActivity(in);
}

Fixed version (ground truth):
void showAppDetails(ResolveInfo ri){
  Intent in=new Intent().setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).setData(Uri.fromParts("String_Node_Str",ri.activityInfo.packageName,null)).addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
  startActivity(in);
}
Program: 198316
Project: 198316
Buggy source:
/** 
 * Is the given data authority included in the filter?  Note that if the filter does not include any authorities, false will <em>always</em> be returned.
 * @param data The data whose authority is being looked for.
 * @return Returns true if the data string matches an authority listed in thefilter.
 */
public final boolean hasDataAuthority(Uri data){
  return matchDataAuthority(data) >= 0;
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public final boolean hasDataAuthority(AuthorityEntry auth){
  if (mDataAuthorities == null) {
    return false;
  }
  final int numDataAuthorities=mDataAuthorities.size();
  for (int i=0; i < numDataAuthorities; i++) {
    if (mDataAuthorities.get(i).match(auth)) {
      return true;
    }
  }
  return false;
}
Program: 198317
Project: 198317
Buggy source:
/** 
 * Is the given data scheme specific part included in the filter?  Note that if the filter does not include any scheme specific parts, false will <em>always</em> be returned.
 * @param data The scheme specific part that is being looked for.
 * @return Returns true if the data string matches a scheme specific part listed in thefilter.
 */
public final boolean hasDataSchemeSpecificPart(String data){
  if (mDataSchemeSpecificParts == null) {
    return false;
  }
  final int numDataSchemeSpecificParts=mDataSchemeSpecificParts.size();
  for (int i=0; i < numDataSchemeSpecificParts; i++) {
    final PatternMatcher pe=mDataSchemeSpecificParts.get(i);
    if (pe.match(data)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public final boolean hasDataSchemeSpecificPart(PatternMatcher ssp){
  if (mDataSchemeSpecificParts == null) {
    return false;
  }
  final int numDataSchemeSpecificParts=mDataSchemeSpecificParts.size();
  for (int i=0; i < numDataSchemeSpecificParts; i++) {
    final PatternMatcher pe=mDataSchemeSpecificParts.get(i);
    if (pe.getType() == ssp.getType() && pe.getPath().equals(ssp.getPath())) {
      return true;
    }
  }
  return false;
}
Program: 198318
Project: 198318
Buggy source:
/** 
 * Is the given data path included in the filter?  Note that if the filter does not include any paths, false will <em>always</em> be returned.
 * @param data The data path to look for.  This is without the schemeprefix.
 * @return True if the data string matches a path listed in thefilter.
 */
public final boolean hasDataPath(String data){
  if (mDataPaths == null) {
    return false;
  }
  final int numDataPaths=mDataPaths.size();
  for (int i=0; i < numDataPaths; i++) {
    final PatternMatcher pe=mDataPaths.get(i);
    if (pe.match(data)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public final boolean hasDataPath(PatternMatcher path){
  if (mDataPaths == null) {
    return false;
  }
  final int numDataPaths=mDataPaths.size();
  for (int i=0; i < numDataPaths; i++) {
    final PatternMatcher pe=mDataPaths.get(i);
    if (pe.getType() == path.getType() && pe.getPath().equals(path.getPath())) {
      return true;
    }
  }
  return false;
}
Program: 198319
Project: 198319
Buggy source:
private void addPreferredActivityInternal(IntentFilter filter,int match,ComponentName[] set,ComponentName activity,boolean always,int userId){
  int callingUid=Binder.getCallingUid();
  enforceCrossUserPermission(callingUid,userId,true,"String_Node_Str");
  if (filter.countActions() == 0) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
synchronized (mPackages) {
    if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS) != PackageManager.PERMISSION_GRANTED) {
      if (getUidTargetSdkVersionLockedLPr(callingUid) < Build.VERSION_CODES.FROYO) {
        Slog.w(TAG,"String_Node_Str" + callingUid);
        return;
      }
      mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS,null);
    }
    Slog.i(TAG,"String_Node_Str" + activity + "String_Node_Str"+ userId+ "String_Node_Str");
    filter.dump(new LogPrinter(Log.INFO,TAG),"String_Node_Str");
    mSettings.editPreferredActivitiesLPw(userId).addFilter(new PreferredActivity(filter,match,set,activity,always));
    mSettings.writePackageRestrictionsLPr(userId);
  }
}

Fixed version (ground truth):
private void addPreferredActivityInternal(IntentFilter filter,int match,ComponentName[] set,ComponentName activity,boolean always,int userId,String opname){
  int callingUid=Binder.getCallingUid();
  enforceCrossUserPermission(callingUid,userId,true,"String_Node_Str");
  if (filter.countActions() == 0) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
synchronized (mPackages) {
    if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS) != PackageManager.PERMISSION_GRANTED) {
      if (getUidTargetSdkVersionLockedLPr(callingUid) < Build.VERSION_CODES.FROYO) {
        Slog.w(TAG,"String_Node_Str" + callingUid);
        return;
      }
      mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS,null);
    }
    PreferredIntentResolver pir=mSettings.editPreferredActivitiesLPw(userId);
    Slog.i(TAG,opname + "String_Node_Str" + activity.flattenToShortString()+ "String_Node_Str"+ userId+ "String_Node_Str");
    filter.dump(new LogPrinter(Log.INFO,TAG),"String_Node_Str");
    pir.addFilter(new PreferredActivity(filter,match,set,activity,always));
    mSettings.writePackageRestrictionsLPr(userId);
  }
}
Program: 198320
Project: 198320
Buggy source:
@Override public void setLastChosenActivity(Intent intent,String resolvedType,int flags,IntentFilter filter,int match,ComponentName activity){
  final int userId=UserHandle.getCallingUserId();
  if (DEBUG_PREFERRED) {
    Log.v(TAG,"String_Node_Str" + intent + "String_Node_Str"+ resolvedType+ "String_Node_Str"+ flags+ "String_Node_Str"+ filter+ "String_Node_Str"+ match+ "String_Node_Str"+ activity);
    filter.dump(new PrintStreamPrinter(System.out),"String_Node_Str");
  }
  intent.setComponent(null);
  List<ResolveInfo> query=queryIntentActivities(intent,resolvedType,flags,userId);
  findPreferredActivity(intent,resolvedType,flags,query,0,false,true,false,userId);
  addPreferredActivityInternal(filter,match,null,activity,false,userId);
}

Fixed version (ground truth):
@Override public void setLastChosenActivity(Intent intent,String resolvedType,int flags,IntentFilter filter,int match,ComponentName activity){
  final int userId=UserHandle.getCallingUserId();
  if (DEBUG_PREFERRED) {
    Log.v(TAG,"String_Node_Str" + intent + "String_Node_Str"+ resolvedType+ "String_Node_Str"+ flags+ "String_Node_Str"+ filter+ "String_Node_Str"+ match+ "String_Node_Str"+ activity);
    filter.dump(new PrintStreamPrinter(System.out),"String_Node_Str");
  }
  intent.setComponent(null);
  List<ResolveInfo> query=queryIntentActivities(intent,resolvedType,flags,userId);
  findPreferredActivity(intent,resolvedType,flags,query,0,false,true,false,userId);
  addPreferredActivityInternal(filter,match,null,activity,false,userId,"String_Node_Str");
}
Program: 198321
Project: 198321
Buggy source:
@Override public void addPreferredActivity(IntentFilter filter,int match,ComponentName[] set,ComponentName activity,int userId){
  addPreferredActivityInternal(filter,match,set,activity,true,userId);
}

Fixed version (ground truth):
@Override public void addPreferredActivity(IntentFilter filter,int match,ComponentName[] set,ComponentName activity,int userId){
  addPreferredActivityInternal(filter,match,set,activity,true,userId,"String_Node_Str");
}
Program: 198323
Project: 198323
Buggy source:
/** 
 * Is the given data authority included in the filter?  Note that if the filter does not include any authorities, false will <em>always</em> be returned.
 * @param data The data whose authority is being looked for.
 * @return Returns true if the data string matches an authority listed in thefilter.
 */
public final boolean hasDataAuthority(Uri data){
  return matchDataAuthority(data) >= 0;
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public final boolean hasDataAuthority(AuthorityEntry auth){
  if (mDataAuthorities == null) {
    return false;
  }
  final int numDataAuthorities=mDataAuthorities.size();
  for (int i=0; i < numDataAuthorities; i++) {
    if (mDataAuthorities.get(i).match(auth)) {
      return true;
    }
  }
  return false;
}
Program: 198324
Project: 198324
Buggy source:
/** 
 * Is the given data scheme specific part included in the filter?  Note that if the filter does not include any scheme specific parts, false will <em>always</em> be returned.
 * @param data The scheme specific part that is being looked for.
 * @return Returns true if the data string matches a scheme specific part listed in thefilter.
 */
public final boolean hasDataSchemeSpecificPart(String data){
  if (mDataSchemeSpecificParts == null) {
    return false;
  }
  final int numDataSchemeSpecificParts=mDataSchemeSpecificParts.size();
  for (int i=0; i < numDataSchemeSpecificParts; i++) {
    final PatternMatcher pe=mDataSchemeSpecificParts.get(i);
    if (pe.match(data)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public final boolean hasDataSchemeSpecificPart(PatternMatcher ssp){
  if (mDataSchemeSpecificParts == null) {
    return false;
  }
  final int numDataSchemeSpecificParts=mDataSchemeSpecificParts.size();
  for (int i=0; i < numDataSchemeSpecificParts; i++) {
    final PatternMatcher pe=mDataSchemeSpecificParts.get(i);
    if (pe.getType() == ssp.getType() && pe.getPath().equals(ssp.getPath())) {
      return true;
    }
  }
  return false;
}
Program: 198325
Project: 198325
Buggy source:
/** 
 * Is the given data path included in the filter?  Note that if the filter does not include any paths, false will <em>always</em> be returned.
 * @param data The data path to look for.  This is without the schemeprefix.
 * @return True if the data string matches a path listed in thefilter.
 */
public final boolean hasDataPath(String data){
  if (mDataPaths == null) {
    return false;
  }
  final int numDataPaths=mDataPaths.size();
  for (int i=0; i < numDataPaths; i++) {
    final PatternMatcher pe=mDataPaths.get(i);
    if (pe.match(data)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public final boolean hasDataPath(PatternMatcher path){
  if (mDataPaths == null) {
    return false;
  }
  final int numDataPaths=mDataPaths.size();
  for (int i=0; i < numDataPaths; i++) {
    final PatternMatcher pe=mDataPaths.get(i);
    if (pe.getType() == path.getType() && pe.getPath().equals(path.getPath())) {
      return true;
    }
  }
  return false;
}
Program: 198326
Project: 198326
Buggy source:
private void addPreferredActivityInternal(IntentFilter filter,int match,ComponentName[] set,ComponentName activity,boolean always,int userId){
  int callingUid=Binder.getCallingUid();
  enforceCrossUserPermission(callingUid,userId,true,"String_Node_Str");
  if (filter.countActions() == 0) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
synchronized (mPackages) {
    if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS) != PackageManager.PERMISSION_GRANTED) {
      if (getUidTargetSdkVersionLockedLPr(callingUid) < Build.VERSION_CODES.FROYO) {
        Slog.w(TAG,"String_Node_Str" + callingUid);
        return;
      }
      mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS,null);
    }
    Slog.i(TAG,"String_Node_Str" + activity + "String_Node_Str"+ userId+ "String_Node_Str");
    filter.dump(new LogPrinter(Log.INFO,TAG),"String_Node_Str");
    mSettings.editPreferredActivitiesLPw(userId).addFilter(new PreferredActivity(filter,match,set,activity,always));
    mSettings.writePackageRestrictionsLPr(userId);
  }
}

Fixed version (ground truth):
private void addPreferredActivityInternal(IntentFilter filter,int match,ComponentName[] set,ComponentName activity,boolean always,int userId,String opname){
  int callingUid=Binder.getCallingUid();
  enforceCrossUserPermission(callingUid,userId,true,"String_Node_Str");
  if (filter.countActions() == 0) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
synchronized (mPackages) {
    if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS) != PackageManager.PERMISSION_GRANTED) {
      if (getUidTargetSdkVersionLockedLPr(callingUid) < Build.VERSION_CODES.FROYO) {
        Slog.w(TAG,"String_Node_Str" + callingUid);
        return;
      }
      mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS,null);
    }
    PreferredIntentResolver pir=mSettings.editPreferredActivitiesLPw(userId);
    Slog.i(TAG,opname + "String_Node_Str" + activity.flattenToShortString()+ "String_Node_Str"+ userId+ "String_Node_Str");
    filter.dump(new LogPrinter(Log.INFO,TAG),"String_Node_Str");
    pir.addFilter(new PreferredActivity(filter,match,set,activity,always));
    mSettings.writePackageRestrictionsLPr(userId);
  }
}
Program: 198327
Project: 198327
Buggy source:
@Override public void setLastChosenActivity(Intent intent,String resolvedType,int flags,IntentFilter filter,int match,ComponentName activity){
  final int userId=UserHandle.getCallingUserId();
  if (DEBUG_PREFERRED) {
    Log.v(TAG,"String_Node_Str" + intent + "String_Node_Str"+ resolvedType+ "String_Node_Str"+ flags+ "String_Node_Str"+ filter+ "String_Node_Str"+ match+ "String_Node_Str"+ activity);
    filter.dump(new PrintStreamPrinter(System.out),"String_Node_Str");
  }
  intent.setComponent(null);
  List<ResolveInfo> query=queryIntentActivities(intent,resolvedType,flags,userId);
  findPreferredActivity(intent,resolvedType,flags,query,0,false,true,false,userId);
  addPreferredActivityInternal(filter,match,null,activity,false,userId);
}

Fixed version (ground truth):
@Override public void setLastChosenActivity(Intent intent,String resolvedType,int flags,IntentFilter filter,int match,ComponentName activity){
  final int userId=UserHandle.getCallingUserId();
  if (DEBUG_PREFERRED) {
    Log.v(TAG,"String_Node_Str" + intent + "String_Node_Str"+ resolvedType+ "String_Node_Str"+ flags+ "String_Node_Str"+ filter+ "String_Node_Str"+ match+ "String_Node_Str"+ activity);
    filter.dump(new PrintStreamPrinter(System.out),"String_Node_Str");
  }
  intent.setComponent(null);
  List<ResolveInfo> query=queryIntentActivities(intent,resolvedType,flags,userId);
  findPreferredActivity(intent,resolvedType,flags,query,0,false,true,false,userId);
  addPreferredActivityInternal(filter,match,null,activity,false,userId,"String_Node_Str");
}
Program: 198328
Project: 198328
Buggy source:
@Override public void addPreferredActivity(IntentFilter filter,int match,ComponentName[] set,ComponentName activity,int userId){
  addPreferredActivityInternal(filter,match,set,activity,true,userId);
}

Fixed version (ground truth):
@Override public void addPreferredActivity(IntentFilter filter,int match,ComponentName[] set,ComponentName activity,int userId){
  addPreferredActivityInternal(filter,match,set,activity,true,userId,"String_Node_Str");
}
Program: 198330
Project: 198330
Buggy source:
/** 
 * Is the given data authority included in the filter?  Note that if the filter does not include any authorities, false will <em>always</em> be returned.
 * @param data The data whose authority is being looked for.
 * @return Returns true if the data string matches an authority listed in thefilter.
 */
public final boolean hasDataAuthority(Uri data){
  return matchDataAuthority(data) >= 0;
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public final boolean hasDataAuthority(AuthorityEntry auth){
  if (mDataAuthorities == null) {
    return false;
  }
  final int numDataAuthorities=mDataAuthorities.size();
  for (int i=0; i < numDataAuthorities; i++) {
    if (mDataAuthorities.get(i).match(auth)) {
      return true;
    }
  }
  return false;
}
Program: 198331
Project: 198331
Buggy source:
/** 
 * Is the given data scheme specific part included in the filter?  Note that if the filter does not include any scheme specific parts, false will <em>always</em> be returned.
 * @param data The scheme specific part that is being looked for.
 * @return Returns true if the data string matches a scheme specific part listed in thefilter.
 */
public final boolean hasDataSchemeSpecificPart(String data){
  if (mDataSchemeSpecificParts == null) {
    return false;
  }
  final int numDataSchemeSpecificParts=mDataSchemeSpecificParts.size();
  for (int i=0; i < numDataSchemeSpecificParts; i++) {
    final PatternMatcher pe=mDataSchemeSpecificParts.get(i);
    if (pe.match(data)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public final boolean hasDataSchemeSpecificPart(PatternMatcher ssp){
  if (mDataSchemeSpecificParts == null) {
    return false;
  }
  final int numDataSchemeSpecificParts=mDataSchemeSpecificParts.size();
  for (int i=0; i < numDataSchemeSpecificParts; i++) {
    final PatternMatcher pe=mDataSchemeSpecificParts.get(i);
    if (pe.getType() == ssp.getType() && pe.getPath().equals(ssp.getPath())) {
      return true;
    }
  }
  return false;
}
Program: 198332
Project: 198332
Buggy source:
/** 
 * Is the given data path included in the filter?  Note that if the filter does not include any paths, false will <em>always</em> be returned.
 * @param data The data path to look for.  This is without the schemeprefix.
 * @return True if the data string matches a path listed in thefilter.
 */
public final boolean hasDataPath(String data){
  if (mDataPaths == null) {
    return false;
  }
  final int numDataPaths=mDataPaths.size();
  for (int i=0; i < numDataPaths; i++) {
    final PatternMatcher pe=mDataPaths.get(i);
    if (pe.match(data)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public final boolean hasDataPath(PatternMatcher path){
  if (mDataPaths == null) {
    return false;
  }
  final int numDataPaths=mDataPaths.size();
  for (int i=0; i < numDataPaths; i++) {
    final PatternMatcher pe=mDataPaths.get(i);
    if (pe.getType() == path.getType() && pe.getPath().equals(path.getPath())) {
      return true;
    }
  }
  return false;
}
Program: 198333
Project: 198333
Buggy source:
private void addPreferredActivityInternal(IntentFilter filter,int match,ComponentName[] set,ComponentName activity,boolean always,int userId){
  int callingUid=Binder.getCallingUid();
  enforceCrossUserPermission(callingUid,userId,true,"String_Node_Str");
  if (filter.countActions() == 0) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
synchronized (mPackages) {
    if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS) != PackageManager.PERMISSION_GRANTED) {
      if (getUidTargetSdkVersionLockedLPr(callingUid) < Build.VERSION_CODES.FROYO) {
        Slog.w(TAG,"String_Node_Str" + callingUid);
        return;
      }
      mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS,null);
    }
    Slog.i(TAG,"String_Node_Str" + activity + "String_Node_Str"+ userId+ "String_Node_Str");
    filter.dump(new LogPrinter(Log.INFO,TAG),"String_Node_Str");
    mSettings.editPreferredActivitiesLPw(userId).addFilter(new PreferredActivity(filter,match,set,activity,always));
    mSettings.writePackageRestrictionsLPr(userId);
  }
}

Fixed version (ground truth):
private void addPreferredActivityInternal(IntentFilter filter,int match,ComponentName[] set,ComponentName activity,boolean always,int userId,String opname){
  int callingUid=Binder.getCallingUid();
  enforceCrossUserPermission(callingUid,userId,true,"String_Node_Str");
  if (filter.countActions() == 0) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
synchronized (mPackages) {
    if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS) != PackageManager.PERMISSION_GRANTED) {
      if (getUidTargetSdkVersionLockedLPr(callingUid) < Build.VERSION_CODES.FROYO) {
        Slog.w(TAG,"String_Node_Str" + callingUid);
        return;
      }
      mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SET_PREFERRED_APPLICATIONS,null);
    }
    PreferredIntentResolver pir=mSettings.editPreferredActivitiesLPw(userId);
    Slog.i(TAG,opname + "String_Node_Str" + activity.flattenToShortString()+ "String_Node_Str"+ userId+ "String_Node_Str");
    filter.dump(new LogPrinter(Log.INFO,TAG),"String_Node_Str");
    pir.addFilter(new PreferredActivity(filter,match,set,activity,always));
    mSettings.writePackageRestrictionsLPr(userId);
  }
}
Program: 198334
Project: 198334
Buggy source:
@Override public void setLastChosenActivity(Intent intent,String resolvedType,int flags,IntentFilter filter,int match,ComponentName activity){
  final int userId=UserHandle.getCallingUserId();
  if (DEBUG_PREFERRED) {
    Log.v(TAG,"String_Node_Str" + intent + "String_Node_Str"+ resolvedType+ "String_Node_Str"+ flags+ "String_Node_Str"+ filter+ "String_Node_Str"+ match+ "String_Node_Str"+ activity);
    filter.dump(new PrintStreamPrinter(System.out),"String_Node_Str");
  }
  intent.setComponent(null);
  List<ResolveInfo> query=queryIntentActivities(intent,resolvedType,flags,userId);
  findPreferredActivity(intent,resolvedType,flags,query,0,false,true,false,userId);
  addPreferredActivityInternal(filter,match,null,activity,false,userId);
}

Fixed version (ground truth):
@Override public void setLastChosenActivity(Intent intent,String resolvedType,int flags,IntentFilter filter,int match,ComponentName activity){
  final int userId=UserHandle.getCallingUserId();
  if (DEBUG_PREFERRED) {
    Log.v(TAG,"String_Node_Str" + intent + "String_Node_Str"+ resolvedType+ "String_Node_Str"+ flags+ "String_Node_Str"+ filter+ "String_Node_Str"+ match+ "String_Node_Str"+ activity);
    filter.dump(new PrintStreamPrinter(System.out),"String_Node_Str");
  }
  intent.setComponent(null);
  List<ResolveInfo> query=queryIntentActivities(intent,resolvedType,flags,userId);
  findPreferredActivity(intent,resolvedType,flags,query,0,false,true,false,userId);
  addPreferredActivityInternal(filter,match,null,activity,false,userId,"String_Node_Str");
}
Program: 198335
Project: 198335
Buggy source:
@Override public void addPreferredActivity(IntentFilter filter,int match,ComponentName[] set,ComponentName activity,int userId){
  addPreferredActivityInternal(filter,match,set,activity,true,userId);
}

Fixed version (ground truth):
@Override public void addPreferredActivity(IntentFilter filter,int match,ComponentName[] set,ComponentName activity,int userId){
  addPreferredActivityInternal(filter,match,set,activity,true,userId,"String_Node_Str");
}
Program: 198338
Project: 198338
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  Intent intent=getIntent();
  Parcelable targetParcelable=intent.getParcelableExtra(Intent.EXTRA_INTENT);
  if (!(targetParcelable instanceof Intent)) {
    Log.w("String_Node_Str","String_Node_Str" + targetParcelable);
    finish();
    super.onCreate(null);
    return;
  }
  Intent target=(Intent)targetParcelable;
  if (target != null) {
    modifyTargetIntent(target);
  }
  mReplacementExtras=intent.getBundleExtra(Intent.EXTRA_REPLACEMENT_EXTRAS);
  CharSequence title=intent.getCharSequenceExtra(Intent.EXTRA_TITLE);
  int defaultTitleRes=0;
  if (title == null) {
    defaultTitleRes=com.android.internal.R.string.chooseActivity;
  }
  Parcelable[] pa=intent.getParcelableArrayExtra(Intent.EXTRA_INITIAL_INTENTS);
  Intent[] initialIntents=null;
  if (pa != null) {
    initialIntents=new Intent[pa.length];
    for (int i=0; i < pa.length; i++) {
      if (!(pa[i] instanceof Intent)) {
        Log.w("String_Node_Str","String_Node_Str" + i + "String_Node_Str"+ pa[i]);
        finish();
        super.onCreate(null);
        return;
      }
      final Intent in=(Intent)pa[i];
      modifyTargetIntent(in);
      initialIntents[i]=in;
    }
  }
  super.onCreate(savedInstanceState,target,title,defaultTitleRes,initialIntents,null,false);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  Intent intent=getIntent();
  Parcelable targetParcelable=intent.getParcelableExtra(Intent.EXTRA_INTENT);
  if (!(targetParcelable instanceof Intent)) {
    Log.w("String_Node_Str","String_Node_Str" + targetParcelable);
    finish();
    super.onCreate(null);
    return;
  }
  Intent target=(Intent)targetParcelable;
  if (target != null) {
    modifyTargetIntent(target);
  }
  mReplacementExtras=intent.getBundleExtra(Intent.EXTRA_REPLACEMENT_EXTRAS);
  CharSequence title=intent.getCharSequenceExtra(Intent.EXTRA_TITLE);
  int defaultTitleRes=0;
  if (title == null) {
    defaultTitleRes=com.android.internal.R.string.chooseActivity;
  }
  Parcelable[] pa=intent.getParcelableArrayExtra(Intent.EXTRA_INITIAL_INTENTS);
  Intent[] initialIntents=null;
  if (pa != null) {
    initialIntents=new Intent[pa.length];
    for (int i=0; i < pa.length; i++) {
      if (!(pa[i] instanceof Intent)) {
        Log.w("String_Node_Str","String_Node_Str" + i + "String_Node_Str"+ pa[i]);
        finish();
        super.onCreate(null);
        return;
      }
      final Intent in=(Intent)pa[i];
      modifyTargetIntent(in);
      initialIntents[i]=in;
    }
  }
  setSafeForwardingMode(true);
  super.onCreate(savedInstanceState,target,title,defaultTitleRes,initialIntents,null,false);
}
Program: 198340
Project: 198340
Buggy source:
void showAppDetails(ResolveInfo ri){
  Intent in=new Intent().setAction("String_Node_Str").setData(Uri.fromParts("String_Node_Str",ri.activityInfo.packageName,null)).addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
  startActivity(in);
}

Fixed version (ground truth):
void showAppDetails(ResolveInfo ri){
  Intent in=new Intent().setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).setData(Uri.fromParts("String_Node_Str",ri.activityInfo.packageName,null)).addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
  startActivity(in);
}
Program: 198343
Project: 198343
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  Intent intent=getIntent();
  Parcelable targetParcelable=intent.getParcelableExtra(Intent.EXTRA_INTENT);
  if (!(targetParcelable instanceof Intent)) {
    Log.w("String_Node_Str","String_Node_Str" + targetParcelable);
    finish();
    super.onCreate(null);
    return;
  }
  Intent target=(Intent)targetParcelable;
  if (target != null) {
    modifyTargetIntent(target);
  }
  mReplacementExtras=intent.getBundleExtra(Intent.EXTRA_REPLACEMENT_EXTRAS);
  CharSequence title=intent.getCharSequenceExtra(Intent.EXTRA_TITLE);
  int defaultTitleRes=0;
  if (title == null) {
    defaultTitleRes=com.android.internal.R.string.chooseActivity;
  }
  Parcelable[] pa=intent.getParcelableArrayExtra(Intent.EXTRA_INITIAL_INTENTS);
  Intent[] initialIntents=null;
  if (pa != null) {
    initialIntents=new Intent[pa.length];
    for (int i=0; i < pa.length; i++) {
      if (!(pa[i] instanceof Intent)) {
        Log.w("String_Node_Str","String_Node_Str" + i + "String_Node_Str"+ pa[i]);
        finish();
        super.onCreate(null);
        return;
      }
      final Intent in=(Intent)pa[i];
      modifyTargetIntent(in);
      initialIntents[i]=in;
    }
  }
  super.onCreate(savedInstanceState,target,title,defaultTitleRes,initialIntents,null,false);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  Intent intent=getIntent();
  Parcelable targetParcelable=intent.getParcelableExtra(Intent.EXTRA_INTENT);
  if (!(targetParcelable instanceof Intent)) {
    Log.w("String_Node_Str","String_Node_Str" + targetParcelable);
    finish();
    super.onCreate(null);
    return;
  }
  Intent target=(Intent)targetParcelable;
  if (target != null) {
    modifyTargetIntent(target);
  }
  mReplacementExtras=intent.getBundleExtra(Intent.EXTRA_REPLACEMENT_EXTRAS);
  CharSequence title=intent.getCharSequenceExtra(Intent.EXTRA_TITLE);
  int defaultTitleRes=0;
  if (title == null) {
    defaultTitleRes=com.android.internal.R.string.chooseActivity;
  }
  Parcelable[] pa=intent.getParcelableArrayExtra(Intent.EXTRA_INITIAL_INTENTS);
  Intent[] initialIntents=null;
  if (pa != null) {
    initialIntents=new Intent[pa.length];
    for (int i=0; i < pa.length; i++) {
      if (!(pa[i] instanceof Intent)) {
        Log.w("String_Node_Str","String_Node_Str" + i + "String_Node_Str"+ pa[i]);
        finish();
        super.onCreate(null);
        return;
      }
      final Intent in=(Intent)pa[i];
      modifyTargetIntent(in);
      initialIntents[i]=in;
    }
  }
  setSafeForwardingMode(true);
  super.onCreate(savedInstanceState,target,title,defaultTitleRes,initialIntents,null,false);
}
Program: 198345
Project: 198345
Buggy source:
void showAppDetails(ResolveInfo ri){
  Intent in=new Intent().setAction("String_Node_Str").setData(Uri.fromParts("String_Node_Str",ri.activityInfo.packageName,null)).addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
  startActivity(in);
}

Fixed version (ground truth):
void showAppDetails(ResolveInfo ri){
  Intent in=new Intent().setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).setData(Uri.fromParts("String_Node_Str",ri.activityInfo.packageName,null)).addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
  startActivity(in);
}
Program: 198347
Project: 198347
Buggy source:
/** 
 * Reads the network specific MTU size from reources. and set it on it's iface.
 */
private void updateMtu(LinkProperties newLp,LinkProperties oldLp){
  final String iface=newLp.getInterfaceName();
  final int mtu=newLp.getMtu();
  if (oldLp != null && newLp.isIdenticalMtu(oldLp)) {
    if (VDBG)     log("String_Node_Str");
    return;
  }
  if (LinkProperties.isValidMtu(mtu,newLp.hasGlobalIPv6Address())) {
    loge("String_Node_Str" + mtu + "String_Node_Str"+ iface);
    return;
  }
  if (TextUtils.isEmpty(iface)) {
    loge("String_Node_Str");
    return;
  }
  try {
    if (VDBG)     log("String_Node_Str" + iface + "String_Node_Str"+ mtu);
    mNetd.setMtu(iface,mtu);
  }
 catch (  Exception e) {
    Slog.e(TAG,"String_Node_Str" + e);
  }
}

Fixed version (ground truth):
/** 
 * Reads the network specific MTU size from reources. and set it on it's iface.
 */
private void updateMtu(LinkProperties newLp,LinkProperties oldLp){
  final String iface=newLp.getInterfaceName();
  final int mtu=newLp.getMtu();
  if (oldLp != null && newLp.isIdenticalMtu(oldLp)) {
    if (VDBG)     log("String_Node_Str");
    return;
  }
  if (LinkProperties.isValidMtu(mtu,newLp.hasGlobalIPv6Address()) == false) {
    loge("String_Node_Str" + mtu + "String_Node_Str"+ iface);
    return;
  }
  if (TextUtils.isEmpty(iface)) {
    loge("String_Node_Str");
    return;
  }
  try {
    if (VDBG)     log("String_Node_Str" + iface + "String_Node_Str"+ mtu);
    mNetd.setMtu(iface,mtu);
  }
 catch (  Exception e) {
    Slog.e(TAG,"String_Node_Str" + e);
  }
}
Program: 198348
Project: 198348
Buggy source:
/** 
 * Reads the network specific MTU size from reources. and set it on it's iface.
 */
private void updateMtu(LinkProperties newLp,LinkProperties oldLp){
  final String iface=newLp.getInterfaceName();
  final int mtu=newLp.getMtu();
  if (oldLp != null && newLp.isIdenticalMtu(oldLp)) {
    if (VDBG)     log("String_Node_Str");
    return;
  }
  if (LinkProperties.isValidMtu(mtu,newLp.hasGlobalIPv6Address())) {
    loge("String_Node_Str" + mtu + "String_Node_Str"+ iface);
    return;
  }
  if (TextUtils.isEmpty(iface)) {
    loge("String_Node_Str");
    return;
  }
  try {
    if (VDBG)     log("String_Node_Str" + iface + "String_Node_Str"+ mtu);
    mNetd.setMtu(iface,mtu);
  }
 catch (  Exception e) {
    Slog.e(TAG,"String_Node_Str" + e);
  }
}

Fixed version (ground truth):
/** 
 * Reads the network specific MTU size from reources. and set it on it's iface.
 */
private void updateMtu(LinkProperties newLp,LinkProperties oldLp){
  final String iface=newLp.getInterfaceName();
  final int mtu=newLp.getMtu();
  if (oldLp != null && newLp.isIdenticalMtu(oldLp)) {
    if (VDBG)     log("String_Node_Str");
    return;
  }
  if (LinkProperties.isValidMtu(mtu,newLp.hasGlobalIPv6Address()) == false) {
    loge("String_Node_Str" + mtu + "String_Node_Str"+ iface);
    return;
  }
  if (TextUtils.isEmpty(iface)) {
    loge("String_Node_Str");
    return;
  }
  try {
    if (VDBG)     log("String_Node_Str" + iface + "String_Node_Str"+ mtu);
    mNetd.setMtu(iface,mtu);
  }
 catch (  Exception e) {
    Slog.e(TAG,"String_Node_Str" + e);
  }
}
Program: 198349
Project: 198349
Buggy source:
@Override public void onStateChanged(Connection c,int state){
switch (state) {
case Connection.STATE_FAILED:
    Log.d(this,"String_Node_Str",request,c.getFailureCode(),c.getFailureMessage());
  Log.d(this,"String_Node_Str",callId);
mAdapter.handleCreateConnectionFailed(callId,request,c.getFailureCode(),c.getFailureMessage());
break;
case Connection.STATE_CANCELED:
Log.d(this,"String_Node_Str",callId);
mAdapter.handleCreateConnectionCancelled(callId,request);
break;
case Connection.STATE_INITIALIZING:
Log.d(this,"String_Node_Str");
return;
default :
Log.d(this,"String_Node_Str",Connection.stateToString(state));
connectionCreated(callId,request,createdConnection);
break;
}
c.removeConnectionListener(this);
}

Fixed version (ground truth):
@Override public void onStateChanged(Connection c,int state){
switch (state) {
case Connection.STATE_FAILED:
    Log.d(this,"String_Node_Str",request,c.getFailureCode(),c.getFailureMessage());
  Log.d(this,"String_Node_Str",callId);
mAdapter.handleCreateConnectionFailed(callId,request,c.getFailureCode(),c.getFailureMessage());
break;
case Connection.STATE_CANCELED:
Log.d(this,"String_Node_Str",callId);
mAdapter.handleCreateConnectionCancelled(callId,request);
break;
case Connection.STATE_INITIALIZING:
Log.d(this,"String_Node_Str");
return;
}
c.removeConnectionListener(this);
}
Program: 198351
Project: 198351
Buggy source:
@Override public void onStateChanged(Connection c,int state){
switch (state) {
case Connection.STATE_FAILED:
    Log.d(this,"String_Node_Str",request,c.getFailureCode(),c.getFailureMessage());
  Log.d(this,"String_Node_Str",callId);
mAdapter.handleCreateConnectionFailed(callId,request,c.getFailureCode(),c.getFailureMessage());
break;
case Connection.STATE_CANCELED:
Log.d(this,"String_Node_Str",callId);
mAdapter.handleCreateConnectionCancelled(callId,request);
break;
case Connection.STATE_INITIALIZING:
Log.d(this,"String_Node_Str");
return;
default :
Log.d(this,"String_Node_Str",Connection.stateToString(state));
connectionCreated(callId,request,createdConnection);
break;
}
c.removeConnectionListener(this);
}

Fixed version (ground truth):
@Override public void onStateChanged(Connection c,int state){
switch (state) {
case Connection.STATE_FAILED:
    Log.d(this,"String_Node_Str",request,c.getFailureCode(),c.getFailureMessage());
  Log.d(this,"String_Node_Str",callId);
mAdapter.handleCreateConnectionFailed(callId,request,c.getFailureCode(),c.getFailureMessage());
break;
case Connection.STATE_CANCELED:
Log.d(this,"String_Node_Str",callId);
mAdapter.handleCreateConnectionCancelled(callId,request);
break;
case Connection.STATE_INITIALIZING:
Log.d(this,"String_Node_Str");
return;
}
c.removeConnectionListener(this);
}
Program: 198353
Project: 198353
Buggy source:
@Override public void onStateChanged(Connection c,int state){
switch (state) {
case Connection.STATE_FAILED:
    Log.d(this,"String_Node_Str",request,c.getFailureCode(),c.getFailureMessage());
  Log.d(this,"String_Node_Str",callId);
mAdapter.handleCreateConnectionFailed(callId,request,c.getFailureCode(),c.getFailureMessage());
break;
case Connection.STATE_CANCELED:
Log.d(this,"String_Node_Str",callId);
mAdapter.handleCreateConnectionCancelled(callId,request);
break;
case Connection.STATE_INITIALIZING:
Log.d(this,"String_Node_Str");
return;
default :
Log.d(this,"String_Node_Str",Connection.stateToString(state));
connectionCreated(callId,request,createdConnection);
break;
}
c.removeConnectionListener(this);
}

Fixed version (ground truth):
@Override public void onStateChanged(Connection c,int state){
switch (state) {
case Connection.STATE_FAILED:
    Log.d(this,"String_Node_Str",request,c.getFailureCode(),c.getFailureMessage());
  Log.d(this,"String_Node_Str",callId);
mAdapter.handleCreateConnectionFailed(callId,request,c.getFailureCode(),c.getFailureMessage());
break;
case Connection.STATE_CANCELED:
Log.d(this,"String_Node_Str",callId);
mAdapter.handleCreateConnectionCancelled(callId,request);
break;
case Connection.STATE_INITIALIZING:
Log.d(this,"String_Node_Str");
return;
}
c.removeConnectionListener(this);
}
Program: 198355
Project: 198355
Buggy source:
@Override public void onChange(boolean selfChange,Uri uri){
  if (selfChange)   return;
  if (BRIGHTNESS_MODE_URI.equals(uri)) {
    updateMode();
    updateSlider();
  }
 else   if (BRIGHTNESS_URI.equals(uri) && !mAutomatic) {
    updateSlider();
  }
 else   if (BRIGHTNESS_ADJ_URI.equals(uri) && mAutomatic) {
    updateSlider();
  }
 else {
    updateMode();
    updateSlider();
  }
  for (  BrightnessStateChangeCallback cb : mChangeCallbacks) {
    cb.onBrightnessLevelChanged();
  }
}

Fixed version (ground truth):
@Override public void onChange(boolean selfChange,Uri uri){
  if (selfChange)   return;
  try {
    mExternalChange=true;
    if (BRIGHTNESS_MODE_URI.equals(uri)) {
      updateMode();
      updateSlider();
    }
 else     if (BRIGHTNESS_URI.equals(uri) && !mAutomatic) {
      updateSlider();
    }
 else     if (BRIGHTNESS_ADJ_URI.equals(uri) && mAutomatic) {
      updateSlider();
    }
 else {
      updateMode();
      updateSlider();
    }
    for (    BrightnessStateChangeCallback cb : mChangeCallbacks) {
      cb.onBrightnessLevelChanged();
    }
  }
  finally {
    mExternalChange=false;
  }
}
Program: 198356
Project: 198356
Buggy source:
@Override public void onChanged(ToggleSlider view,boolean tracking,boolean automatic,int value){
  updateIcon(mAutomatic);
  if (!mAutomatic) {
    final int val=value + mMinimumBacklight;
    setBrightness(val);
    if (!tracking) {
      AsyncTask.execute(new Runnable(){
        public void run(){
          Settings.System.putIntForUser(mContext.getContentResolver(),Settings.System.SCREEN_BRIGHTNESS,val,UserHandle.USER_CURRENT);
        }
      }
);
    }
  }
 else {
    final float adj=value / (BRIGHTNESS_ADJ_RESOLUTION / 2f) - 1;
    setBrightnessAdj(adj);
    if (!tracking) {
      AsyncTask.execute(new Runnable(){
        public void run(){
          Settings.System.putFloatForUser(mContext.getContentResolver(),Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ,adj,UserHandle.USER_CURRENT);
        }
      }
);
    }
  }
  for (  BrightnessStateChangeCallback cb : mChangeCallbacks) {
    cb.onBrightnessLevelChanged();
  }
}

Fixed version (ground truth):
@Override public void onChanged(ToggleSlider view,boolean tracking,boolean automatic,int value){
  updateIcon(mAutomatic);
  if (mExternalChange)   return;
  if (!mAutomatic) {
    final int val=value + mMinimumBacklight;
    setBrightness(val);
    if (!tracking) {
      AsyncTask.execute(new Runnable(){
        public void run(){
          Settings.System.putIntForUser(mContext.getContentResolver(),Settings.System.SCREEN_BRIGHTNESS,val,UserHandle.USER_CURRENT);
        }
      }
);
    }
  }
 else {
    final float adj=value / (BRIGHTNESS_ADJ_RESOLUTION / 2f) - 1;
    setBrightnessAdj(adj);
    if (!tracking) {
      AsyncTask.execute(new Runnable(){
        public void run(){
          Settings.System.putFloatForUser(mContext.getContentResolver(),Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ,adj,UserHandle.USER_CURRENT);
        }
      }
);
    }
  }
  for (  BrightnessStateChangeCallback cb : mChangeCallbacks) {
    cb.onBrightnessLevelChanged();
  }
}
Program: 198357
Project: 198357
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final Window window=getWindow();
  final WindowManager.LayoutParams lp=window.getAttributes();
  lp.y=getResources().getDimensionPixelOffset(R.dimen.volume_panel_top);
  lp.type=WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY;
  lp.privateFlags|=WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
  window.setAttributes(lp);
  window.setGravity(Gravity.TOP);
  window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
  window.requestFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.quick_settings_brightness_dialog);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final Window window=getWindow();
  window.setGravity(Gravity.TOP);
  window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
  window.requestFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.quick_settings_brightness_dialog);
  final ImageView icon=(ImageView)findViewById(R.id.brightness_icon);
  final ToggleSlider slider=(ToggleSlider)findViewById(R.id.brightness_slider);
  mBrightnessController=new BrightnessController(this,icon,slider);
}
Program: 198358
Project: 198358
Buggy source:
@Override protected void onStart(){
  super.onStart();
  final ImageView icon=(ImageView)findViewById(R.id.brightness_icon);
  final ToggleSlider slider=(ToggleSlider)findViewById(R.id.brightness_slider);
  mBrightnessController=new BrightnessController(this,icon,slider);
  mBrightnessController.registerCallbacks();
}

Fixed version (ground truth):
@Override protected void onStart(){
  super.onStart();
  mBrightnessController.registerCallbacks();
}
Program: 198359
Project: 198359
Buggy source:
@Override public void onChange(boolean selfChange,Uri uri){
  if (selfChange)   return;
  if (BRIGHTNESS_MODE_URI.equals(uri)) {
    updateMode();
    updateSlider();
  }
 else   if (BRIGHTNESS_URI.equals(uri) && !mAutomatic) {
    updateSlider();
  }
 else   if (BRIGHTNESS_ADJ_URI.equals(uri) && mAutomatic) {
    updateSlider();
  }
 else {
    updateMode();
    updateSlider();
  }
  for (  BrightnessStateChangeCallback cb : mChangeCallbacks) {
    cb.onBrightnessLevelChanged();
  }
}

Fixed version (ground truth):
@Override public void onChange(boolean selfChange,Uri uri){
  if (selfChange)   return;
  try {
    mExternalChange=true;
    if (BRIGHTNESS_MODE_URI.equals(uri)) {
      updateMode();
      updateSlider();
    }
 else     if (BRIGHTNESS_URI.equals(uri) && !mAutomatic) {
      updateSlider();
    }
 else     if (BRIGHTNESS_ADJ_URI.equals(uri) && mAutomatic) {
      updateSlider();
    }
 else {
      updateMode();
      updateSlider();
    }
    for (    BrightnessStateChangeCallback cb : mChangeCallbacks) {
      cb.onBrightnessLevelChanged();
    }
  }
  finally {
    mExternalChange=false;
  }
}
Program: 198360
Project: 198360
Buggy source:
@Override public void onChanged(ToggleSlider view,boolean tracking,boolean automatic,int value){
  updateIcon(mAutomatic);
  if (!mAutomatic) {
    final int val=value + mMinimumBacklight;
    setBrightness(val);
    if (!tracking) {
      AsyncTask.execute(new Runnable(){
        public void run(){
          Settings.System.putIntForUser(mContext.getContentResolver(),Settings.System.SCREEN_BRIGHTNESS,val,UserHandle.USER_CURRENT);
        }
      }
);
    }
  }
 else {
    final float adj=value / (BRIGHTNESS_ADJ_RESOLUTION / 2f) - 1;
    setBrightnessAdj(adj);
    if (!tracking) {
      AsyncTask.execute(new Runnable(){
        public void run(){
          Settings.System.putFloatForUser(mContext.getContentResolver(),Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ,adj,UserHandle.USER_CURRENT);
        }
      }
);
    }
  }
  for (  BrightnessStateChangeCallback cb : mChangeCallbacks) {
    cb.onBrightnessLevelChanged();
  }
}

Fixed version (ground truth):
@Override public void onChanged(ToggleSlider view,boolean tracking,boolean automatic,int value){
  updateIcon(mAutomatic);
  if (mExternalChange)   return;
  if (!mAutomatic) {
    final int val=value + mMinimumBacklight;
    setBrightness(val);
    if (!tracking) {
      AsyncTask.execute(new Runnable(){
        public void run(){
          Settings.System.putIntForUser(mContext.getContentResolver(),Settings.System.SCREEN_BRIGHTNESS,val,UserHandle.USER_CURRENT);
        }
      }
);
    }
  }
 else {
    final float adj=value / (BRIGHTNESS_ADJ_RESOLUTION / 2f) - 1;
    setBrightnessAdj(adj);
    if (!tracking) {
      AsyncTask.execute(new Runnable(){
        public void run(){
          Settings.System.putFloatForUser(mContext.getContentResolver(),Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ,adj,UserHandle.USER_CURRENT);
        }
      }
);
    }
  }
  for (  BrightnessStateChangeCallback cb : mChangeCallbacks) {
    cb.onBrightnessLevelChanged();
  }
}