Program: 191526
Project: 191526
Buggy source:
/** 
 * Perform the operation associated with this PendingIntent, allowing the caller to specify information about the Intent to use and be notified when the send has completed. <p>For the intent parameter, a PendingIntent often has restrictions on which fields can be supplied here, based on how the PendingIntent was retrieved in   {@link #getActivity},  {@link #getBroadcast}, or   {@link #getService}.
 * @param context The Context of the caller.  This may be null if<var>intent</var> is also null.
 * @param code Result code to supply back to the PendingIntent's target.
 * @param intent Additional Intent data.  See {@link Intent#fillIn Intent.fillIn()} for information on how this is applied to theoriginal Intent.  Use null to not modify the original Intent. If flag  {@link #FLAG_IMMUTABLE} was set when this pending intent wascreated, this argument will be ignored.
 * @param onFinished The object to call back on when the send hascompleted, or null for no callback.
 * @param handler Handler identifying the thread on which the callbackshould happen.  If null, the callback will happen from the thread pool of the process.
 * @param requiredPermission Name of permission that a recipient of the PendingIntentis required to hold.  This is only valid for broadcast intents, and corresponds to the permission argument in {@link Context#sendBroadcast(Intent,String) Context.sendOrderedBroadcast(Intent, String)}. If null, no permission is required.
 * @param options Additional options the caller would like to provide to modify the sendingbehavior.  May be built from an  {@link ActivityOptions} to apply to an activity start.
 * @see #send()
 * @see #send(int)
 * @see #send(Context,int,Intent)
 * @see #send(int,android.app.PendingIntent.OnFinished,Handler)
 * @see #send(Context,int,Intent,OnFinished,Handler)
 * @throws CanceledException Throws CanceledException if the PendingIntentis no longer allowing more intents to be sent through it.
 */
public void send(Context context,int code,@Nullable Intent intent,@Nullable OnFinished onFinished,@Nullable Handler handler,@Nullable String requiredPermission,@Nullable Bundle options) throws CanceledException {
  try {
    String resolvedType=intent != null ? intent.resolveTypeIfNeeded(context.getContentResolver()) : null;
    int res=mTarget.send(code,intent,resolvedType,onFinished != null ? new FinishedDispatcher(this,onFinished,handler) : null,requiredPermission,options);
    if (res < 0) {
      throw new CanceledException();
    }
  }
 catch (  RemoteException e) {
    throw new CanceledException(e);
  }
}

Fixed version (ground truth):
/** 
 * Perform the operation associated with this PendingIntent, allowing the caller to specify information about the Intent to use and be notified when the send has completed. <p>For the intent parameter, a PendingIntent often has restrictions on which fields can be supplied here, based on how the PendingIntent was retrieved in   {@link #getActivity},  {@link #getBroadcast}, or   {@link #getService}.
 * @param context The Context of the caller.  This may be null if<var>intent</var> is also null.
 * @param code Result code to supply back to the PendingIntent's target.
 * @param intent Additional Intent data.  See {@link Intent#fillIn Intent.fillIn()} for information on how this is applied to theoriginal Intent.  Use null to not modify the original Intent. If flag  {@link #FLAG_IMMUTABLE} was set when this pending intent wascreated, this argument will be ignored.
 * @param onFinished The object to call back on when the send hascompleted, or null for no callback.
 * @param handler Handler identifying the thread on which the callbackshould happen.  If null, the callback will happen from the thread pool of the process.
 * @param requiredPermission Name of permission that a recipient of the PendingIntentis required to hold.  This is only valid for broadcast intents, and corresponds to the permission argument in {@link Context#sendBroadcast(Intent,String) Context.sendOrderedBroadcast(Intent, String)}. If null, no permission is required.
 * @param options Additional options the caller would like to provide to modify the sendingbehavior.  May be built from an  {@link ActivityOptions} to apply to an activity start.
 * @see #send()
 * @see #send(int)
 * @see #send(Context,int,Intent)
 * @see #send(int,android.app.PendingIntent.OnFinished,Handler)
 * @see #send(Context,int,Intent,OnFinished,Handler)
 * @throws CanceledException Throws CanceledException if the PendingIntentis no longer allowing more intents to be sent through it.
 */
public void send(Context context,int code,@Nullable Intent intent,@Nullable OnFinished onFinished,@Nullable Handler handler,@Nullable String requiredPermission,@Nullable Bundle options) throws CanceledException {
  try {
    String resolvedType=intent != null ? intent.resolveTypeIfNeeded(context.getContentResolver()) : null;
    int res=ActivityManagerNative.getDefault().sendIntentSender(mTarget,code,intent,resolvedType,onFinished != null ? new FinishedDispatcher(this,onFinished,handler) : null,requiredPermission,options);
    if (res < 0) {
      throw new CanceledException();
    }
  }
 catch (  RemoteException e) {
    throw new CanceledException(e);
  }
}