use of com.android.ims.ImsReasonInfo in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyMetrics method writeOnImsConnectionState.
/**
* Write the IMS connection state changed event
*
* @param phoneId Phone id
* @param state IMS connection state
* @param reasonInfo The reason info. Only used for disconnected state.
*/
public synchronized void writeOnImsConnectionState(int phoneId, int state, ImsReasonInfo reasonInfo) {
ImsConnectionState imsState = new ImsConnectionState();
imsState.state = state;
if (reasonInfo != null) {
TelephonyProto.ImsReasonInfo ri = new TelephonyProto.ImsReasonInfo();
ri.reasonCode = reasonInfo.getCode();
ri.extraCode = reasonInfo.getExtraCode();
String extraMessage = reasonInfo.getExtraMessage();
if (extraMessage != null) {
ri.extraMessage = extraMessage;
}
imsState.reasonInfo = ri;
}
// If the connection state does not change, do not log it.
if (mLastImsConnectionState.get(phoneId) != null && Arrays.equals(ImsConnectionState.toByteArray(mLastImsConnectionState.get(phoneId)), ImsConnectionState.toByteArray(imsState))) {
return;
}
mLastImsConnectionState.put(phoneId, imsState);
TelephonyEvent event = new TelephonyEventBuilder(phoneId).setImsConnectionState(imsState).build();
addTelephonyEvent(event);
annotateInProgressCallSession(event.timestampMillis, phoneId, new CallSessionEventBuilder(TelephonyCallSession.Event.Type.IMS_CONNECTION_STATE_CHANGED).setImsConnectionState(event.imsConnectionState));
annotateInProgressSmsSession(event.timestampMillis, phoneId, new SmsSessionEventBuilder(SmsSession.Event.Type.IMS_CONNECTION_STATE_CHANGED).setImsConnectionState(event.imsConnectionState));
}
use of com.android.ims.ImsReasonInfo in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneTest method testProcessDisconnectReason.
@FlakyTest
@Test
@SmallTest
@Ignore
public void testProcessDisconnectReason() throws Exception {
// set up CarrierConfig
PersistableBundle bundle = mContextFixture.getCarrierConfigBundle();
bundle.putStringArray(CarrierConfigManager.KEY_WFC_OPERATOR_ERROR_CODES_STRING_ARRAY, new String[] { "REG09|0" });
// set up overlays
String title = "title";
String messageAlert = "Alert!";
String messageNotification = "Notification!";
mContextFixture.putStringArrayResource(com.android.internal.R.array.wfcOperatorErrorAlertMessages, new String[] { messageAlert });
mContextFixture.putStringArrayResource(com.android.internal.R.array.wfcOperatorErrorNotificationMessages, new String[] { messageNotification });
mContextFixture.putResource(com.android.internal.R.string.wfcRegErrorTitle, title);
mImsPhoneUT.processDisconnectReason(new ImsReasonInfo(ImsReasonInfo.CODE_REGISTRATION_ERROR, 0, "REG09"));
// TODO: Verify that WFC has been turned off (can't do it right now because
// setWfcSetting is static).
// verify(mImsManager).setWfcSetting(any(), eq(false));
ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
verify(mContext).sendOrderedBroadcast(intent.capture(), nullable(String.class), any(BroadcastReceiver.class), nullable(Handler.class), eq(Activity.RESULT_OK), nullable(String.class), nullable(Bundle.class));
assertEquals(ImsManager.ACTION_IMS_REGISTRATION_ERROR, intent.getValue().getAction());
assertEquals(title, intent.getValue().getStringExtra(Phone.EXTRA_KEY_ALERT_TITLE));
assertEquals(messageAlert, intent.getValue().getStringExtra(Phone.EXTRA_KEY_ALERT_MESSAGE));
assertEquals(messageNotification, intent.getValue().getStringExtra(Phone.EXTRA_KEY_NOTIFICATION_MESSAGE));
}
use of com.android.ims.ImsReasonInfo in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyTester method handleHandoverFailedIntent.
private void handleHandoverFailedIntent() {
// Attempt to get the active IMS call
ImsPhone imsPhone = (ImsPhone) mPhone;
if (imsPhone == null) {
return;
}
ImsPhoneCall imsPhoneCall = imsPhone.getForegroundCall();
if (imsPhoneCall == null) {
return;
}
ImsCall imsCall = imsPhoneCall.getImsCall();
if (imsCall == null) {
return;
}
imsCall.getImsCallSessionListenerProxy().callSessionHandoverFailed(imsCall.getCallSession(), ServiceState.RIL_RADIO_TECHNOLOGY_LTE, ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN, new ImsReasonInfo());
}
Aggregations