use of com.android.internal.telephony.imsphone.ImsExternalConnection in project packages_services_Telephony by Evolution-X.
the class PstnIncomingCallNotifier method addNewUnknownCall.
private void addNewUnknownCall(Connection connection) {
Log.i(this, "addNewUnknownCall, connection is: %s", connection);
if (!maybeSwapAnyWithUnknownConnection(connection)) {
Log.i(this, "determined new connection is: %s", connection);
Bundle extras = new Bundle();
if (connection.getNumberPresentation() == TelecomManager.PRESENTATION_ALLOWED && !TextUtils.isEmpty(connection.getAddress())) {
Uri uri = Uri.fromParts(PhoneAccount.SCHEME_TEL, connection.getAddress(), null);
extras.putParcelable(TelecomManager.EXTRA_UNKNOWN_CALL_HANDLE, uri);
}
// being added.
if (connection instanceof ImsExternalConnection) {
ImsExternalConnection externalConnection = (ImsExternalConnection) connection;
extras.putInt(ImsExternalCallTracker.EXTRA_IMS_EXTERNAL_CALL_ID, externalConnection.getCallId());
}
// Specifies the time the call was added. This is used by the dialer for analytics.
extras.putLong(EXTRA_CALL_CREATED_TIME_MILLIS, SystemClock.elapsedRealtime());
PhoneAccountHandle handle = findCorrectPhoneAccountHandle();
if (handle == null) {
try {
connection.hangup();
} catch (CallStateException e) {
// connection already disconnected. Do nothing
}
} else {
TelecomManager tm = mPhone.getContext().getSystemService(TelecomManager.class);
tm.addNewUnknownCall(handle, extras);
}
} else {
Log.i(this, "swapped an old connection, new one is: %s", connection);
}
}
use of com.android.internal.telephony.imsphone.ImsExternalConnection in project packages_services_Telephony by Evolution-X.
the class PstnIncomingCallNotifier method maybeSwapWithUnknownConnection.
private boolean maybeSwapWithUnknownConnection(TelephonyConnection telephonyConnection, Connection unknown) {
Connection original = telephonyConnection.getOriginalConnection();
if (original != null && !original.isIncoming() && Objects.equals(original.getAddress(), unknown.getAddress())) {
// to disconnect.
if (unknown instanceof ImsExternalConnection && !(telephonyConnection.getOriginalConnection() instanceof ImsExternalConnection)) {
Log.v(this, "maybeSwapWithUnknownConnection - not swapping regular connection " + "with external connection.");
return false;
}
telephonyConnection.setOriginalConnection(unknown);
// not supported.
if (original instanceof ImsExternalConnection) {
return true;
}
// call stuck in the call tracker preventing other calls from being placed.
if (original.getCall() != null && original.getCall().getPhone() != null && original.getCall().getPhone() instanceof GsmCdmaPhone) {
GsmCdmaPhone phone = (GsmCdmaPhone) original.getCall().getPhone();
phone.getCallTracker().cleanupCalls();
Log.i(this, "maybeSwapWithUnknownConnection - Invoking call tracker cleanup " + "for connection: " + original);
}
return true;
}
return false;
}
Aggregations