nus-yam/ex-repair huggingface dataset:
Program: 197059
Project: 197059
Buggy source:
private int startRecognitionLocked(int recognitionFlags){
  KeyphraseRecognitionExtra[] recognitionExtra=new KeyphraseRecognitionExtra[1];
  recognitionExtra[0]=new KeyphraseRecognitionExtra(mKeyphraseMetadata.id,mKeyphraseMetadata.recognitionModeFlags,0,new ConfidenceLevel[0]);
  boolean captureTriggerAudio=(recognitionFlags & RECOGNITION_FLAG_CAPTURE_TRIGGER_AUDIO) != 0;
  boolean allowMultipleTriggers=(recognitionFlags & RECOGNITION_FLAG_ALLOW_MULTIPLE_TRIGGERS) != 0;
  int code=STATUS_ERROR;
  try {
    code=mModelManagementService.startRecognition(mVoiceInteractionService,mKeyphraseMetadata.id,mInternalCallback,new RecognitionConfig(captureTriggerAudio,allowMultipleTriggers,recognitionExtra,null));
  }
 catch (  RemoteException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
  if (code != STATUS_OK) {
    Slog.w(TAG,"String_Node_Str" + code);
  }
  return code;
}

Fixed version (ground truth):
private int startRecognitionLocked(int recognitionFlags){
  KeyphraseRecognitionExtra[] recognitionExtra=new KeyphraseRecognitionExtra[1];
  recognitionExtra[0]=new KeyphraseRecognitionExtra(mKeyphraseMetadata.id,mKeyphraseMetadata.recognitionModeFlags,0,new ConfidenceLevel[0]);
  boolean captureTriggerAudio=(recognitionFlags & RECOGNITION_FLAG_CAPTURE_TRIGGER_AUDIO) != 0;
  boolean allowMultipleTriggers=(recognitionFlags & RECOGNITION_FLAG_ALLOW_MULTIPLE_TRIGGERS) != 0;
  int code=STATUS_ERROR;
  try {
    code=mModelManagementService.startRecognition(mVoiceInteractionService,mKeyphraseMetadata.id,mLocale.toLanguageTag(),mInternalCallback,new RecognitionConfig(captureTriggerAudio,allowMultipleTriggers,recognitionExtra,null));
  }
 catch (  RemoteException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
  if (code != STATUS_OK) {
    Slog.w(TAG,"String_Node_Str" + code);
  }
  return code;
}
Program: 197060
Project: 197060
Buggy source:
/** 
 * @return The corresponding {@link KeyphraseSoundModel} or null if none is found.
 */
private boolean internalGetIsEnrolled(int keyphraseId){
  try {
    return mModelManagementService.isEnrolledForKeyphrase(mVoiceInteractionService,keyphraseId);
  }
 catch (  RemoteException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @return The corresponding {@link KeyphraseSoundModel} or null if none is found.
 */
private boolean internalGetIsEnrolled(int keyphraseId,Locale locale){
  try {
    return mModelManagementService.isEnrolledForKeyphrase(mVoiceInteractionService,keyphraseId,locale.toLanguageTag());
  }
 catch (  RemoteException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
  return false;
}
Program: 197061
Project: 197061
Buggy source:
@Override public Void doInBackground(Void... params){
  int availability=internalGetInitialAvailability();
  boolean enrolled=false;
  if (availability == STATE_NOT_READY || availability == STATE_KEYPHRASE_UNENROLLED || availability == STATE_KEYPHRASE_ENROLLED) {
    enrolled=internalGetIsEnrolled(mKeyphraseMetadata.id);
    if (!enrolled) {
      availability=STATE_KEYPHRASE_UNENROLLED;
    }
 else {
      availability=STATE_KEYPHRASE_ENROLLED;
    }
  }
synchronized (mLock) {
    if (DBG) {
      Slog.d(TAG,"String_Node_Str" + mAvailability + "String_Node_Str"+ availability);
    }
    mAvailability=availability;
    notifyStateChangedLocked();
  }
  return null;
}

Fixed version (ground truth):
@Override public Void doInBackground(Void... params){
  int availability=internalGetInitialAvailability();
  boolean enrolled=false;
  if (availability == STATE_NOT_READY || availability == STATE_KEYPHRASE_UNENROLLED || availability == STATE_KEYPHRASE_ENROLLED) {
    enrolled=internalGetIsEnrolled(mKeyphraseMetadata.id,mLocale);
    if (!enrolled) {
      availability=STATE_KEYPHRASE_UNENROLLED;
    }
 else {
      availability=STATE_KEYPHRASE_ENROLLED;
    }
  }
synchronized (mLock) {
    if (DBG) {
      Slog.d(TAG,"String_Node_Str" + mAvailability + "String_Node_Str"+ availability);
    }
    mAvailability=availability;
    notifyStateChangedLocked();
  }
  return null;
}
Program: 197062
Project: 197062
Buggy source:
private int startRecognitionLocked(int recognitionFlags){
  KeyphraseRecognitionExtra[] recognitionExtra=new KeyphraseRecognitionExtra[1];
  recognitionExtra[0]=new KeyphraseRecognitionExtra(mKeyphraseMetadata.id,mKeyphraseMetadata.recognitionModeFlags,0,new ConfidenceLevel[0]);
  boolean captureTriggerAudio=(recognitionFlags & RECOGNITION_FLAG_CAPTURE_TRIGGER_AUDIO) != 0;
  boolean allowMultipleTriggers=(recognitionFlags & RECOGNITION_FLAG_ALLOW_MULTIPLE_TRIGGERS) != 0;
  int code=STATUS_ERROR;
  try {
    code=mModelManagementService.startRecognition(mVoiceInteractionService,mKeyphraseMetadata.id,mInternalCallback,new RecognitionConfig(captureTriggerAudio,allowMultipleTriggers,recognitionExtra,null));
  }
 catch (  RemoteException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
  if (code != STATUS_OK) {
    Slog.w(TAG,"String_Node_Str" + code);
  }
  return code;
}

Fixed version (ground truth):
private int startRecognitionLocked(int recognitionFlags){
  KeyphraseRecognitionExtra[] recognitionExtra=new KeyphraseRecognitionExtra[1];
  recognitionExtra[0]=new KeyphraseRecognitionExtra(mKeyphraseMetadata.id,mKeyphraseMetadata.recognitionModeFlags,0,new ConfidenceLevel[0]);
  boolean captureTriggerAudio=(recognitionFlags & RECOGNITION_FLAG_CAPTURE_TRIGGER_AUDIO) != 0;
  boolean allowMultipleTriggers=(recognitionFlags & RECOGNITION_FLAG_ALLOW_MULTIPLE_TRIGGERS) != 0;
  int code=STATUS_ERROR;
  try {
    code=mModelManagementService.startRecognition(mVoiceInteractionService,mKeyphraseMetadata.id,mLocale.toLanguageTag(),mInternalCallback,new RecognitionConfig(captureTriggerAudio,allowMultipleTriggers,recognitionExtra,null));
  }
 catch (  RemoteException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
  if (code != STATUS_OK) {
    Slog.w(TAG,"String_Node_Str" + code);
  }
  return code;
}
Program: 197063
Project: 197063
Buggy source:
/** 
 * @return The corresponding {@link KeyphraseSoundModel} or null if none is found.
 */
private boolean internalGetIsEnrolled(int keyphraseId){
  try {
    return mModelManagementService.isEnrolledForKeyphrase(mVoiceInteractionService,keyphraseId);
  }
 catch (  RemoteException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @return The corresponding {@link KeyphraseSoundModel} or null if none is found.
 */
private boolean internalGetIsEnrolled(int keyphraseId,Locale locale){
  try {
    return mModelManagementService.isEnrolledForKeyphrase(mVoiceInteractionService,keyphraseId,locale.toLanguageTag());
  }
 catch (  RemoteException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
  return false;
}
Program: 197064
Project: 197064
Buggy source:
@Override public Void doInBackground(Void... params){
  int availability=internalGetInitialAvailability();
  boolean enrolled=false;
  if (availability == STATE_NOT_READY || availability == STATE_KEYPHRASE_UNENROLLED || availability == STATE_KEYPHRASE_ENROLLED) {
    enrolled=internalGetIsEnrolled(mKeyphraseMetadata.id);
    if (!enrolled) {
      availability=STATE_KEYPHRASE_UNENROLLED;
    }
 else {
      availability=STATE_KEYPHRASE_ENROLLED;
    }
  }
synchronized (mLock) {
    if (DBG) {
      Slog.d(TAG,"String_Node_Str" + mAvailability + "String_Node_Str"+ availability);
    }
    mAvailability=availability;
    notifyStateChangedLocked();
  }
  return null;
}

Fixed version (ground truth):
@Override public Void doInBackground(Void... params){
  int availability=internalGetInitialAvailability();
  boolean enrolled=false;
  if (availability == STATE_NOT_READY || availability == STATE_KEYPHRASE_UNENROLLED || availability == STATE_KEYPHRASE_ENROLLED) {
    enrolled=internalGetIsEnrolled(mKeyphraseMetadata.id,mLocale);
    if (!enrolled) {
      availability=STATE_KEYPHRASE_UNENROLLED;
    }
 else {
      availability=STATE_KEYPHRASE_ENROLLED;
    }
  }
synchronized (mLock) {
    if (DBG) {
      Slog.d(TAG,"String_Node_Str" + mAvailability + "String_Node_Str"+ availability);
    }
    mAvailability=availability;
    notifyStateChangedLocked();
  }
  return null;
}
Program: 197065
Project: 197065
Buggy source:
private int startRecognitionLocked(int recognitionFlags){
  KeyphraseRecognitionExtra[] recognitionExtra=new KeyphraseRecognitionExtra[1];
  recognitionExtra[0]=new KeyphraseRecognitionExtra(mKeyphraseMetadata.id,mKeyphraseMetadata.recognitionModeFlags,0,new ConfidenceLevel[0]);
  boolean captureTriggerAudio=(recognitionFlags & RECOGNITION_FLAG_CAPTURE_TRIGGER_AUDIO) != 0;
  boolean allowMultipleTriggers=(recognitionFlags & RECOGNITION_FLAG_ALLOW_MULTIPLE_TRIGGERS) != 0;
  int code=STATUS_ERROR;
  try {
    code=mModelManagementService.startRecognition(mVoiceInteractionService,mKeyphraseMetadata.id,mInternalCallback,new RecognitionConfig(captureTriggerAudio,allowMultipleTriggers,recognitionExtra,null));
  }
 catch (  RemoteException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
  if (code != STATUS_OK) {
    Slog.w(TAG,"String_Node_Str" + code);
  }
  return code;
}

Fixed version (ground truth):
private int startRecognitionLocked(int recognitionFlags){
  KeyphraseRecognitionExtra[] recognitionExtra=new KeyphraseRecognitionExtra[1];
  recognitionExtra[0]=new KeyphraseRecognitionExtra(mKeyphraseMetadata.id,mKeyphraseMetadata.recognitionModeFlags,0,new ConfidenceLevel[0]);
  boolean captureTriggerAudio=(recognitionFlags & RECOGNITION_FLAG_CAPTURE_TRIGGER_AUDIO) != 0;
  boolean allowMultipleTriggers=(recognitionFlags & RECOGNITION_FLAG_ALLOW_MULTIPLE_TRIGGERS) != 0;
  int code=STATUS_ERROR;
  try {
    code=mModelManagementService.startRecognition(mVoiceInteractionService,mKeyphraseMetadata.id,mLocale.toLanguageTag(),mInternalCallback,new RecognitionConfig(captureTriggerAudio,allowMultipleTriggers,recognitionExtra,null));
  }
 catch (  RemoteException e) {
    Slog.w(TAG,"String_Node_Str",e);
  }
  if (code != STATUS_OK) {
    Slog.w(TAG,"String_Node_Str" + code);
  }
  return code;
}
Program: 197074
Project: 197074
Buggy source:
@Override public void moveTaskToBack(int taskId){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    TaskRecord tr=recentTaskForIdLocked(taskId);
    if (tr != null) {
      if (tr == mStackSupervisor.mLockTaskModeTask) {
        mStackSupervisor.showLockTaskToast();
        return;
      }
      if (DEBUG_STACK)       Slog.d(TAG,"String_Node_Str" + tr);
      ActivityStack stack=tr.stack;
      if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
        if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
          return;
        }
      }
      final long origId=Binder.clearCallingIdentity();
      try {
        stack.moveTaskToBackLocked(taskId,null);
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void moveTaskToBack(int taskId){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    TaskRecord tr=recentTaskForIdLocked(taskId);
    if (tr != null) {
      if (tr == mStackSupervisor.mLockTaskModeTask) {
        mStackSupervisor.showLockTaskToast();
        return;
      }
      if (DEBUG_STACK)       Slog.d(TAG,"String_Node_Str" + tr);
      ActivityStack stack=tr.stack;
      if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
        if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
          return;
        }
      }
      final long origId=Binder.clearCallingIdentity();
      try {
        stack.moveTaskToBackLocked(taskId,null);
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
}
Program: 197075
Project: 197075
Buggy source:
boolean checkAppSwitchAllowedLocked(int callingPid,int callingUid,String name){
  if (mAppSwitchesAllowedTime < SystemClock.uptimeMillis()) {
    return true;
  }
  final int perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,callingPid,callingUid,-1,true);
  if (perm == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  Slog.w(TAG,name + "String_Node_Str" + callingUid+ "String_Node_Str");
  return false;
}

Fixed version (ground truth):
boolean checkAppSwitchAllowedLocked(int sourcePid,int sourceUid,int callingPid,int callingUid,String name){
  if (mAppSwitchesAllowedTime < SystemClock.uptimeMillis()) {
    return true;
  }
  int perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,sourcePid,sourceUid,-1,true);
  if (perm == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  if (callingUid != -1 && callingUid != sourceUid) {
    perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,callingPid,callingUid,-1,true);
    if (perm == PackageManager.PERMISSION_GRANTED) {
      return true;
    }
  }
  Slog.w(TAG,name + "String_Node_Str" + sourceUid+ "String_Node_Str");
  return false;
}
Program: 197077
Project: 197077
Buggy source:
@Override public void moveTaskBackwards(int task){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    moveTaskBackwardsLocked(task);
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
@Override public void moveTaskBackwards(int task){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    moveTaskBackwardsLocked(task);
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 197078
Project: 197078
Buggy source:
@Override public void moveToFront(){
  checkCaller();
  final TaskRecord tr;
synchronized (ActivityManagerService.this) {
    tr=recentTaskForIdLocked(mTaskId);
    if (tr == null) {
      throw new IllegalArgumentException("String_Node_Str" + mTaskId);
    }
    if (tr.getRootActivity() != null) {
      long origId=Binder.clearCallingIdentity();
      try {
        moveTaskToFrontLocked(tr.taskId,0,null);
        return;
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
  startActivityFromRecentsInner(tr.taskId,null);
}

Fixed version (ground truth):
@Override public void moveToFront(){
  checkCaller();
  final TaskRecord tr;
synchronized (ActivityManagerService.this) {
    tr=recentTaskForIdLocked(mTaskId);
    if (tr == null) {
      throw new IllegalArgumentException("String_Node_Str" + mTaskId);
    }
    if (tr.getRootActivity() != null) {
      moveTaskToFrontLocked(tr.taskId,0,null);
    }
  }
  startActivityFromRecentsInner(tr.taskId,null);
}
Program: 197079
Project: 197079
Buggy source:
void moveTaskToFrontLocked(int taskId,int flags,Bundle options){
  if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
    ActivityOptions.abort(options);
    return;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    final TaskRecord task=mStackSupervisor.anyTaskForIdLocked(taskId);
    if (task == null) {
      return;
    }
    if (mStackSupervisor.isLockTaskModeViolation(task)) {
      mStackSupervisor.showLockTaskToast();
      Slog.e(TAG,"String_Node_Str");
      return;
    }
    final ActivityRecord prev=mStackSupervisor.topRunningActivityLocked();
    if (prev != null && prev.isRecentsActivity()) {
      task.setTaskToReturnTo(ActivityRecord.RECENTS_ACTIVITY_TYPE);
    }
    mStackSupervisor.findTaskToMoveToFrontLocked(task,flags,options);
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  ActivityOptions.abort(options);
}

Fixed version (ground truth):
void moveTaskToFrontLocked(int taskId,int flags,Bundle options){
  if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
    ActivityOptions.abort(options);
    return;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    final TaskRecord task=mStackSupervisor.anyTaskForIdLocked(taskId);
    if (task == null) {
      return;
    }
    if (mStackSupervisor.isLockTaskModeViolation(task)) {
      mStackSupervisor.showLockTaskToast();
      Slog.e(TAG,"String_Node_Str");
      return;
    }
    final ActivityRecord prev=mStackSupervisor.topRunningActivityLocked();
    if (prev != null && prev.isRecentsActivity()) {
      task.setTaskToReturnTo(ActivityRecord.RECENTS_ACTIVITY_TYPE);
    }
    mStackSupervisor.findTaskToMoveToFrontLocked(task,flags,options);
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  ActivityOptions.abort(options);
}
Program: 197084
Project: 197084
Buggy source:
void startHomeActivity(Intent intent,ActivityInfo aInfo){
  moveHomeStackTaskToTop(HOME_ACTIVITY_TYPE);
  startActivityLocked(null,intent,null,aInfo,null,null,null,null,0,0,0,null,0,null,false,null,null,null);
}

Fixed version (ground truth):
void startHomeActivity(Intent intent,ActivityInfo aInfo){
  moveHomeStackTaskToTop(HOME_ACTIVITY_TYPE);
  startActivityLocked(null,intent,null,aInfo,null,null,null,null,0,0,0,null,0,0,0,null,false,null,null,null);
}
Program: 197094
Project: 197094
Buggy source:
@Override public void moveTaskToBack(int taskId){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    TaskRecord tr=recentTaskForIdLocked(taskId);
    if (tr != null) {
      if (tr == mStackSupervisor.mLockTaskModeTask) {
        mStackSupervisor.showLockTaskToast();
        return;
      }
      if (DEBUG_STACK)       Slog.d(TAG,"String_Node_Str" + tr);
      ActivityStack stack=tr.stack;
      if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
        if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
          return;
        }
      }
      final long origId=Binder.clearCallingIdentity();
      try {
        stack.moveTaskToBackLocked(taskId,null);
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void moveTaskToBack(int taskId){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    TaskRecord tr=recentTaskForIdLocked(taskId);
    if (tr != null) {
      if (tr == mStackSupervisor.mLockTaskModeTask) {
        mStackSupervisor.showLockTaskToast();
        return;
      }
      if (DEBUG_STACK)       Slog.d(TAG,"String_Node_Str" + tr);
      ActivityStack stack=tr.stack;
      if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
        if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
          return;
        }
      }
      final long origId=Binder.clearCallingIdentity();
      try {
        stack.moveTaskToBackLocked(taskId,null);
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
}
Program: 197095
Project: 197095
Buggy source:
boolean checkAppSwitchAllowedLocked(int callingPid,int callingUid,String name){
  if (mAppSwitchesAllowedTime < SystemClock.uptimeMillis()) {
    return true;
  }
  final int perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,callingPid,callingUid,-1,true);
  if (perm == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  Slog.w(TAG,name + "String_Node_Str" + callingUid+ "String_Node_Str");
  return false;
}

Fixed version (ground truth):
boolean checkAppSwitchAllowedLocked(int sourcePid,int sourceUid,int callingPid,int callingUid,String name){
  if (mAppSwitchesAllowedTime < SystemClock.uptimeMillis()) {
    return true;
  }
  int perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,sourcePid,sourceUid,-1,true);
  if (perm == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  if (callingUid != -1 && callingUid != sourceUid) {
    perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,callingPid,callingUid,-1,true);
    if (perm == PackageManager.PERMISSION_GRANTED) {
      return true;
    }
  }
  Slog.w(TAG,name + "String_Node_Str" + sourceUid+ "String_Node_Str");
  return false;
}
Program: 197097
Project: 197097
Buggy source:
@Override public void moveTaskBackwards(int task){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    moveTaskBackwardsLocked(task);
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
@Override public void moveTaskBackwards(int task){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    moveTaskBackwardsLocked(task);
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 197098
Project: 197098
Buggy source:
@Override public void moveToFront(){
  checkCaller();
  final TaskRecord tr;
synchronized (ActivityManagerService.this) {
    tr=recentTaskForIdLocked(mTaskId);
    if (tr == null) {
      throw new IllegalArgumentException("String_Node_Str" + mTaskId);
    }
    if (tr.getRootActivity() != null) {
      long origId=Binder.clearCallingIdentity();
      try {
        moveTaskToFrontLocked(tr.taskId,0,null);
        return;
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
  startActivityFromRecentsInner(tr.taskId,null);
}

Fixed version (ground truth):
@Override public void moveToFront(){
  checkCaller();
  final TaskRecord tr;
synchronized (ActivityManagerService.this) {
    tr=recentTaskForIdLocked(mTaskId);
    if (tr == null) {
      throw new IllegalArgumentException("String_Node_Str" + mTaskId);
    }
    if (tr.getRootActivity() != null) {
      moveTaskToFrontLocked(tr.taskId,0,null);
    }
  }
  startActivityFromRecentsInner(tr.taskId,null);
}
Program: 197099
Project: 197099
Buggy source:
void moveTaskToFrontLocked(int taskId,int flags,Bundle options){
  if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
    ActivityOptions.abort(options);
    return;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    final TaskRecord task=mStackSupervisor.anyTaskForIdLocked(taskId);
    if (task == null) {
      return;
    }
    if (mStackSupervisor.isLockTaskModeViolation(task)) {
      mStackSupervisor.showLockTaskToast();
      Slog.e(TAG,"String_Node_Str");
      return;
    }
    final ActivityRecord prev=mStackSupervisor.topRunningActivityLocked();
    if (prev != null && prev.isRecentsActivity()) {
      task.setTaskToReturnTo(ActivityRecord.RECENTS_ACTIVITY_TYPE);
    }
    mStackSupervisor.findTaskToMoveToFrontLocked(task,flags,options);
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  ActivityOptions.abort(options);
}

Fixed version (ground truth):
void moveTaskToFrontLocked(int taskId,int flags,Bundle options){
  if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
    ActivityOptions.abort(options);
    return;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    final TaskRecord task=mStackSupervisor.anyTaskForIdLocked(taskId);
    if (task == null) {
      return;
    }
    if (mStackSupervisor.isLockTaskModeViolation(task)) {
      mStackSupervisor.showLockTaskToast();
      Slog.e(TAG,"String_Node_Str");
      return;
    }
    final ActivityRecord prev=mStackSupervisor.topRunningActivityLocked();
    if (prev != null && prev.isRecentsActivity()) {
      task.setTaskToReturnTo(ActivityRecord.RECENTS_ACTIVITY_TYPE);
    }
    mStackSupervisor.findTaskToMoveToFrontLocked(task,flags,options);
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  ActivityOptions.abort(options);
}
Program: 197104
Project: 197104
Buggy source:
void startHomeActivity(Intent intent,ActivityInfo aInfo){
  moveHomeStackTaskToTop(HOME_ACTIVITY_TYPE);
  startActivityLocked(null,intent,null,aInfo,null,null,null,null,0,0,0,null,0,null,false,null,null,null);
}

Fixed version (ground truth):
void startHomeActivity(Intent intent,ActivityInfo aInfo){
  moveHomeStackTaskToTop(HOME_ACTIVITY_TYPE);
  startActivityLocked(null,intent,null,aInfo,null,null,null,null,0,0,0,null,0,0,0,null,false,null,null,null);
}
Program: 197106
Project: 197106
Buggy source:
@Override public void moveTaskToBack(int taskId){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    TaskRecord tr=recentTaskForIdLocked(taskId);
    if (tr != null) {
      if (tr == mStackSupervisor.mLockTaskModeTask) {
        mStackSupervisor.showLockTaskToast();
        return;
      }
      if (DEBUG_STACK)       Slog.d(TAG,"String_Node_Str" + tr);
      ActivityStack stack=tr.stack;
      if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
        if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
          return;
        }
      }
      final long origId=Binder.clearCallingIdentity();
      try {
        stack.moveTaskToBackLocked(taskId,null);
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void moveTaskToBack(int taskId){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    TaskRecord tr=recentTaskForIdLocked(taskId);
    if (tr != null) {
      if (tr == mStackSupervisor.mLockTaskModeTask) {
        mStackSupervisor.showLockTaskToast();
        return;
      }
      if (DEBUG_STACK)       Slog.d(TAG,"String_Node_Str" + tr);
      ActivityStack stack=tr.stack;
      if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
        if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
          return;
        }
      }
      final long origId=Binder.clearCallingIdentity();
      try {
        stack.moveTaskToBackLocked(taskId,null);
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
}
Program: 197107
Project: 197107
Buggy source:
boolean checkAppSwitchAllowedLocked(int callingPid,int callingUid,String name){
  if (mAppSwitchesAllowedTime < SystemClock.uptimeMillis()) {
    return true;
  }
  final int perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,callingPid,callingUid,-1,true);
  if (perm == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  Slog.w(TAG,name + "String_Node_Str" + callingUid+ "String_Node_Str");
  return false;
}

Fixed version (ground truth):
boolean checkAppSwitchAllowedLocked(int sourcePid,int sourceUid,int callingPid,int callingUid,String name){
  if (mAppSwitchesAllowedTime < SystemClock.uptimeMillis()) {
    return true;
  }
  int perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,sourcePid,sourceUid,-1,true);
  if (perm == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  if (callingUid != -1 && callingUid != sourceUid) {
    perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,callingPid,callingUid,-1,true);
    if (perm == PackageManager.PERMISSION_GRANTED) {
      return true;
    }
  }
  Slog.w(TAG,name + "String_Node_Str" + sourceUid+ "String_Node_Str");
  return false;
}
Program: 197109
Project: 197109
Buggy source:
@Override public void moveTaskBackwards(int task){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    moveTaskBackwardsLocked(task);
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
@Override public void moveTaskBackwards(int task){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    moveTaskBackwardsLocked(task);
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 197110
Project: 197110
Buggy source:
@Override public void moveToFront(){
  checkCaller();
  final TaskRecord tr;
synchronized (ActivityManagerService.this) {
    tr=recentTaskForIdLocked(mTaskId);
    if (tr == null) {
      throw new IllegalArgumentException("String_Node_Str" + mTaskId);
    }
    if (tr.getRootActivity() != null) {
      long origId=Binder.clearCallingIdentity();
      try {
        moveTaskToFrontLocked(tr.taskId,0,null);
        return;
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
  startActivityFromRecentsInner(tr.taskId,null);
}

Fixed version (ground truth):
@Override public void moveToFront(){
  checkCaller();
  final TaskRecord tr;
synchronized (ActivityManagerService.this) {
    tr=recentTaskForIdLocked(mTaskId);
    if (tr == null) {
      throw new IllegalArgumentException("String_Node_Str" + mTaskId);
    }
    if (tr.getRootActivity() != null) {
      moveTaskToFrontLocked(tr.taskId,0,null);
    }
  }
  startActivityFromRecentsInner(tr.taskId,null);
}
Program: 197111
Project: 197111
Buggy source:
void moveTaskToFrontLocked(int taskId,int flags,Bundle options){
  if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
    ActivityOptions.abort(options);
    return;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    final TaskRecord task=mStackSupervisor.anyTaskForIdLocked(taskId);
    if (task == null) {
      return;
    }
    if (mStackSupervisor.isLockTaskModeViolation(task)) {
      mStackSupervisor.showLockTaskToast();
      Slog.e(TAG,"String_Node_Str");
      return;
    }
    final ActivityRecord prev=mStackSupervisor.topRunningActivityLocked();
    if (prev != null && prev.isRecentsActivity()) {
      task.setTaskToReturnTo(ActivityRecord.RECENTS_ACTIVITY_TYPE);
    }
    mStackSupervisor.findTaskToMoveToFrontLocked(task,flags,options);
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  ActivityOptions.abort(options);
}

Fixed version (ground truth):
void moveTaskToFrontLocked(int taskId,int flags,Bundle options){
  if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
    ActivityOptions.abort(options);
    return;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    final TaskRecord task=mStackSupervisor.anyTaskForIdLocked(taskId);
    if (task == null) {
      return;
    }
    if (mStackSupervisor.isLockTaskModeViolation(task)) {
      mStackSupervisor.showLockTaskToast();
      Slog.e(TAG,"String_Node_Str");
      return;
    }
    final ActivityRecord prev=mStackSupervisor.topRunningActivityLocked();
    if (prev != null && prev.isRecentsActivity()) {
      task.setTaskToReturnTo(ActivityRecord.RECENTS_ACTIVITY_TYPE);
    }
    mStackSupervisor.findTaskToMoveToFrontLocked(task,flags,options);
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  ActivityOptions.abort(options);
}
Program: 197116
Project: 197116
Buggy source:
void startHomeActivity(Intent intent,ActivityInfo aInfo){
  moveHomeStackTaskToTop(HOME_ACTIVITY_TYPE);
  startActivityLocked(null,intent,null,aInfo,null,null,null,null,0,0,0,null,0,null,false,null,null,null);
}

Fixed version (ground truth):
void startHomeActivity(Intent intent,ActivityInfo aInfo){
  moveHomeStackTaskToTop(HOME_ACTIVITY_TYPE);
  startActivityLocked(null,intent,null,aInfo,null,null,null,null,0,0,0,null,0,0,0,null,false,null,null,null);
}
Program: 197142
Project: 197142
Buggy source:
@Override public void moveTaskToBack(int taskId){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    TaskRecord tr=recentTaskForIdLocked(taskId);
    if (tr != null) {
      if (tr == mStackSupervisor.mLockTaskModeTask) {
        mStackSupervisor.showLockTaskToast();
        return;
      }
      if (DEBUG_STACK)       Slog.d(TAG,"String_Node_Str" + tr);
      ActivityStack stack=tr.stack;
      if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
        if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
          return;
        }
      }
      final long origId=Binder.clearCallingIdentity();
      try {
        stack.moveTaskToBackLocked(taskId,null);
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void moveTaskToBack(int taskId){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    TaskRecord tr=recentTaskForIdLocked(taskId);
    if (tr != null) {
      if (tr == mStackSupervisor.mLockTaskModeTask) {
        mStackSupervisor.showLockTaskToast();
        return;
      }
      if (DEBUG_STACK)       Slog.d(TAG,"String_Node_Str" + tr);
      ActivityStack stack=tr.stack;
      if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
        if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
          return;
        }
      }
      final long origId=Binder.clearCallingIdentity();
      try {
        stack.moveTaskToBackLocked(taskId,null);
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
}
Program: 197143
Project: 197143
Buggy source:
boolean checkAppSwitchAllowedLocked(int callingPid,int callingUid,String name){
  if (mAppSwitchesAllowedTime < SystemClock.uptimeMillis()) {
    return true;
  }
  final int perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,callingPid,callingUid,-1,true);
  if (perm == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  Slog.w(TAG,name + "String_Node_Str" + callingUid+ "String_Node_Str");
  return false;
}

Fixed version (ground truth):
boolean checkAppSwitchAllowedLocked(int sourcePid,int sourceUid,int callingPid,int callingUid,String name){
  if (mAppSwitchesAllowedTime < SystemClock.uptimeMillis()) {
    return true;
  }
  int perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,sourcePid,sourceUid,-1,true);
  if (perm == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  if (callingUid != -1 && callingUid != sourceUid) {
    perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,callingPid,callingUid,-1,true);
    if (perm == PackageManager.PERMISSION_GRANTED) {
      return true;
    }
  }
  Slog.w(TAG,name + "String_Node_Str" + sourceUid+ "String_Node_Str");
  return false;
}
Program: 197145
Project: 197145
Buggy source:
@Override public void moveTaskBackwards(int task){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    moveTaskBackwardsLocked(task);
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
@Override public void moveTaskBackwards(int task){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    moveTaskBackwardsLocked(task);
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 197146
Project: 197146
Buggy source:
@Override public void moveToFront(){
  checkCaller();
  final TaskRecord tr;
synchronized (ActivityManagerService.this) {
    tr=recentTaskForIdLocked(mTaskId);
    if (tr == null) {
      throw new IllegalArgumentException("String_Node_Str" + mTaskId);
    }
    if (tr.getRootActivity() != null) {
      long origId=Binder.clearCallingIdentity();
      try {
        moveTaskToFrontLocked(tr.taskId,0,null);
        return;
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
  startActivityFromRecentsInner(tr.taskId,null);
}

Fixed version (ground truth):
@Override public void moveToFront(){
  checkCaller();
  final TaskRecord tr;
synchronized (ActivityManagerService.this) {
    tr=recentTaskForIdLocked(mTaskId);
    if (tr == null) {
      throw new IllegalArgumentException("String_Node_Str" + mTaskId);
    }
    if (tr.getRootActivity() != null) {
      moveTaskToFrontLocked(tr.taskId,0,null);
    }
  }
  startActivityFromRecentsInner(tr.taskId,null);
}
Program: 197147
Project: 197147
Buggy source:
void moveTaskToFrontLocked(int taskId,int flags,Bundle options){
  if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
    ActivityOptions.abort(options);
    return;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    final TaskRecord task=mStackSupervisor.anyTaskForIdLocked(taskId);
    if (task == null) {
      return;
    }
    if (mStackSupervisor.isLockTaskModeViolation(task)) {
      mStackSupervisor.showLockTaskToast();
      Slog.e(TAG,"String_Node_Str");
      return;
    }
    final ActivityRecord prev=mStackSupervisor.topRunningActivityLocked();
    if (prev != null && prev.isRecentsActivity()) {
      task.setTaskToReturnTo(ActivityRecord.RECENTS_ACTIVITY_TYPE);
    }
    mStackSupervisor.findTaskToMoveToFrontLocked(task,flags,options);
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  ActivityOptions.abort(options);
}

Fixed version (ground truth):
void moveTaskToFrontLocked(int taskId,int flags,Bundle options){
  if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
    ActivityOptions.abort(options);
    return;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    final TaskRecord task=mStackSupervisor.anyTaskForIdLocked(taskId);
    if (task == null) {
      return;
    }
    if (mStackSupervisor.isLockTaskModeViolation(task)) {
      mStackSupervisor.showLockTaskToast();
      Slog.e(TAG,"String_Node_Str");
      return;
    }
    final ActivityRecord prev=mStackSupervisor.topRunningActivityLocked();
    if (prev != null && prev.isRecentsActivity()) {
      task.setTaskToReturnTo(ActivityRecord.RECENTS_ACTIVITY_TYPE);
    }
    mStackSupervisor.findTaskToMoveToFrontLocked(task,flags,options);
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  ActivityOptions.abort(options);
}
Program: 197152
Project: 197152
Buggy source:
void startHomeActivity(Intent intent,ActivityInfo aInfo){
  moveHomeStackTaskToTop(HOME_ACTIVITY_TYPE);
  startActivityLocked(null,intent,null,aInfo,null,null,null,null,0,0,0,null,0,null,false,null,null,null);
}

Fixed version (ground truth):
void startHomeActivity(Intent intent,ActivityInfo aInfo){
  moveHomeStackTaskToTop(HOME_ACTIVITY_TYPE);
  startActivityLocked(null,intent,null,aInfo,null,null,null,null,0,0,0,null,0,0,0,null,false,null,null,null);
}
Program: 197162
Project: 197162
Buggy source:
@Override public void moveTaskToBack(int taskId){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    TaskRecord tr=recentTaskForIdLocked(taskId);
    if (tr != null) {
      if (tr == mStackSupervisor.mLockTaskModeTask) {
        mStackSupervisor.showLockTaskToast();
        return;
      }
      if (DEBUG_STACK)       Slog.d(TAG,"String_Node_Str" + tr);
      ActivityStack stack=tr.stack;
      if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
        if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
          return;
        }
      }
      final long origId=Binder.clearCallingIdentity();
      try {
        stack.moveTaskToBackLocked(taskId,null);
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void moveTaskToBack(int taskId){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    TaskRecord tr=recentTaskForIdLocked(taskId);
    if (tr != null) {
      if (tr == mStackSupervisor.mLockTaskModeTask) {
        mStackSupervisor.showLockTaskToast();
        return;
      }
      if (DEBUG_STACK)       Slog.d(TAG,"String_Node_Str" + tr);
      ActivityStack stack=tr.stack;
      if (stack.mResumedActivity != null && stack.mResumedActivity.task == tr) {
        if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
          return;
        }
      }
      final long origId=Binder.clearCallingIdentity();
      try {
        stack.moveTaskToBackLocked(taskId,null);
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
}
Program: 197163
Project: 197163
Buggy source:
boolean checkAppSwitchAllowedLocked(int callingPid,int callingUid,String name){
  if (mAppSwitchesAllowedTime < SystemClock.uptimeMillis()) {
    return true;
  }
  final int perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,callingPid,callingUid,-1,true);
  if (perm == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  Slog.w(TAG,name + "String_Node_Str" + callingUid+ "String_Node_Str");
  return false;
}

Fixed version (ground truth):
boolean checkAppSwitchAllowedLocked(int sourcePid,int sourceUid,int callingPid,int callingUid,String name){
  if (mAppSwitchesAllowedTime < SystemClock.uptimeMillis()) {
    return true;
  }
  int perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,sourcePid,sourceUid,-1,true);
  if (perm == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  if (callingUid != -1 && callingUid != sourceUid) {
    perm=checkComponentPermission(android.Manifest.permission.STOP_APP_SWITCHES,callingPid,callingUid,-1,true);
    if (perm == PackageManager.PERMISSION_GRANTED) {
      return true;
    }
  }
  Slog.w(TAG,name + "String_Node_Str" + sourceUid+ "String_Node_Str");
  return false;
}
Program: 197165
Project: 197165
Buggy source:
@Override public void moveTaskBackwards(int task){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    moveTaskBackwardsLocked(task);
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
@Override public void moveTaskBackwards(int task){
  enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,"String_Node_Str");
synchronized (this) {
    if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
      return;
    }
    final long origId=Binder.clearCallingIdentity();
    moveTaskBackwardsLocked(task);
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 197166
Project: 197166
Buggy source:
@Override public void moveToFront(){
  checkCaller();
  final TaskRecord tr;
synchronized (ActivityManagerService.this) {
    tr=recentTaskForIdLocked(mTaskId);
    if (tr == null) {
      throw new IllegalArgumentException("String_Node_Str" + mTaskId);
    }
    if (tr.getRootActivity() != null) {
      long origId=Binder.clearCallingIdentity();
      try {
        moveTaskToFrontLocked(tr.taskId,0,null);
        return;
      }
  finally {
        Binder.restoreCallingIdentity(origId);
      }
    }
  }
  startActivityFromRecentsInner(tr.taskId,null);
}

Fixed version (ground truth):
@Override public void moveToFront(){
  checkCaller();
  final TaskRecord tr;
synchronized (ActivityManagerService.this) {
    tr=recentTaskForIdLocked(mTaskId);
    if (tr == null) {
      throw new IllegalArgumentException("String_Node_Str" + mTaskId);
    }
    if (tr.getRootActivity() != null) {
      moveTaskToFrontLocked(tr.taskId,0,null);
    }
  }
  startActivityFromRecentsInner(tr.taskId,null);
}
Program: 197167
Project: 197167
Buggy source:
void moveTaskToFrontLocked(int taskId,int flags,Bundle options){
  if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),"String_Node_Str")) {
    ActivityOptions.abort(options);
    return;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    final TaskRecord task=mStackSupervisor.anyTaskForIdLocked(taskId);
    if (task == null) {
      return;
    }
    if (mStackSupervisor.isLockTaskModeViolation(task)) {
      mStackSupervisor.showLockTaskToast();
      Slog.e(TAG,"String_Node_Str");
      return;
    }
    final ActivityRecord prev=mStackSupervisor.topRunningActivityLocked();
    if (prev != null && prev.isRecentsActivity()) {
      task.setTaskToReturnTo(ActivityRecord.RECENTS_ACTIVITY_TYPE);
    }
    mStackSupervisor.findTaskToMoveToFrontLocked(task,flags,options);
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  ActivityOptions.abort(options);
}

Fixed version (ground truth):
void moveTaskToFrontLocked(int taskId,int flags,Bundle options){
  if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),Binder.getCallingUid(),-1,-1,"String_Node_Str")) {
    ActivityOptions.abort(options);
    return;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    final TaskRecord task=mStackSupervisor.anyTaskForIdLocked(taskId);
    if (task == null) {
      return;
    }
    if (mStackSupervisor.isLockTaskModeViolation(task)) {
      mStackSupervisor.showLockTaskToast();
      Slog.e(TAG,"String_Node_Str");
      return;
    }
    final ActivityRecord prev=mStackSupervisor.topRunningActivityLocked();
    if (prev != null && prev.isRecentsActivity()) {
      task.setTaskToReturnTo(ActivityRecord.RECENTS_ACTIVITY_TYPE);
    }
    mStackSupervisor.findTaskToMoveToFrontLocked(task,flags,options);
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  ActivityOptions.abort(options);
}
Program: 197172
Project: 197172
Buggy source:
void startHomeActivity(Intent intent,ActivityInfo aInfo){
  moveHomeStackTaskToTop(HOME_ACTIVITY_TYPE);
  startActivityLocked(null,intent,null,aInfo,null,null,null,null,0,0,0,null,0,null,false,null,null,null);
}

Fixed version (ground truth):
void startHomeActivity(Intent intent,ActivityInfo aInfo){
  moveHomeStackTaskToTop(HOME_ACTIVITY_TYPE);
  startActivityLocked(null,intent,null,aInfo,null,null,null,null,0,0,0,null,0,0,0,null,false,null,null,null);
}