Loading src/java/com/android/internal/telephony/TelephonyEventLog.java +60 −59 Original line number Diff line number Diff line Loading @@ -6,20 +6,12 @@ import com.android.ims.internal.ImsCallSession; import com.android.internal.telephony.dataconnection.DataCallResponse; import com.android.internal.telephony.imsphone.ImsPhoneCall; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.net.ConnectivityMetricsLogger; import android.os.Bundle; import android.os.IBinder; import android.os.Parcel; import android.os.RemoteException; import android.telephony.ServiceState; import android.util.Log; import android.util.SparseArray; import java.util.ArrayList; import java.util.Objects; import static com.android.internal.telephony.RILConstants.*; Loading Loading @@ -145,10 +137,10 @@ public class TelephonyEventLog extends ConnectivityMetricsLogger { public static final String SERVICE_STATE_VOICE_ROAMING_TYPE = "roamingType"; public static final String SERVICE_STATE_DATA_ROAMING_TYPE = "dataRoamingType"; public static final String SERVICE_STATE_VOICE_ALPHA_LONG = "alphaLong"; public static final String SERVICE_STATE_VOICE_ALPNA_SHORT = "alphaShort"; public static final String SERVICE_STATE_VOICE_ALPHA_SHORT = "alphaShort"; public static final String SERVICE_STATE_VOICE_NUMERIC = "operator"; public static final String SERVICE_STATE_DATA_ALPHA_LONG = "dataAlphaLong"; public static final String SERVICE_STATE_DATA_ALPNA_SHORT = "dataAlphaShort"; public static final String SERVICE_STATE_DATA_ALPHA_SHORT = "dataAlphaShort"; public static final String SERVICE_STATE_DATA_NUMERIC = "dataOperator"; public static final String SERVICE_STATE_VOICE_RAT = "rat"; public static final String SERVICE_STATE_DATA_RAT = "dataRat"; Loading Loading @@ -197,71 +189,80 @@ public class TelephonyEventLog extends ConnectivityMetricsLogger { private int mRilVoiceRadioTechnology = -1; private int mRilDataRadioTechnology = -1; private boolean mEmergencyOnly = false; private Bundle mLastServiceStateBundle = null; public static boolean equals(Object a, Object b) { return (a == null ? b == null : a.equals(b)); } private static boolean areBundlesEqual(Bundle first, Bundle second) { if (first == null || second == null) { return first == second; } if (first.size() != second.size()) { return false; } for(String key : first.keySet()) { if (key != null) { final Object firstValue = first.get(key); final Object secondValue = second.get(key); if (!Objects.equals(firstValue, secondValue)) { return false; } } } return true; } public void writeServiceStateChanged(ServiceState serviceState) { Bundle b = new Bundle(); boolean changed = false; if (mVoiceRegState != serviceState.getVoiceRegState()) { mVoiceRegState = serviceState.getVoiceRegState(); b.putInt(SERVICE_STATE_VOICE_REG_STATE, mVoiceRegState); changed = true; } if (mDataRegState != serviceState.getDataRegState()) { mDataRegState = serviceState.getDataRegState(); b.putInt(SERVICE_STATE_DATA_REG_STATE, mDataRegState); changed = true; } if (mVoiceRoamingType != serviceState.getVoiceRoamingType()) { mVoiceRoamingType = serviceState.getVoiceRoamingType(); b.putInt(SERVICE_STATE_VOICE_ROAMING_TYPE, mVoiceRoamingType); changed = true; } if (mDataRoamingType != serviceState.getDataRoamingType()) { mDataRoamingType = serviceState.getDataRoamingType(); b.putInt(SERVICE_STATE_DATA_ROAMING_TYPE, mDataRoamingType); changed = true; } if (!equals(mVoiceOperatorAlphaShort, serviceState.getVoiceOperatorAlphaShort()) || !equals(mVoiceOperatorNumeric, serviceState.getVoiceOperatorNumeric())) { // TODO: Evaluate if we need to send AlphaLong. AlphaShort+Numeric might be enough. //b.putString(SERVICE_STATE_VOICE_ALPHA_LONG, serviceState.getVoiceOperatorAlphaLong()); if (serviceState.getVoiceOperatorAlphaShort() != null) { mVoiceOperatorAlphaShort = serviceState.getVoiceOperatorAlphaShort(); b.putString(SERVICE_STATE_VOICE_ALPHA_SHORT, mVoiceOperatorAlphaShort); } if (serviceState.getVoiceOperatorNumeric() != null) { mVoiceOperatorNumeric = serviceState.getVoiceOperatorNumeric(); b.putString(SERVICE_STATE_VOICE_ALPNA_SHORT, mVoiceOperatorAlphaShort); b.putString(SERVICE_STATE_VOICE_NUMERIC, mVoiceOperatorNumeric); changed = true; } if (!equals(mDataOperatorAlphaShort, serviceState.getDataOperatorAlphaShort()) || !equals(mDataOperatorNumeric, serviceState.getDataOperatorNumeric())) { // TODO: Evaluate if we need to send AlphaLong. AlphaShort+Numeric might be enough. //b.putString(SERVICE_STATE_DATA_ALPHA_LONG, serviceState.getDataOperatorAlphaLong()); if (serviceState.getDataOperatorAlphaShort() != null) { mDataOperatorAlphaShort = serviceState.getDataOperatorAlphaShort(); b.putString(SERVICE_STATE_DATA_ALPHA_SHORT, mDataOperatorAlphaShort); } if (serviceState.getDataOperatorNumeric() != null) { mDataOperatorNumeric = serviceState.getDataOperatorNumeric(); b.putString(SERVICE_STATE_DATA_ALPNA_SHORT, mDataOperatorAlphaShort); b.putString(SERVICE_STATE_DATA_NUMERIC, mDataOperatorNumeric); changed = true; } if (mRilVoiceRadioTechnology != serviceState.getRilVoiceRadioTechnology()) { mRilVoiceRadioTechnology = serviceState.getRilVoiceRadioTechnology(); b.putInt(SERVICE_STATE_VOICE_RAT, mRilVoiceRadioTechnology); changed = true; } if (mRilDataRadioTechnology != serviceState.getRilDataRadioTechnology()) { mRilDataRadioTechnology = serviceState.getRilDataRadioTechnology(); b.putInt(SERVICE_STATE_DATA_RAT, mRilDataRadioTechnology); changed = true; } if (mEmergencyOnly != serviceState.isEmergencyOnly()) { mEmergencyOnly = serviceState.isEmergencyOnly(); b.putBoolean(SERVICE_STATE_EMERGENCY_ONLY, mEmergencyOnly); changed = true; } if (changed) { // Only write the service state changed event if there is any field changed. if (!areBundlesEqual(b, mLastServiceStateBundle)) { mLastServiceStateBundle = b; writeEvent(TAG_SERVICE_STATE, b); } } Loading tests/telephonytests/src/com/android/internal/telephony/TelephonyEventLogTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -132,10 +132,10 @@ public class TelephonyEventLogTest extends TelephonyTest { m.put(TelephonyEventLog.SERVICE_STATE_DATA_ROAMING_TYPE, ServiceState.ROAMING_TYPE_NOT_ROAMING); //m.put(TelephonyEventLog.SERVICE_STATE_VOICE_ALPHA_LONG, "Test Voice Long"); m.put(TelephonyEventLog.SERVICE_STATE_VOICE_ALPNA_SHORT, "TestVoice"); m.put(TelephonyEventLog.SERVICE_STATE_VOICE_ALPHA_SHORT, "TestVoice"); m.put(TelephonyEventLog.SERVICE_STATE_VOICE_NUMERIC, "12345"); //m.put(TelephonyEventLog.SERVICE_STATE_DATA_ALPHA_LONG, "Test Date Long"); m.put(TelephonyEventLog.SERVICE_STATE_DATA_ALPNA_SHORT, "TestData"); m.put(TelephonyEventLog.SERVICE_STATE_DATA_ALPHA_SHORT, "TestData"); m.put(TelephonyEventLog.SERVICE_STATE_DATA_NUMERIC, "67890"); m.put(TelephonyEventLog.SERVICE_STATE_VOICE_RAT, ServiceState.RIL_RADIO_TECHNOLOGY_LTE); m.put(TelephonyEventLog.SERVICE_STATE_DATA_RAT, ServiceState.RIL_RADIO_TECHNOLOGY_LTE); Loading Loading
src/java/com/android/internal/telephony/TelephonyEventLog.java +60 −59 Original line number Diff line number Diff line Loading @@ -6,20 +6,12 @@ import com.android.ims.internal.ImsCallSession; import com.android.internal.telephony.dataconnection.DataCallResponse; import com.android.internal.telephony.imsphone.ImsPhoneCall; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.net.ConnectivityMetricsLogger; import android.os.Bundle; import android.os.IBinder; import android.os.Parcel; import android.os.RemoteException; import android.telephony.ServiceState; import android.util.Log; import android.util.SparseArray; import java.util.ArrayList; import java.util.Objects; import static com.android.internal.telephony.RILConstants.*; Loading Loading @@ -145,10 +137,10 @@ public class TelephonyEventLog extends ConnectivityMetricsLogger { public static final String SERVICE_STATE_VOICE_ROAMING_TYPE = "roamingType"; public static final String SERVICE_STATE_DATA_ROAMING_TYPE = "dataRoamingType"; public static final String SERVICE_STATE_VOICE_ALPHA_LONG = "alphaLong"; public static final String SERVICE_STATE_VOICE_ALPNA_SHORT = "alphaShort"; public static final String SERVICE_STATE_VOICE_ALPHA_SHORT = "alphaShort"; public static final String SERVICE_STATE_VOICE_NUMERIC = "operator"; public static final String SERVICE_STATE_DATA_ALPHA_LONG = "dataAlphaLong"; public static final String SERVICE_STATE_DATA_ALPNA_SHORT = "dataAlphaShort"; public static final String SERVICE_STATE_DATA_ALPHA_SHORT = "dataAlphaShort"; public static final String SERVICE_STATE_DATA_NUMERIC = "dataOperator"; public static final String SERVICE_STATE_VOICE_RAT = "rat"; public static final String SERVICE_STATE_DATA_RAT = "dataRat"; Loading Loading @@ -197,71 +189,80 @@ public class TelephonyEventLog extends ConnectivityMetricsLogger { private int mRilVoiceRadioTechnology = -1; private int mRilDataRadioTechnology = -1; private boolean mEmergencyOnly = false; private Bundle mLastServiceStateBundle = null; public static boolean equals(Object a, Object b) { return (a == null ? b == null : a.equals(b)); } private static boolean areBundlesEqual(Bundle first, Bundle second) { if (first == null || second == null) { return first == second; } if (first.size() != second.size()) { return false; } for(String key : first.keySet()) { if (key != null) { final Object firstValue = first.get(key); final Object secondValue = second.get(key); if (!Objects.equals(firstValue, secondValue)) { return false; } } } return true; } public void writeServiceStateChanged(ServiceState serviceState) { Bundle b = new Bundle(); boolean changed = false; if (mVoiceRegState != serviceState.getVoiceRegState()) { mVoiceRegState = serviceState.getVoiceRegState(); b.putInt(SERVICE_STATE_VOICE_REG_STATE, mVoiceRegState); changed = true; } if (mDataRegState != serviceState.getDataRegState()) { mDataRegState = serviceState.getDataRegState(); b.putInt(SERVICE_STATE_DATA_REG_STATE, mDataRegState); changed = true; } if (mVoiceRoamingType != serviceState.getVoiceRoamingType()) { mVoiceRoamingType = serviceState.getVoiceRoamingType(); b.putInt(SERVICE_STATE_VOICE_ROAMING_TYPE, mVoiceRoamingType); changed = true; } if (mDataRoamingType != serviceState.getDataRoamingType()) { mDataRoamingType = serviceState.getDataRoamingType(); b.putInt(SERVICE_STATE_DATA_ROAMING_TYPE, mDataRoamingType); changed = true; } if (!equals(mVoiceOperatorAlphaShort, serviceState.getVoiceOperatorAlphaShort()) || !equals(mVoiceOperatorNumeric, serviceState.getVoiceOperatorNumeric())) { // TODO: Evaluate if we need to send AlphaLong. AlphaShort+Numeric might be enough. //b.putString(SERVICE_STATE_VOICE_ALPHA_LONG, serviceState.getVoiceOperatorAlphaLong()); if (serviceState.getVoiceOperatorAlphaShort() != null) { mVoiceOperatorAlphaShort = serviceState.getVoiceOperatorAlphaShort(); b.putString(SERVICE_STATE_VOICE_ALPHA_SHORT, mVoiceOperatorAlphaShort); } if (serviceState.getVoiceOperatorNumeric() != null) { mVoiceOperatorNumeric = serviceState.getVoiceOperatorNumeric(); b.putString(SERVICE_STATE_VOICE_ALPNA_SHORT, mVoiceOperatorAlphaShort); b.putString(SERVICE_STATE_VOICE_NUMERIC, mVoiceOperatorNumeric); changed = true; } if (!equals(mDataOperatorAlphaShort, serviceState.getDataOperatorAlphaShort()) || !equals(mDataOperatorNumeric, serviceState.getDataOperatorNumeric())) { // TODO: Evaluate if we need to send AlphaLong. AlphaShort+Numeric might be enough. //b.putString(SERVICE_STATE_DATA_ALPHA_LONG, serviceState.getDataOperatorAlphaLong()); if (serviceState.getDataOperatorAlphaShort() != null) { mDataOperatorAlphaShort = serviceState.getDataOperatorAlphaShort(); b.putString(SERVICE_STATE_DATA_ALPHA_SHORT, mDataOperatorAlphaShort); } if (serviceState.getDataOperatorNumeric() != null) { mDataOperatorNumeric = serviceState.getDataOperatorNumeric(); b.putString(SERVICE_STATE_DATA_ALPNA_SHORT, mDataOperatorAlphaShort); b.putString(SERVICE_STATE_DATA_NUMERIC, mDataOperatorNumeric); changed = true; } if (mRilVoiceRadioTechnology != serviceState.getRilVoiceRadioTechnology()) { mRilVoiceRadioTechnology = serviceState.getRilVoiceRadioTechnology(); b.putInt(SERVICE_STATE_VOICE_RAT, mRilVoiceRadioTechnology); changed = true; } if (mRilDataRadioTechnology != serviceState.getRilDataRadioTechnology()) { mRilDataRadioTechnology = serviceState.getRilDataRadioTechnology(); b.putInt(SERVICE_STATE_DATA_RAT, mRilDataRadioTechnology); changed = true; } if (mEmergencyOnly != serviceState.isEmergencyOnly()) { mEmergencyOnly = serviceState.isEmergencyOnly(); b.putBoolean(SERVICE_STATE_EMERGENCY_ONLY, mEmergencyOnly); changed = true; } if (changed) { // Only write the service state changed event if there is any field changed. if (!areBundlesEqual(b, mLastServiceStateBundle)) { mLastServiceStateBundle = b; writeEvent(TAG_SERVICE_STATE, b); } } Loading
tests/telephonytests/src/com/android/internal/telephony/TelephonyEventLogTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -132,10 +132,10 @@ public class TelephonyEventLogTest extends TelephonyTest { m.put(TelephonyEventLog.SERVICE_STATE_DATA_ROAMING_TYPE, ServiceState.ROAMING_TYPE_NOT_ROAMING); //m.put(TelephonyEventLog.SERVICE_STATE_VOICE_ALPHA_LONG, "Test Voice Long"); m.put(TelephonyEventLog.SERVICE_STATE_VOICE_ALPNA_SHORT, "TestVoice"); m.put(TelephonyEventLog.SERVICE_STATE_VOICE_ALPHA_SHORT, "TestVoice"); m.put(TelephonyEventLog.SERVICE_STATE_VOICE_NUMERIC, "12345"); //m.put(TelephonyEventLog.SERVICE_STATE_DATA_ALPHA_LONG, "Test Date Long"); m.put(TelephonyEventLog.SERVICE_STATE_DATA_ALPNA_SHORT, "TestData"); m.put(TelephonyEventLog.SERVICE_STATE_DATA_ALPHA_SHORT, "TestData"); m.put(TelephonyEventLog.SERVICE_STATE_DATA_NUMERIC, "67890"); m.put(TelephonyEventLog.SERVICE_STATE_VOICE_RAT, ServiceState.RIL_RADIO_TECHNOLOGY_LTE); m.put(TelephonyEventLog.SERVICE_STATE_DATA_RAT, ServiceState.RIL_RADIO_TECHNOLOGY_LTE); Loading