use of com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyMetrics method toServiceStateProto.
/**
* Convert the service state into service state proto
*
* @param serviceState Service state
* @return Service state proto
*/
private TelephonyServiceState toServiceStateProto(ServiceState serviceState) {
TelephonyServiceState ssProto = new TelephonyServiceState();
ssProto.voiceRoamingType = serviceState.getVoiceRoamingType();
ssProto.dataRoamingType = serviceState.getDataRoamingType();
ssProto.voiceOperator = new TelephonyServiceState.TelephonyOperator();
if (serviceState.getVoiceOperatorAlphaLong() != null) {
ssProto.voiceOperator.alphaLong = serviceState.getVoiceOperatorAlphaLong();
}
if (serviceState.getVoiceOperatorAlphaShort() != null) {
ssProto.voiceOperator.alphaShort = serviceState.getVoiceOperatorAlphaShort();
}
if (serviceState.getVoiceOperatorNumeric() != null) {
ssProto.voiceOperator.numeric = serviceState.getVoiceOperatorNumeric();
}
ssProto.dataOperator = new TelephonyServiceState.TelephonyOperator();
if (serviceState.getDataOperatorAlphaLong() != null) {
ssProto.dataOperator.alphaLong = serviceState.getDataOperatorAlphaLong();
}
if (serviceState.getDataOperatorAlphaShort() != null) {
ssProto.dataOperator.alphaShort = serviceState.getDataOperatorAlphaShort();
}
if (serviceState.getDataOperatorNumeric() != null) {
ssProto.dataOperator.numeric = serviceState.getDataOperatorNumeric();
}
ssProto.voiceRat = serviceState.getRilVoiceRadioTechnology();
ssProto.dataRat = serviceState.getRilDataRadioTechnology();
return ssProto;
}
use of com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyMetrics method startNewSmsSessionIfNeeded.
/**
* Create the SMS session if there isn't any existing one
*
* @param phoneId Phone id
* @return The SMS session
*/
private synchronized InProgressSmsSession startNewSmsSessionIfNeeded(int phoneId) {
InProgressSmsSession smsSession = mInProgressSmsSessions.get(phoneId);
if (smsSession == null) {
if (VDBG)
Rlog.v(TAG, "Starting a new sms session on phone " + phoneId);
smsSession = new InProgressSmsSession(phoneId);
mInProgressSmsSessions.append(phoneId, smsSession);
// Insert the latest service state, ims capabilities, and ims connection state as the
// base.
TelephonyServiceState serviceState = mLastServiceState.get(phoneId);
if (serviceState != null) {
smsSession.addEvent(smsSession.startElapsedTimeMs, new SmsSessionEventBuilder(TelephonyCallSession.Event.Type.RIL_SERVICE_STATE_CHANGED).setServiceState(serviceState));
}
ImsCapabilities imsCapabilities = mLastImsCapabilities.get(phoneId);
if (imsCapabilities != null) {
smsSession.addEvent(smsSession.startElapsedTimeMs, new SmsSessionEventBuilder(SmsSession.Event.Type.IMS_CAPABILITIES_CHANGED).setImsCapabilities(imsCapabilities));
}
ImsConnectionState imsConnectionState = mLastImsConnectionState.get(phoneId);
if (imsConnectionState != null) {
smsSession.addEvent(smsSession.startElapsedTimeMs, new SmsSessionEventBuilder(SmsSession.Event.Type.IMS_CONNECTION_STATE_CHANGED).setImsConnectionState(imsConnectionState));
}
}
return smsSession;
}
use of com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyMetrics method startNewCallSessionIfNeeded.
/**
* Create the call session if there isn't any existing one
*
* @param phoneId Phone id
* @return The call session
*/
private synchronized InProgressCallSession startNewCallSessionIfNeeded(int phoneId) {
InProgressCallSession callSession = mInProgressCallSessions.get(phoneId);
if (callSession == null) {
if (VDBG)
Rlog.v(TAG, "Starting a new call session on phone " + phoneId);
callSession = new InProgressCallSession(phoneId);
mInProgressCallSessions.append(phoneId, callSession);
// Insert the latest service state, ims capabilities, and ims connection states as the
// base.
TelephonyServiceState serviceState = mLastServiceState.get(phoneId);
if (serviceState != null) {
callSession.addEvent(callSession.startElapsedTimeMs, new CallSessionEventBuilder(TelephonyCallSession.Event.Type.RIL_SERVICE_STATE_CHANGED).setServiceState(serviceState));
}
ImsCapabilities imsCapabilities = mLastImsCapabilities.get(phoneId);
if (imsCapabilities != null) {
callSession.addEvent(callSession.startElapsedTimeMs, new CallSessionEventBuilder(TelephonyCallSession.Event.Type.IMS_CAPABILITIES_CHANGED).setImsCapabilities(imsCapabilities));
}
ImsConnectionState imsConnectionState = mLastImsConnectionState.get(phoneId);
if (imsConnectionState != null) {
callSession.addEvent(callSession.startElapsedTimeMs, new CallSessionEventBuilder(TelephonyCallSession.Event.Type.IMS_CONNECTION_STATE_CHANGED).setImsConnectionState(imsConnectionState));
}
}
return callSession;
}
use of com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyMetricsTest method testWriteServiceStateChanged.
// Test write service state changed
@Test
@SmallTest
public void testWriteServiceStateChanged() throws Exception {
mMetrics.writeServiceStateChanged(mPhone.getPhoneId(), mServiceState);
mMetrics.writeServiceStateChanged(mPhone.getPhoneId(), mServiceState);
TelephonyLog log = buildProto();
assertEquals(1, log.events.length);
assertEquals(0, log.callSessions.length);
assertEquals(0, log.smsSessions.length);
assertFalse(log.eventsDropped);
TelephonyEvent event = log.events[0];
assertEquals(TelephonyEvent.Type.RIL_SERVICE_STATE_CHANGED, event.type);
TelephonyServiceState state = event.serviceState;
assertEquals(RadioAccessTechnology.RAT_LTE, state.voiceRat);
assertEquals(RadioAccessTechnology.RAT_LTE, state.dataRat);
assertEquals(RoamingType.ROAMING_TYPE_DOMESTIC, state.voiceRoamingType);
assertEquals(RoamingType.ROAMING_TYPE_DOMESTIC, state.dataRoamingType);
assertEquals("voicelong", state.voiceOperator.alphaLong);
assertEquals("voiceshort", state.voiceOperator.alphaShort);
assertEquals("123456", state.voiceOperator.numeric);
assertEquals("datalong", state.dataOperator.alphaLong);
assertEquals("datashort", state.dataOperator.alphaShort);
assertEquals("123456", state.dataOperator.numeric);
}
use of com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyMetricsTest method testReset.
// Test reset scenario
@Test
@SmallTest
public void testReset() throws Exception {
mMetrics.writeServiceStateChanged(mPhone.getPhoneId(), mServiceState);
reset();
TelephonyLog log = buildProto();
assertEquals(1, log.events.length);
assertEquals(0, log.callSessions.length);
assertEquals(0, log.smsSessions.length);
assertFalse(log.eventsDropped);
TelephonyEvent event = log.events[0];
assertEquals(TelephonyEvent.Type.RIL_SERVICE_STATE_CHANGED, event.type);
TelephonyServiceState state = event.serviceState;
assertEquals(RadioAccessTechnology.RAT_LTE, state.voiceRat);
assertEquals(RadioAccessTechnology.RAT_LTE, state.dataRat);
assertEquals(RoamingType.ROAMING_TYPE_DOMESTIC, state.voiceRoamingType);
assertEquals(RoamingType.ROAMING_TYPE_DOMESTIC, state.dataRoamingType);
assertEquals("voicelong", state.voiceOperator.alphaLong);
assertEquals("voiceshort", state.voiceOperator.alphaShort);
assertEquals("123456", state.voiceOperator.numeric);
assertEquals("datalong", state.dataOperator.alphaLong);
assertEquals("datashort", state.dataOperator.alphaShort);
assertEquals("123456", state.dataOperator.numeric);
}
Aggregations