nus-yam/ex-repair huggingface dataset:
Program: 197182
Project: 197182
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: 197183
Project: 197183
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: 197185
Project: 197185
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: 197186
Project: 197186
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: 197187
Project: 197187
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: 197192
Project: 197192
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: 197194
Project: 197194
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: 197195
Project: 197195
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: 197197
Project: 197197
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: 197198
Project: 197198
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: 197199
Project: 197199
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: 197204
Project: 197204
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: 197214
Project: 197214
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: 197215
Project: 197215
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: 197217
Project: 197217
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: 197218
Project: 197218
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: 197219
Project: 197219
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: 197224
Project: 197224
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: 197226
Project: 197226
Buggy source:
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedYear(),ss.getSelectedMonth(),ss.getSelectedDay());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedDay(),ss.getSelectedMonth(),ss.getSelectedYear());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}
Program: 197235
Project: 197235
Buggy source:
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedYear(),ss.getSelectedMonth(),ss.getSelectedDay());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedDay(),ss.getSelectedMonth(),ss.getSelectedYear());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}
Program: 197236
Project: 197236
Buggy source:
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedYear(),ss.getSelectedMonth(),ss.getSelectedDay());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedDay(),ss.getSelectedMonth(),ss.getSelectedYear());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}
Program: 197237
Project: 197237
Buggy source:
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedYear(),ss.getSelectedMonth(),ss.getSelectedDay());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedDay(),ss.getSelectedMonth(),ss.getSelectedYear());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}
Program: 197238
Project: 197238
Buggy source:
@Override protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container){
  dispatchThawSelfOnly(container);
}

Fixed version (ground truth):
@Override public void dispatchRestoreInstanceState(SparseArray<Parcelable> container){
  mDelegator.dispatchThawSelfOnly(container);
}
Program: 197239
Project: 197239
Buggy source:
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedYear(),ss.getSelectedMonth(),ss.getSelectedDay());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedDay(),ss.getSelectedMonth(),ss.getSelectedYear());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}
Program: 197240
Project: 197240
Buggy source:
@Override protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container){
  dispatchThawSelfOnly(container);
}

Fixed version (ground truth):
@Override public void dispatchRestoreInstanceState(SparseArray<Parcelable> container){
  mDelegator.dispatchThawSelfOnly(container);
}
Program: 197241
Project: 197241
Buggy source:
@Override protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container){
  dispatchThawSelfOnly(container);
}

Fixed version (ground truth):
@Override public void dispatchRestoreInstanceState(SparseArray<Parcelable> container){
  mDelegator.dispatchThawSelfOnly(container);
}
Program: 197242
Project: 197242
Buggy source:
@Override protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container){
  dispatchThawSelfOnly(container);
}

Fixed version (ground truth):
@Override public void dispatchRestoreInstanceState(SparseArray<Parcelable> container){
  mDelegator.dispatchThawSelfOnly(container);
}
Program: 197243
Project: 197243
Buggy source:
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedYear(),ss.getSelectedMonth(),ss.getSelectedDay());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedDay(),ss.getSelectedMonth(),ss.getSelectedYear());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}
Program: 197244
Project: 197244
Buggy source:
@Override protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container){
  dispatchThawSelfOnly(container);
}

Fixed version (ground truth):
@Override public void dispatchRestoreInstanceState(SparseArray<Parcelable> container){
  mDelegator.dispatchThawSelfOnly(container);
}
Program: 197245
Project: 197245
Buggy source:
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedYear(),ss.getSelectedMonth(),ss.getSelectedDay());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedDay(),ss.getSelectedMonth(),ss.getSelectedYear());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}
Program: 197246
Project: 197246
Buggy source:
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedYear(),ss.getSelectedMonth(),ss.getSelectedDay());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedDay(),ss.getSelectedMonth(),ss.getSelectedYear());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}
Program: 197247
Project: 197247
Buggy source:
@Override protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container){
  dispatchThawSelfOnly(container);
}

Fixed version (ground truth):
@Override public void dispatchRestoreInstanceState(SparseArray<Parcelable> container){
  mDelegator.dispatchThawSelfOnly(container);
}
Program: 197248
Project: 197248
Buggy source:
@Override protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container){
  dispatchThawSelfOnly(container);
}

Fixed version (ground truth):
@Override public void dispatchRestoreInstanceState(SparseArray<Parcelable> container){
  mDelegator.dispatchThawSelfOnly(container);
}
Program: 197249
Project: 197249
Buggy source:
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedDay(),ss.getSelectedMonth(),ss.getSelectedYear());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Parcelable state){
  SavedState ss=(SavedState)state;
  mCurrentDate.set(ss.getSelectedYear(),ss.getSelectedMonth(),ss.getSelectedDay());
  mCurrentView=ss.getCurrentView();
  mMinDate.setTimeInMillis(ss.getMinDate());
  mMaxDate.setTimeInMillis(ss.getMaxDate());
  updateDisplay(false);
  setCurrentView(mCurrentView);
  final int listPosition=ss.getListPosition();
  if (listPosition != -1) {
    if (mCurrentView == MONTH_AND_DAY_VIEW) {
      mDayPickerView.postSetSelection(listPosition);
    }
 else     if (mCurrentView == YEAR_VIEW) {
      mYearPickerView.postSetSelectionFromTop(listPosition,ss.getListPositionOffset());
    }
  }
}
Program: 197257
Project: 197257
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: 197258
Project: 197258
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: 197259
Project: 197259
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: 197260
Project: 197260
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: 197261
Project: 197261
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: 197263
Project: 197263
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: 197264
Project: 197264
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: 197265
Project: 197265
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);
}