boolean alreadyCalled;
String number;
String originalUri;
if (LOGV) Log.v(TAG, "Receiving intent " + intent + ".");
alreadyCalled = intent.getBooleanExtra(
OutgoingCallBroadcaster.EXTRA_ALREADY_CALLED, false);
if (alreadyCalled) {
if (LOGV) Log.v(TAG, "CALL already placed -- returning.");
return;
}
number = getResultData();
if (number == null) {
if (LOGV) Log.v(TAG, "CALL cancelled -- returning.");
return;
} else if (PhoneNumberUtils.isEmergencyNumber(number)) {
Log.w(TAG, "Cannot modify outgoing call to emergency number " + number + ".");
return;
}
originalUri = intent.getStringExtra(
OutgoingCallBroadcaster.EXTRA_ORIGINAL_URI);
if (originalUri == null) {
Log.e(TAG, "Intent is missing EXTRA_ORIGINAL_URI -- returning.");
return;
}
Uri uri = Uri.parse(originalUri);
if (LOGV) Log.v(TAG, "CALL to " + number + " proceeding.");
Intent newIntent = new Intent(Intent.ACTION_CALL, uri);
newIntent.putExtra(Intent.EXTRA_PHONE_NUMBER, number);
newIntent.setClass(context, InCallScreen.class);
newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(newIntent);