use of android.telephony.ims.ImsExternalCallState in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyTester method handleTestDialogEventPackageIntent.
/**
* Handles intents containing test dialog event package data.
*
* @param intent
*/
private void handleTestDialogEventPackageIntent(Intent intent) {
ImsPhone imsPhone = (ImsPhone) mPhone;
if (imsPhone == null) {
return;
}
ImsExternalCallTracker externalCallTracker = imsPhone.getExternalCallTracker();
if (externalCallTracker == null) {
return;
}
if (intent.hasExtra(EXTRA_STARTPACKAGE)) {
mImsExternalCallStates.clear();
} else if (intent.hasExtra(EXTRA_SENDPACKAGE)) {
externalCallTracker.refreshExternalCallState(mImsExternalCallStates);
mImsExternalCallStates.clear();
} else if (intent.hasExtra(EXTRA_DIALOGID)) {
ImsExternalCallState state = new ImsExternalCallState(intent.getIntExtra(EXTRA_DIALOGID, 0), Uri.parse(intent.getStringExtra(EXTRA_NUMBER)), intent.getBooleanExtra(EXTRA_CANPULL, true), intent.getIntExtra(EXTRA_STATE, ImsExternalCallState.CALL_STATE_CONFIRMED), ImsCallProfile.CALL_TYPE_VOICE, false);
mImsExternalCallStates.add(state);
}
}
use of android.telephony.ims.ImsExternalCallState in project android_frameworks_opt_telephony by LineageOS.
the class ImsExternalCallTracker method refreshExternalCallState.
/**
* Called when the IMS stack receives a new dialog event package. Triggers the creation and
* update of {@link ImsExternalConnection}s to represent the dialogs in the dialog event
* package data.
*
* @param externalCallStates the {@link ImsExternalCallState} information for the dialog event
* package.
*/
public void refreshExternalCallState(List<ImsExternalCallState> externalCallStates) {
Log.d(TAG, "refreshExternalCallState");
// Check to see if any call Ids are no longer present in the external call state. If they
// are, the calls are terminated and should be removed.
Iterator<Map.Entry<Integer, ImsExternalConnection>> connectionIterator = mExternalConnections.entrySet().iterator();
boolean wasCallRemoved = false;
while (connectionIterator.hasNext()) {
Map.Entry<Integer, ImsExternalConnection> entry = connectionIterator.next();
int callId = entry.getKey().intValue();
if (!containsCallId(externalCallStates, callId)) {
ImsExternalConnection externalConnection = entry.getValue();
externalConnection.setTerminated();
externalConnection.removeListener(mExternalConnectionListener);
connectionIterator.remove();
wasCallRemoved = true;
}
}
// TelephonyConnection instancse to refresh their state with Telecom.
if (wasCallRemoved) {
mCallStateNotifier.notifyPreciseCallStateChanged();
}
// Check for new calls, and updates to existing ones.
if (externalCallStates != null && !externalCallStates.isEmpty()) {
for (ImsExternalCallState callState : externalCallStates) {
if (!mExternalConnections.containsKey(callState.getCallId())) {
Log.d(TAG, "refreshExternalCallState: got = " + callState);
// telecom.
if (callState.getCallState() != ImsExternalCallState.CALL_STATE_CONFIRMED) {
continue;
}
createExternalConnection(callState);
} else {
updateExistingConnection(mExternalConnections.get(callState.getCallId()), callState);
}
}
}
}
use of android.telephony.ims.ImsExternalCallState in project android_frameworks_opt_telephony by LineageOS.
the class ImsExternalCallTrackerTest method testAddExternalCall.
@FlakyTest
@Test
@Ignore
public void testAddExternalCall() {
List<ImsExternalCallState> dep = new ArrayList<>();
dep.add(new ImsExternalCallState(CALL_ID, TEST_ADDRESS, false, /* isPullable */
ImsExternalCallState.CALL_STATE_CONFIRMED, ImsCallProfile.CALL_TYPE_VOICE, false));
mTracker.refreshExternalCallState(dep);
ArgumentCaptor<Connection> connectionArgumentCaptor = ArgumentCaptor.forClass(Connection.class);
verify(mCallNotifier).notifyUnknownConnection(connectionArgumentCaptor.capture());
Connection connection = connectionArgumentCaptor.getValue();
assert (connection instanceof ImsExternalConnection);
}
Aggregations