Program: 196089
Project: 196089
Buggy source:
/** 
 * This is the internal entry point for handling Activity.finish().
 * @param token The Binder token referencing the Activity we want to finish.
 * @param resultCode Result code, if any, from this Activity.
 * @param resultData Result data (Intent), if any, from this Activity.
 * @param finishTask Whether to finish the task associated with this Activity.  Only applies tothe root Activity in the task.
 * @return Returns true if the activity successfully finished, or false if it is still running.
 */
@Override public final boolean finishActivity(IBinder token,int resultCode,Intent resultData,boolean finishTask){
  if (resultData != null && resultData.hasFileDescriptors() == true) {
    throw new IllegalArgumentException("String_Node_Str");
  }
synchronized (this) {
    ActivityRecord r=ActivityRecord.isInStackLocked(token);
    if (r == null) {
      return true;
    }
    TaskRecord tr=r.task;
    ActivityRecord rootR=tr.getRootActivity();
    if (tr == mStackSupervisor.mLockTaskModeTask) {
      if (rootR == r) {
        mStackSupervisor.showLockTaskToast();
        return false;
      }
    }
    if (mController != null) {
      ActivityRecord next=r.task.stack.topRunningActivityLocked(token,0);
      if (next != null) {
        boolean resumeOK=true;
        try {
          resumeOK=mController.activityResuming(next.packageName);
        }
 catch (        RemoteException e) {
          mController=null;
          Watchdog.getInstance().setActivityController(null);
        }
        if (!resumeOK) {
          return false;
        }
      }
    }
    final long origId=Binder.clearCallingIdentity();
    try {
      boolean res;
      if (finishTask && r == rootR) {
        res=removeTaskByIdLocked(tr.taskId,0);
      }
 else {
        res=tr.stack.requestFinishActivityLocked(token,resultCode,resultData,"String_Node_Str",true);
      }
      return res;
    }
  finally {
      Binder.restoreCallingIdentity(origId);
    }
  }
}

Fixed version (ground truth):
/** 
 * This is the internal entry point for handling Activity.finish().
 * @param token The Binder token referencing the Activity we want to finish.
 * @param resultCode Result code, if any, from this Activity.
 * @param resultData Result data (Intent), if any, from this Activity.
 * @param finishTask Whether to finish the task associated with this Activity.  Only applies tothe root Activity in the task.
 * @return Returns true if the activity successfully finished, or false if it is still running.
 */
@Override public final boolean finishActivity(IBinder token,int resultCode,Intent resultData,boolean finishTask){
  if (resultData != null && resultData.hasFileDescriptors() == true) {
    throw new IllegalArgumentException("String_Node_Str");
  }
synchronized (this) {
    ActivityRecord r=ActivityRecord.isInStackLocked(token);
    if (r == null) {
      return true;
    }
    TaskRecord tr=r.task;
    ActivityRecord rootR=tr.getRootActivity();
    if (tr == mStackSupervisor.mLockTaskModeTask) {
      if (rootR == r) {
        mStackSupervisor.showLockTaskToast();
        return false;
      }
    }
    if (mController != null) {
      ActivityRecord next=r.task.stack.topRunningActivityLocked(token,0);
      if (next != null) {
        boolean resumeOK=true;
        try {
          resumeOK=mController.activityResuming(next.packageName);
        }
 catch (        RemoteException e) {
          mController=null;
          Watchdog.getInstance().setActivityController(null);
        }
        if (!resumeOK) {
          return false;
        }
      }
    }
    final long origId=Binder.clearCallingIdentity();
    try {
      boolean res;
      if (finishTask && r == rootR) {
        res=removeTaskByIdLocked(tr.taskId,false);
      }
 else {
        res=tr.stack.requestFinishActivityLocked(token,resultCode,resultData,"String_Node_Str",true);
      }
      return res;
    }
  finally {
      Binder.restoreCallingIdentity(origId);
    }
  }
}