nus-yam/ex-repair huggingface dataset:
Program: 836
Project: 836
Buggy source:
@Override public List<PeriodicSync> getPeriodicSyncs(Account account,String providerName){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    return getSyncManager().getSyncStorageEngine().getPeriodicSyncs(account,userId,providerName);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}

Fixed version (ground truth):
@Override public List<PeriodicSync> getPeriodicSyncs(Account account,String providerName){
  if (account == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (TextUtils.isEmpty(providerName)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    return getSyncManager().getSyncStorageEngine().getPeriodicSyncs(account,userId,providerName);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}
Program: 837
Project: 837
Buggy source:
public SyncStatusInfo getSyncStatus(Account account,String authority){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      return syncManager.getSyncStorageEngine().getStatusByAccountAndAuthority(account,userId,authority);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
  return null;
}

Fixed version (ground truth):
public SyncStatusInfo getSyncStatus(Account account,String authority){
  if (TextUtils.isEmpty(authority)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      return syncManager.getSyncStorageEngine().getStatusByAccountAndAuthority(account,userId,authority);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
  return null;
}
Program: 838
Project: 838
Buggy source:
@Override public void removePeriodicSync(Account account,String authority,Bundle extras){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    PeriodicSync syncToRemove=new PeriodicSync(account,authority,extras,0,0);
    getSyncManager().getSyncStorageEngine().removePeriodicSync(syncToRemove,userId);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}

Fixed version (ground truth):
@Override public void removePeriodicSync(Account account,String authority,Bundle extras){
  if (account == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (TextUtils.isEmpty(authority)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    PeriodicSync syncToRemove=new PeriodicSync(account,authority,extras,0,0);
    getSyncManager().getSyncStorageEngine().removePeriodicSync(syncToRemove,userId);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}
Program: 840
Project: 840
Buggy source:
/** 
 * Returns the status that matches the authority and account.
 * @param account the account we want to check
 * @param authority the authority whose row should be selected
 * @return the SyncStatusInfo for the authority
 */
public SyncStatusInfo getStatusByAccountAndAuthority(Account account,int userId,String authority){
  if (account == null || authority == null) {
    throw new IllegalArgumentException();
  }
synchronized (mAuthorities) {
    final int N=mSyncStatus.size();
    for (int i=0; i < N; i++) {
      SyncStatusInfo cur=mSyncStatus.valueAt(i);
      AuthorityInfo ainfo=mAuthorities.get(cur.authorityId);
      if (ainfo != null && ainfo.authority.equals(authority) && ainfo.userId == userId && account.equals(ainfo.account)) {
        return cur;
      }
    }
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns the status that matches the authority and account.
 * @param account the account we want to check
 * @param authority the authority whose row should be selected
 * @return the SyncStatusInfo for the authority or null if none found.
 */
public SyncStatusInfo getStatusByAccountAndAuthority(Account account,int userId,String authority){
  if (account == null || authority == null) {
    return null;
  }
synchronized (mAuthorities) {
    final int N=mSyncStatus.size();
    for (int i=0; i < N; i++) {
      SyncStatusInfo cur=mSyncStatus.valueAt(i);
      AuthorityInfo ainfo=mAuthorities.get(cur.authorityId);
      if (ainfo != null && ainfo.authority.equals(authority) && ainfo.userId == userId && account.equals(ainfo.account)) {
        return cur;
      }
    }
    return null;
  }
}
Program: 841
Project: 841
Buggy source:
/** 
 * Get the list of information about the periodic syncs for the given account and authority. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_SETTINGS}.
 * @param account the account whose periodic syncs we are querying
 * @param authority the provider whose periodic syncs we are querying
 * @return a list of PeriodicSync objects. This list may be empty but will never be null.
 */
public static List<PeriodicSync> getPeriodicSyncs(Account account,String authority){
  if (account == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (authority == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    return getContentService().getPeriodicSyncs(account,authority);
  }
 catch (  RemoteException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Get the list of information about the periodic syncs for the given account and authority. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_SETTINGS}.
 * @param account the account whose periodic syncs we are querying
 * @param authority the provider whose periodic syncs we are querying
 * @return a list of PeriodicSync objects. This list may be empty but will never be null.
 */
public static List<PeriodicSync> getPeriodicSyncs(Account account,String authority){
  try {
    return getContentService().getPeriodicSyncs(account,authority);
  }
 catch (  RemoteException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 843
Project: 843
Buggy source:
/** 
 * Remove a periodic sync. Has no affect if account, authority and extras don't match an existing periodic sync. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account of the periodic sync to remove
 * @param authority the provider of the periodic sync to remove
 * @param extras the extras of the periodic sync to remove
 */
public static void removePeriodicSync(Account account,String authority,Bundle extras){
  validateSyncExtrasBundle(extras);
  if (account == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (authority == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    getContentService().removePeriodicSync(account,authority,extras);
  }
 catch (  RemoteException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Remove a periodic sync. Has no affect if account, authority and extras don't match an existing periodic sync. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account of the periodic sync to remove
 * @param authority the provider of the periodic sync to remove
 * @param extras the extras of the periodic sync to remove
 */
public static void removePeriodicSync(Account account,String authority,Bundle extras){
  validateSyncExtrasBundle(extras);
  try {
    getContentService().removePeriodicSync(account,authority,extras);
  }
 catch (  RemoteException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 844
Project: 844
Buggy source:
/** 
 * Specify an authority and account for this transfer.
 * @param authority String identifying which content provider to sync.
 * @param account Account to sync. Can be null unless this is a periodic sync.
 */
public Builder setSyncAdapter(Account account,String authority){
  if (mSyncTarget != SYNC_TARGET_UNKNOWN) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mSyncTarget=SYNC_TARGET_ADAPTER;
  mAccount=account;
  mAuthority=authority;
  mComponentName=null;
  return this;
}

Fixed version (ground truth):
/** 
 * Specify an authority and account for this transfer.
 * @param authority String identifying which content provider to sync.
 * @param account Account to sync. Can be null unless this is a periodic sync.
 */
public Builder setSyncAdapter(Account account,String authority){
  if (mSyncTarget != SYNC_TARGET_UNKNOWN) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (authority != null && authority.length() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mSyncTarget=SYNC_TARGET_ADAPTER;
  mAccount=account;
  mAuthority=authority;
  mComponentName=null;
  return this;
}
Program: 845
Project: 845
Buggy source:
/** 
 * Old API. Schedule periodic sync with default flex time.
 */
@Override public void addPeriodicSync(Account account,String authority,Bundle extras,long pollFrequency){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  if (pollFrequency < 60) {
    Slog.w(TAG,"String_Node_Str" + pollFrequency + "String_Node_Str");
    pollFrequency=60;
  }
  long identityToken=clearCallingIdentity();
  try {
    PeriodicSync syncToAdd=new PeriodicSync(account,authority,extras,pollFrequency,SyncStorageEngine.calculateDefaultFlexTime(pollFrequency));
    getSyncManager().getSyncStorageEngine().addPeriodicSync(syncToAdd,userId);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}

Fixed version (ground truth):
/** 
 * Old API. Schedule periodic sync with default flex time. 
 */
@Override public void addPeriodicSync(Account account,String authority,Bundle extras,long pollFrequency){
  if (account == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (TextUtils.isEmpty(authority)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  if (pollFrequency < 60) {
    Slog.w(TAG,"String_Node_Str" + pollFrequency + "String_Node_Str");
    pollFrequency=60;
  }
  long identityToken=clearCallingIdentity();
  try {
    PeriodicSync syncToAdd=new PeriodicSync(account,authority,extras,pollFrequency,SyncStorageEngine.calculateDefaultFlexTime(pollFrequency));
    getSyncManager().getSyncStorageEngine().addPeriodicSync(syncToAdd,userId);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}
Program: 846
Project: 846
Buggy source:
@Override public void setSyncAutomatically(Account account,String providerName,boolean sync){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      syncManager.getSyncStorageEngine().setSyncAutomatically(account,userId,providerName,sync);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}

Fixed version (ground truth):
@Override public void setSyncAutomatically(Account account,String providerName,boolean sync){
  if (TextUtils.isEmpty(providerName)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      syncManager.getSyncStorageEngine().setSyncAutomatically(account,userId,providerName,sync);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}
Program: 847
Project: 847
Buggy source:
/** 
 * Clear all scheduled sync operations that match the uri and cancel the active sync if they match the authority and account, if they are present.
 * @param account filter the pending and active syncs to cancel using this account
 * @param authority filter the pending and active syncs to cancel using this authority
 */
@Override public void cancelSync(Account account,String authority){
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      syncManager.clearScheduledSyncOperations(account,userId,authority);
      syncManager.cancelActiveSync(account,userId,authority);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}

Fixed version (ground truth):
/** 
 * Clear all scheduled sync operations that match the uri and cancel the active sync if they match the authority and account, if they are present.
 * @param account filter the pending and active syncs to cancel using this account
 * @param authority filter the pending and active syncs to cancel using this authority
 */
@Override public void cancelSync(Account account,String authority){
  if (authority != null && authority.length() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      syncManager.clearScheduledSyncOperations(account,userId,authority);
      syncManager.cancelActiveSync(account,userId,authority);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}
Program: 848
Project: 848
Buggy source:
@Override public void setIsSyncable(Account account,String providerName,int syncable){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      syncManager.getSyncStorageEngine().setIsSyncable(account,userId,providerName,syncable);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}

Fixed version (ground truth):
@Override public void setIsSyncable(Account account,String providerName,int syncable){
  if (TextUtils.isEmpty(providerName)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      syncManager.getSyncStorageEngine().setIsSyncable(account,userId,providerName,syncable);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}
Program: 850
Project: 850
Buggy source:
@Override public List<PeriodicSync> getPeriodicSyncs(Account account,String providerName){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    return getSyncManager().getSyncStorageEngine().getPeriodicSyncs(account,userId,providerName);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}

Fixed version (ground truth):
@Override public List<PeriodicSync> getPeriodicSyncs(Account account,String providerName){
  if (account == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (TextUtils.isEmpty(providerName)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    return getSyncManager().getSyncStorageEngine().getPeriodicSyncs(account,userId,providerName);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}
Program: 851
Project: 851
Buggy source:
public SyncStatusInfo getSyncStatus(Account account,String authority){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      return syncManager.getSyncStorageEngine().getStatusByAccountAndAuthority(account,userId,authority);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
  return null;
}

Fixed version (ground truth):
public SyncStatusInfo getSyncStatus(Account account,String authority){
  if (TextUtils.isEmpty(authority)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      return syncManager.getSyncStorageEngine().getStatusByAccountAndAuthority(account,userId,authority);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
  return null;
}
Program: 852
Project: 852
Buggy source:
@Override public void removePeriodicSync(Account account,String authority,Bundle extras){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    PeriodicSync syncToRemove=new PeriodicSync(account,authority,extras,0,0);
    getSyncManager().getSyncStorageEngine().removePeriodicSync(syncToRemove,userId);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}

Fixed version (ground truth):
@Override public void removePeriodicSync(Account account,String authority,Bundle extras){
  if (account == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (TextUtils.isEmpty(authority)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    PeriodicSync syncToRemove=new PeriodicSync(account,authority,extras,0,0);
    getSyncManager().getSyncStorageEngine().removePeriodicSync(syncToRemove,userId);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}
Program: 854
Project: 854
Buggy source:
/** 
 * Returns the status that matches the authority and account.
 * @param account the account we want to check
 * @param authority the authority whose row should be selected
 * @return the SyncStatusInfo for the authority
 */
public SyncStatusInfo getStatusByAccountAndAuthority(Account account,int userId,String authority){
  if (account == null || authority == null) {
    throw new IllegalArgumentException();
  }
synchronized (mAuthorities) {
    final int N=mSyncStatus.size();
    for (int i=0; i < N; i++) {
      SyncStatusInfo cur=mSyncStatus.valueAt(i);
      AuthorityInfo ainfo=mAuthorities.get(cur.authorityId);
      if (ainfo != null && ainfo.authority.equals(authority) && ainfo.userId == userId && account.equals(ainfo.account)) {
        return cur;
      }
    }
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns the status that matches the authority and account.
 * @param account the account we want to check
 * @param authority the authority whose row should be selected
 * @return the SyncStatusInfo for the authority or null if none found.
 */
public SyncStatusInfo getStatusByAccountAndAuthority(Account account,int userId,String authority){
  if (account == null || authority == null) {
    return null;
  }
synchronized (mAuthorities) {
    final int N=mSyncStatus.size();
    for (int i=0; i < N; i++) {
      SyncStatusInfo cur=mSyncStatus.valueAt(i);
      AuthorityInfo ainfo=mAuthorities.get(cur.authorityId);
      if (ainfo != null && ainfo.authority.equals(authority) && ainfo.userId == userId && account.equals(ainfo.account)) {
        return cur;
      }
    }
    return null;
  }
}
Program: 855
Project: 855
Buggy source:
/** 
 * Get the list of information about the periodic syncs for the given account and authority. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_SETTINGS}.
 * @param account the account whose periodic syncs we are querying
 * @param authority the provider whose periodic syncs we are querying
 * @return a list of PeriodicSync objects. This list may be empty but will never be null.
 */
public static List<PeriodicSync> getPeriodicSyncs(Account account,String authority){
  if (account == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (authority == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    return getContentService().getPeriodicSyncs(account,authority);
  }
 catch (  RemoteException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Get the list of information about the periodic syncs for the given account and authority. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_SETTINGS}.
 * @param account the account whose periodic syncs we are querying
 * @param authority the provider whose periodic syncs we are querying
 * @return a list of PeriodicSync objects. This list may be empty but will never be null.
 */
public static List<PeriodicSync> getPeriodicSyncs(Account account,String authority){
  try {
    return getContentService().getPeriodicSyncs(account,authority);
  }
 catch (  RemoteException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 857
Project: 857
Buggy source:
/** 
 * Remove a periodic sync. Has no affect if account, authority and extras don't match an existing periodic sync. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account of the periodic sync to remove
 * @param authority the provider of the periodic sync to remove
 * @param extras the extras of the periodic sync to remove
 */
public static void removePeriodicSync(Account account,String authority,Bundle extras){
  validateSyncExtrasBundle(extras);
  if (account == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (authority == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    getContentService().removePeriodicSync(account,authority,extras);
  }
 catch (  RemoteException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Remove a periodic sync. Has no affect if account, authority and extras don't match an existing periodic sync. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account of the periodic sync to remove
 * @param authority the provider of the periodic sync to remove
 * @param extras the extras of the periodic sync to remove
 */
public static void removePeriodicSync(Account account,String authority,Bundle extras){
  validateSyncExtrasBundle(extras);
  try {
    getContentService().removePeriodicSync(account,authority,extras);
  }
 catch (  RemoteException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 858
Project: 858
Buggy source:
/** 
 * Specify an authority and account for this transfer.
 * @param authority String identifying which content provider to sync.
 * @param account Account to sync. Can be null unless this is a periodic sync.
 */
public Builder setSyncAdapter(Account account,String authority){
  if (mSyncTarget != SYNC_TARGET_UNKNOWN) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mSyncTarget=SYNC_TARGET_ADAPTER;
  mAccount=account;
  mAuthority=authority;
  mComponentName=null;
  return this;
}

Fixed version (ground truth):
/** 
 * Specify an authority and account for this transfer.
 * @param authority String identifying which content provider to sync.
 * @param account Account to sync. Can be null unless this is a periodic sync.
 */
public Builder setSyncAdapter(Account account,String authority){
  if (mSyncTarget != SYNC_TARGET_UNKNOWN) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (authority != null && authority.length() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mSyncTarget=SYNC_TARGET_ADAPTER;
  mAccount=account;
  mAuthority=authority;
  mComponentName=null;
  return this;
}
Program: 859
Project: 859
Buggy source:
/** 
 * Old API. Schedule periodic sync with default flex time.
 */
@Override public void addPeriodicSync(Account account,String authority,Bundle extras,long pollFrequency){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  if (pollFrequency < 60) {
    Slog.w(TAG,"String_Node_Str" + pollFrequency + "String_Node_Str");
    pollFrequency=60;
  }
  long identityToken=clearCallingIdentity();
  try {
    PeriodicSync syncToAdd=new PeriodicSync(account,authority,extras,pollFrequency,SyncStorageEngine.calculateDefaultFlexTime(pollFrequency));
    getSyncManager().getSyncStorageEngine().addPeriodicSync(syncToAdd,userId);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}

Fixed version (ground truth):
/** 
 * Old API. Schedule periodic sync with default flex time. 
 */
@Override public void addPeriodicSync(Account account,String authority,Bundle extras,long pollFrequency){
  if (account == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (TextUtils.isEmpty(authority)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  if (pollFrequency < 60) {
    Slog.w(TAG,"String_Node_Str" + pollFrequency + "String_Node_Str");
    pollFrequency=60;
  }
  long identityToken=clearCallingIdentity();
  try {
    PeriodicSync syncToAdd=new PeriodicSync(account,authority,extras,pollFrequency,SyncStorageEngine.calculateDefaultFlexTime(pollFrequency));
    getSyncManager().getSyncStorageEngine().addPeriodicSync(syncToAdd,userId);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}
Program: 860
Project: 860
Buggy source:
@Override public void setSyncAutomatically(Account account,String providerName,boolean sync){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      syncManager.getSyncStorageEngine().setSyncAutomatically(account,userId,providerName,sync);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}

Fixed version (ground truth):
@Override public void setSyncAutomatically(Account account,String providerName,boolean sync){
  if (TextUtils.isEmpty(providerName)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      syncManager.getSyncStorageEngine().setSyncAutomatically(account,userId,providerName,sync);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}
Program: 861
Project: 861
Buggy source:
/** 
 * Clear all scheduled sync operations that match the uri and cancel the active sync if they match the authority and account, if they are present.
 * @param account filter the pending and active syncs to cancel using this account
 * @param authority filter the pending and active syncs to cancel using this authority
 */
@Override public void cancelSync(Account account,String authority){
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      syncManager.clearScheduledSyncOperations(account,userId,authority);
      syncManager.cancelActiveSync(account,userId,authority);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}

Fixed version (ground truth):
/** 
 * Clear all scheduled sync operations that match the uri and cancel the active sync if they match the authority and account, if they are present.
 * @param account filter the pending and active syncs to cancel using this account
 * @param authority filter the pending and active syncs to cancel using this authority
 */
@Override public void cancelSync(Account account,String authority){
  if (authority != null && authority.length() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      syncManager.clearScheduledSyncOperations(account,userId,authority);
      syncManager.cancelActiveSync(account,userId,authority);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}
Program: 862
Project: 862
Buggy source:
@Override public void setIsSyncable(Account account,String providerName,int syncable){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      syncManager.getSyncStorageEngine().setIsSyncable(account,userId,providerName,syncable);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}

Fixed version (ground truth):
@Override public void setIsSyncable(Account account,String providerName,int syncable){
  if (TextUtils.isEmpty(providerName)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      syncManager.getSyncStorageEngine().setIsSyncable(account,userId,providerName,syncable);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}
Program: 864
Project: 864
Buggy source:
@Override public List<PeriodicSync> getPeriodicSyncs(Account account,String providerName){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    return getSyncManager().getSyncStorageEngine().getPeriodicSyncs(account,userId,providerName);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}

Fixed version (ground truth):
@Override public List<PeriodicSync> getPeriodicSyncs(Account account,String providerName){
  if (account == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (TextUtils.isEmpty(providerName)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    return getSyncManager().getSyncStorageEngine().getPeriodicSyncs(account,userId,providerName);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}
Program: 865
Project: 865
Buggy source:
public SyncStatusInfo getSyncStatus(Account account,String authority){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      return syncManager.getSyncStorageEngine().getStatusByAccountAndAuthority(account,userId,authority);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
  return null;
}

Fixed version (ground truth):
public SyncStatusInfo getSyncStatus(Account account,String authority){
  if (TextUtils.isEmpty(authority)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    SyncManager syncManager=getSyncManager();
    if (syncManager != null) {
      return syncManager.getSyncStorageEngine().getStatusByAccountAndAuthority(account,userId,authority);
    }
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
  return null;
}
Program: 866
Project: 866
Buggy source:
@Override public void removePeriodicSync(Account account,String authority,Bundle extras){
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    PeriodicSync syncToRemove=new PeriodicSync(account,authority,extras,0,0);
    getSyncManager().getSyncStorageEngine().removePeriodicSync(syncToRemove,userId);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}

Fixed version (ground truth):
@Override public void removePeriodicSync(Account account,String authority,Bundle extras){
  if (account == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (TextUtils.isEmpty(authority)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,"String_Node_Str");
  int userId=UserHandle.getCallingUserId();
  long identityToken=clearCallingIdentity();
  try {
    PeriodicSync syncToRemove=new PeriodicSync(account,authority,extras,0,0);
    getSyncManager().getSyncStorageEngine().removePeriodicSync(syncToRemove,userId);
  }
  finally {
    restoreCallingIdentity(identityToken);
  }
}
Program: 868
Project: 868
Buggy source:
/** 
 * Returns the status that matches the authority and account.
 * @param account the account we want to check
 * @param authority the authority whose row should be selected
 * @return the SyncStatusInfo for the authority
 */
public SyncStatusInfo getStatusByAccountAndAuthority(Account account,int userId,String authority){
  if (account == null || authority == null) {
    throw new IllegalArgumentException();
  }
synchronized (mAuthorities) {
    final int N=mSyncStatus.size();
    for (int i=0; i < N; i++) {
      SyncStatusInfo cur=mSyncStatus.valueAt(i);
      AuthorityInfo ainfo=mAuthorities.get(cur.authorityId);
      if (ainfo != null && ainfo.authority.equals(authority) && ainfo.userId == userId && account.equals(ainfo.account)) {
        return cur;
      }
    }
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns the status that matches the authority and account.
 * @param account the account we want to check
 * @param authority the authority whose row should be selected
 * @return the SyncStatusInfo for the authority or null if none found.
 */
public SyncStatusInfo getStatusByAccountAndAuthority(Account account,int userId,String authority){
  if (account == null || authority == null) {
    return null;
  }
synchronized (mAuthorities) {
    final int N=mSyncStatus.size();
    for (int i=0; i < N; i++) {
      SyncStatusInfo cur=mSyncStatus.valueAt(i);
      AuthorityInfo ainfo=mAuthorities.get(cur.authorityId);
      if (ainfo != null && ainfo.authority.equals(authority) && ainfo.userId == userId && account.equals(ainfo.account)) {
        return cur;
      }
    }
    return null;
  }
}
Program: 884
Project: 884
Buggy source:
ServiceMap(int userId){
  mUserId=userId;
}

Fixed version (ground truth):
ServiceMap(Looper looper,int userId){
  super(looper);
  mUserId=userId;
}
Program: 885
Project: 885
Buggy source:
private ServiceMap getServiceMap(int callingUser){
  ServiceMap smap=mServiceMap.get(callingUser);
  if (smap == null) {
    smap=new ServiceMap(callingUser);
    mServiceMap.put(callingUser,smap);
  }
  return smap;
}

Fixed version (ground truth):
private ServiceMap getServiceMap(int callingUser){
  ServiceMap smap=mServiceMap.get(callingUser);
  if (smap == null) {
    smap=new ServiceMap(mAm.mHandler.getLooper(),callingUser);
    mServiceMap.put(callingUser,smap);
  }
  return smap;
}
Program: 886
Project: 886
Buggy source:
ServiceMap(int userId){
  mUserId=userId;
}

Fixed version (ground truth):
ServiceMap(Looper looper,int userId){
  super(looper);
  mUserId=userId;
}
Program: 887
Project: 887
Buggy source:
private ServiceMap getServiceMap(int callingUser){
  ServiceMap smap=mServiceMap.get(callingUser);
  if (smap == null) {
    smap=new ServiceMap(callingUser);
    mServiceMap.put(callingUser,smap);
  }
  return smap;
}

Fixed version (ground truth):
private ServiceMap getServiceMap(int callingUser){
  ServiceMap smap=mServiceMap.get(callingUser);
  if (smap == null) {
    smap=new ServiceMap(mAm.mHandler.getLooper(),callingUser);
    mServiceMap.put(callingUser,smap);
  }
  return smap;
}
Program: 888
Project: 888
Buggy source:
ServiceMap(int userId){
  mUserId=userId;
}

Fixed version (ground truth):
ServiceMap(Looper looper,int userId){
  super(looper);
  mUserId=userId;
}
Program: 889
Project: 889
Buggy source:
private ServiceMap getServiceMap(int callingUser){
  ServiceMap smap=mServiceMap.get(callingUser);
  if (smap == null) {
    smap=new ServiceMap(callingUser);
    mServiceMap.put(callingUser,smap);
  }
  return smap;
}

Fixed version (ground truth):
private ServiceMap getServiceMap(int callingUser){
  ServiceMap smap=mServiceMap.get(callingUser);
  if (smap == null) {
    smap=new ServiceMap(mAm.mHandler.getLooper(),callingUser);
    mServiceMap.put(callingUser,smap);
  }
  return smap;
}
Program: 890
Project: 890
Buggy source:
ServiceMap(int userId){
  mUserId=userId;
}

Fixed version (ground truth):
ServiceMap(Looper looper,int userId){
  super(looper);
  mUserId=userId;
}
Program: 891
Project: 891
Buggy source:
private ServiceMap getServiceMap(int callingUser){
  ServiceMap smap=mServiceMap.get(callingUser);
  if (smap == null) {
    smap=new ServiceMap(callingUser);
    mServiceMap.put(callingUser,smap);
  }
  return smap;
}

Fixed version (ground truth):
private ServiceMap getServiceMap(int callingUser){
  ServiceMap smap=mServiceMap.get(callingUser);
  if (smap == null) {
    smap=new ServiceMap(mAm.mHandler.getLooper(),callingUser);
    mServiceMap.put(callingUser,smap);
  }
  return smap;
}
Program: 892
Project: 892
Buggy source:
ServiceMap(int userId){
  mUserId=userId;
}

Fixed version (ground truth):
ServiceMap(Looper looper,int userId){
  super(looper);
  mUserId=userId;
}
Program: 893
Project: 893
Buggy source:
private ServiceMap getServiceMap(int callingUser){
  ServiceMap smap=mServiceMap.get(callingUser);
  if (smap == null) {
    smap=new ServiceMap(callingUser);
    mServiceMap.put(callingUser,smap);
  }
  return smap;
}

Fixed version (ground truth):
private ServiceMap getServiceMap(int callingUser){
  ServiceMap smap=mServiceMap.get(callingUser);
  if (smap == null) {
    smap=new ServiceMap(mAm.mHandler.getLooper(),callingUser);
    mServiceMap.put(callingUser,smap);
  }
  return smap;
}
Program: 894
Project: 894
Buggy source:
final void addRecentTaskLocked(TaskRecord task){
  int N=mRecentTasks.size();
  if (N > 0 && mRecentTasks.get(0) == task) {
    return;
  }
  for (int i=0; i < N; i++) {
    TaskRecord tr=mRecentTasks.get(i);
    if (task.userId == tr.userId && ((task.affinity != null && task.affinity.equals(tr.affinity)) || (task.intent != null && task.intent.filterEquals(tr.intent)))) {
      mRecentTasks.remove(i);
      i--;
      N--;
      if (task.intent == null) {
        task=tr;
      }
    }
  }
  if (N >= MAX_RECENT_TASKS) {
    mRecentTasks.remove(N - 1);
  }
  mRecentTasks.add(0,task);
}

Fixed version (ground truth):
final void addRecentTaskLocked(TaskRecord task){
  int N=mRecentTasks.size();
  if (N > 0 && mRecentTasks.get(0) == task) {
    return;
  }
  for (int i=0; i < N; i++) {
    TaskRecord tr=mRecentTasks.get(i);
    if (task.userId == tr.userId && ((task.affinity != null && task.affinity.equals(tr.affinity)) || (task.intent != null && task.intent.filterEquals(tr.intent)))) {
      tr.disposeThumbnail();
      mRecentTasks.remove(i);
      i--;
      N--;
      if (task.intent == null) {
        task=tr;
      }
    }
  }
  if (N >= MAX_RECENT_TASKS) {
    mRecentTasks.remove(N - 1).disposeThumbnail();
  }
  mRecentTasks.add(0,task);
}
Program: 895
Project: 895
Buggy source:
private void cleanUpRemovedTaskLocked(TaskRecord tr,int flags){
  mRecentTasks.remove(tr);
  mStackSupervisor.removeTask(tr);
  final boolean killProcesses=(flags & ActivityManager.REMOVE_TASK_KILL_PROCESS) != 0;
  Intent baseIntent=new Intent(tr.intent != null ? tr.intent : tr.affinityIntent);
  ComponentName component=baseIntent.getComponent();
  if (component == null) {
    Slog.w(TAG,"String_Node_Str" + tr);
    return;
  }
  mServices.cleanUpRemovedTaskLocked(tr,component,baseIntent);
  if (killProcesses) {
    final String pkg=component.getPackageName();
    ArrayList<ProcessRecord> procs=new ArrayList<ProcessRecord>();
    ArrayMap<String,SparseArray<ProcessRecord>> pmap=mProcessNames.getMap();
    for (int i=0; i < pmap.size(); i++) {
      SparseArray<ProcessRecord> uids=pmap.valueAt(i);
      for (int j=0; j < uids.size(); j++) {
        ProcessRecord proc=uids.valueAt(j);
        if (proc.userId != tr.userId) {
          continue;
        }
        if (!proc.pkgList.containsKey(pkg)) {
          continue;
        }
        procs.add(proc);
      }
    }
    for (int i=0; i < procs.size(); i++) {
      ProcessRecord pr=procs.get(i);
      if (pr == mHomeProcess) {
        continue;
      }
      if (pr.setSchedGroup == Process.THREAD_GROUP_BG_NONINTERACTIVE) {
        killUnneededProcessLocked(pr,"String_Node_Str");
      }
 else {
        pr.waitingToKill="String_Node_Str";
      }
    }
  }
}

Fixed version (ground truth):
private void cleanUpRemovedTaskLocked(TaskRecord tr,int flags){
  tr.disposeThumbnail();
  mRecentTasks.remove(tr);
  mStackSupervisor.removeTask(tr);
  final boolean killProcesses=(flags & ActivityManager.REMOVE_TASK_KILL_PROCESS) != 0;
  Intent baseIntent=new Intent(tr.intent != null ? tr.intent : tr.affinityIntent);
  ComponentName component=baseIntent.getComponent();
  if (component == null) {
    Slog.w(TAG,"String_Node_Str" + tr);
    return;
  }
  mServices.cleanUpRemovedTaskLocked(tr,component,baseIntent);
  if (killProcesses) {
    final String pkg=component.getPackageName();
    ArrayList<ProcessRecord> procs=new ArrayList<ProcessRecord>();
    ArrayMap<String,SparseArray<ProcessRecord>> pmap=mProcessNames.getMap();
    for (int i=0; i < pmap.size(); i++) {
      SparseArray<ProcessRecord> uids=pmap.valueAt(i);
      for (int j=0; j < uids.size(); j++) {
        ProcessRecord proc=uids.valueAt(j);
        if (proc.userId != tr.userId) {
          continue;
        }
        if (!proc.pkgList.containsKey(pkg)) {
          continue;
        }
        procs.add(proc);
      }
    }
    for (int i=0; i < procs.size(); i++) {
      ProcessRecord pr=procs.get(i);
      if (pr == mHomeProcess) {
        continue;
      }
      if (pr.setSchedGroup == Process.THREAD_GROUP_BG_NONINTERACTIVE) {
        killUnneededProcessLocked(pr,"String_Node_Str");
      }
 else {
        pr.waitingToKill="String_Node_Str";
      }
    }
  }
}
Program: 896
Project: 896
Buggy source:
public final Bitmap screenshotActivities(ActivityRecord who){
  if (who.noDisplay) {
    return null;
  }
  Resources res=mService.mContext.getResources();
  int w=mThumbnailWidth;
  int h=mThumbnailHeight;
  if (w < 0) {
    mThumbnailWidth=w=res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_width);
    mThumbnailHeight=h=res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_height);
  }
  if (w > 0) {
    if (who != mLastScreenshotActivity || mLastScreenshotBitmap == null || mLastScreenshotBitmap.getWidth() != w || mLastScreenshotBitmap.getHeight() != h) {
      mLastScreenshotActivity=who;
      mLastScreenshotBitmap=mWindowManager.screenshotApplications(who.appToken,Display.DEFAULT_DISPLAY,w,h,SCREENSHOT_FORCE_565);
    }
    if (mLastScreenshotBitmap != null) {
      return mLastScreenshotBitmap.copy(mLastScreenshotBitmap.getConfig(),true);
    }
  }
  return null;
}

Fixed version (ground truth):
public final Bitmap screenshotActivities(ActivityRecord who){
  if (who.noDisplay) {
    return null;
  }
  TaskRecord tr=who.task;
  if (tr.intent != null && (tr.intent.getFlags() & Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0) {
    return null;
  }
  Resources res=mService.mContext.getResources();
  int w=mThumbnailWidth;
  int h=mThumbnailHeight;
  if (w < 0) {
    mThumbnailWidth=w=res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_width);
    mThumbnailHeight=h=res.getDimensionPixelSize(com.android.internal.R.dimen.thumbnail_height);
  }
  if (w > 0) {
    if (who != mLastScreenshotActivity || mLastScreenshotBitmap == null || mLastScreenshotActivity.state == ActivityState.RESUMED || mLastScreenshotBitmap.getWidth() != w || mLastScreenshotBitmap.getHeight() != h) {
      mLastScreenshotActivity=who;
      mLastScreenshotBitmap=mWindowManager.screenshotApplications(who.appToken,Display.DEFAULT_DISPLAY,w,h,SCREENSHOT_FORCE_565);
    }
    if (mLastScreenshotBitmap != null) {
      return mLastScreenshotBitmap.copy(mLastScreenshotBitmap.getConfig(),true);
    }
  }
  return null;
}