Loading src/java/com/android/internal/telephony/CarrierIdentifier.java +12 −2 Original line number Diff line number Diff line Loading @@ -555,17 +555,26 @@ public class CarrierIdentifier extends Handler { /* * Write Carrier Identification Matching event, logging with the * matching score and carrierId to differentiate below cases of metrics: * carrierId, gid1 and carrier list version to differentiate below cases of metrics: * 1) unknown mccmnc - the Carrier Id provider contains no rule that matches the * read mccmnc. * 2) the Carrier Id provider contains some rule(s) that match the read mccmnc, * but the read gid1 is not matched within the highest-scored rule. * 3) successfully found a matched carrier id in the provider. * 4) use carrier list version to compare the unknown carrier ratio between each version. */ String gid1ToLog = ((maxScore & CarrierMatchingRule.SCORE_GID1) == 0 && !TextUtils.isEmpty(subscriptionRule.mGid1)) ? subscriptionRule.mGid1 : null; TelephonyMetrics.getInstance().writeCarrierIdMatchingEvent( mPhone.getPhoneId(), mCarrierId, gid1ToLog); mPhone.getPhoneId(), getCarrierListVersion(), mCarrierId, gid1ToLog); } private int getCarrierListVersion() { final Cursor cursor = mContext.getContentResolver().query( Uri.withAppendedPath(Telephony.CarrierIdentification.CONTENT_URI, "get_version"), null, null, null); cursor.moveToFirst(); return cursor.getInt(0); } public int getCarrierId() { Loading Loading @@ -599,6 +608,7 @@ public class CarrierIdentifier extends Handler { ipw.println("mCarrierId: " + mCarrierId); ipw.println("mCarrierName: " + mCarrierName); ipw.println("version: " + getCarrierListVersion()); ipw.println("mCarrierMatchingRules on mccmnc: " + mTelephonyMgr.getSimOperatorNumericForPhone(mPhone.getPhoneId())); Loading src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java +3 −1 Original line number Diff line number Diff line Loading @@ -1721,10 +1721,11 @@ public class TelephonyMetrics { * Write carrier identification matching event * * @param phoneId Phone id * @param version Carrier table version * @param cid Unique Carrier Id * @param gid1 Group id level 1 */ public void writeCarrierIdMatchingEvent(int phoneId, int cid, String gid1) { public void writeCarrierIdMatchingEvent(int phoneId, int version, int cid, String gid1) { final CarrierIdMatching carrierIdMatching = new CarrierIdMatching(); final CarrierIdMatchingResult carrierIdMatchingResult = new CarrierIdMatchingResult(); Loading @@ -1735,6 +1736,7 @@ public class TelephonyMetrics { } } carrierIdMatching.cidTableVersion = version; carrierIdMatching.result = carrierIdMatchingResult; TelephonyEvent event = new TelephonyEventBuilder(phoneId).setCarrierIdMatching( Loading tests/telephonytests/src/com/android/internal/telephony/metrics/TelephonyMetricsTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -187,7 +187,7 @@ public class TelephonyMetricsTest extends TelephonyTest { @SmallTest public void testWriteCarrierIdMatchingEventWithInvalidMatchingScore() throws Exception { mMetrics.writeCarrierIdMatchingEvent(mPhone.getPhoneId(), mMetrics.writeCarrierIdMatchingEvent(mPhone.getPhoneId(), 1, TelephonyManager.UNKNOWN_CARRIER_ID, "gid1Test"); TelephonyLog log = buildProto(); Loading @@ -196,6 +196,7 @@ public class TelephonyMetricsTest extends TelephonyTest { assertEquals(0, log.smsSessions.length); assertEquals(mPhone.getPhoneId(), log.events[0].phoneId); assertEquals(1, log.events[0].carrierIdMatching.cidTableVersion); assertEquals(TelephonyEvent.Type.CARRIER_ID_MATCHING, log.events[0].type); assertTrue(log.events[0].carrierIdMatching.result.gid1.isEmpty()); } Loading @@ -205,7 +206,7 @@ public class TelephonyMetricsTest extends TelephonyTest { @SmallTest public void testWriteCarrierIdMatchingEvent() throws Exception { mMetrics.writeCarrierIdMatchingEvent(mPhone.getPhoneId(), 1, "gid1Test"); mMetrics.writeCarrierIdMatchingEvent(mPhone.getPhoneId(), 1, 1, "gid1Test"); TelephonyLog log = buildProto(); assertEquals(1, log.events.length); Loading @@ -214,6 +215,7 @@ public class TelephonyMetricsTest extends TelephonyTest { assertEquals(mPhone.getPhoneId(), log.events[0].phoneId); assertEquals(TelephonyEvent.Type.CARRIER_ID_MATCHING, log.events[0].type); assertEquals(1, log.events[0].carrierIdMatching.cidTableVersion); assertEquals(1, log.events[0].carrierIdMatching.result.carrierId); assertEquals("gid1Test", log.events[0].carrierIdMatching.result.gid1); } Loading Loading
src/java/com/android/internal/telephony/CarrierIdentifier.java +12 −2 Original line number Diff line number Diff line Loading @@ -555,17 +555,26 @@ public class CarrierIdentifier extends Handler { /* * Write Carrier Identification Matching event, logging with the * matching score and carrierId to differentiate below cases of metrics: * carrierId, gid1 and carrier list version to differentiate below cases of metrics: * 1) unknown mccmnc - the Carrier Id provider contains no rule that matches the * read mccmnc. * 2) the Carrier Id provider contains some rule(s) that match the read mccmnc, * but the read gid1 is not matched within the highest-scored rule. * 3) successfully found a matched carrier id in the provider. * 4) use carrier list version to compare the unknown carrier ratio between each version. */ String gid1ToLog = ((maxScore & CarrierMatchingRule.SCORE_GID1) == 0 && !TextUtils.isEmpty(subscriptionRule.mGid1)) ? subscriptionRule.mGid1 : null; TelephonyMetrics.getInstance().writeCarrierIdMatchingEvent( mPhone.getPhoneId(), mCarrierId, gid1ToLog); mPhone.getPhoneId(), getCarrierListVersion(), mCarrierId, gid1ToLog); } private int getCarrierListVersion() { final Cursor cursor = mContext.getContentResolver().query( Uri.withAppendedPath(Telephony.CarrierIdentification.CONTENT_URI, "get_version"), null, null, null); cursor.moveToFirst(); return cursor.getInt(0); } public int getCarrierId() { Loading Loading @@ -599,6 +608,7 @@ public class CarrierIdentifier extends Handler { ipw.println("mCarrierId: " + mCarrierId); ipw.println("mCarrierName: " + mCarrierName); ipw.println("version: " + getCarrierListVersion()); ipw.println("mCarrierMatchingRules on mccmnc: " + mTelephonyMgr.getSimOperatorNumericForPhone(mPhone.getPhoneId())); Loading
src/java/com/android/internal/telephony/metrics/TelephonyMetrics.java +3 −1 Original line number Diff line number Diff line Loading @@ -1721,10 +1721,11 @@ public class TelephonyMetrics { * Write carrier identification matching event * * @param phoneId Phone id * @param version Carrier table version * @param cid Unique Carrier Id * @param gid1 Group id level 1 */ public void writeCarrierIdMatchingEvent(int phoneId, int cid, String gid1) { public void writeCarrierIdMatchingEvent(int phoneId, int version, int cid, String gid1) { final CarrierIdMatching carrierIdMatching = new CarrierIdMatching(); final CarrierIdMatchingResult carrierIdMatchingResult = new CarrierIdMatchingResult(); Loading @@ -1735,6 +1736,7 @@ public class TelephonyMetrics { } } carrierIdMatching.cidTableVersion = version; carrierIdMatching.result = carrierIdMatchingResult; TelephonyEvent event = new TelephonyEventBuilder(phoneId).setCarrierIdMatching( Loading
tests/telephonytests/src/com/android/internal/telephony/metrics/TelephonyMetricsTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -187,7 +187,7 @@ public class TelephonyMetricsTest extends TelephonyTest { @SmallTest public void testWriteCarrierIdMatchingEventWithInvalidMatchingScore() throws Exception { mMetrics.writeCarrierIdMatchingEvent(mPhone.getPhoneId(), mMetrics.writeCarrierIdMatchingEvent(mPhone.getPhoneId(), 1, TelephonyManager.UNKNOWN_CARRIER_ID, "gid1Test"); TelephonyLog log = buildProto(); Loading @@ -196,6 +196,7 @@ public class TelephonyMetricsTest extends TelephonyTest { assertEquals(0, log.smsSessions.length); assertEquals(mPhone.getPhoneId(), log.events[0].phoneId); assertEquals(1, log.events[0].carrierIdMatching.cidTableVersion); assertEquals(TelephonyEvent.Type.CARRIER_ID_MATCHING, log.events[0].type); assertTrue(log.events[0].carrierIdMatching.result.gid1.isEmpty()); } Loading @@ -205,7 +206,7 @@ public class TelephonyMetricsTest extends TelephonyTest { @SmallTest public void testWriteCarrierIdMatchingEvent() throws Exception { mMetrics.writeCarrierIdMatchingEvent(mPhone.getPhoneId(), 1, "gid1Test"); mMetrics.writeCarrierIdMatchingEvent(mPhone.getPhoneId(), 1, 1, "gid1Test"); TelephonyLog log = buildProto(); assertEquals(1, log.events.length); Loading @@ -214,6 +215,7 @@ public class TelephonyMetricsTest extends TelephonyTest { assertEquals(mPhone.getPhoneId(), log.events[0].phoneId); assertEquals(TelephonyEvent.Type.CARRIER_ID_MATCHING, log.events[0].type); assertEquals(1, log.events[0].carrierIdMatching.cidTableVersion); assertEquals(1, log.events[0].carrierIdMatching.result.carrierId); assertEquals("gid1Test", log.events[0].carrierIdMatching.result.gid1); } Loading