Search in sources :

Example 1 with ImsReasonInfo

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));
}
Also used : TelephonyEvent(com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent) ImsConnectionState(com.android.internal.telephony.nano.TelephonyProto.ImsConnectionState) TelephonyProto(com.android.internal.telephony.nano.TelephonyProto) ImsReasonInfo(com.android.ims.ImsReasonInfo)

Example 2 with ImsReasonInfo

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));
}
Also used : PersistableBundle(android.os.PersistableBundle) Bundle(android.os.Bundle) PersistableBundle(android.os.PersistableBundle) Handler(android.os.Handler) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver) ImsReasonInfo(com.android.ims.ImsReasonInfo) FlakyTest(android.support.test.filters.FlakyTest) Ignore(org.junit.Ignore) TelephonyTest(com.android.internal.telephony.TelephonyTest) SmallTest(android.test.suitebuilder.annotation.SmallTest) FlakyTest(android.support.test.filters.FlakyTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 3 with ImsReasonInfo

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());
}
Also used : ImsCall(com.android.ims.ImsCall) ImsPhoneCall(com.android.internal.telephony.imsphone.ImsPhoneCall) ImsPhone(com.android.internal.telephony.imsphone.ImsPhone) ImsReasonInfo(com.android.ims.ImsReasonInfo)

Aggregations

ImsReasonInfo (com.android.ims.ImsReasonInfo)3 BroadcastReceiver (android.content.BroadcastReceiver)1 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 Handler (android.os.Handler)1 PersistableBundle (android.os.PersistableBundle)1 FlakyTest (android.support.test.filters.FlakyTest)1 SmallTest (android.test.suitebuilder.annotation.SmallTest)1 ImsCall (com.android.ims.ImsCall)1 TelephonyTest (com.android.internal.telephony.TelephonyTest)1 ImsPhone (com.android.internal.telephony.imsphone.ImsPhone)1 ImsPhoneCall (com.android.internal.telephony.imsphone.ImsPhoneCall)1 TelephonyProto (com.android.internal.telephony.nano.TelephonyProto)1 ImsConnectionState (com.android.internal.telephony.nano.TelephonyProto.ImsConnectionState)1 TelephonyEvent (com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1