Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa3b7d02 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add mccmnc into local telephony proto and metrics"

parents 8fd38a8d 99a3a765
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -794,6 +794,10 @@ message TelephonyEvent {
    // Group id level 1. Logged only if gid1 is configured from subscription
    // but its matching rule is unknown
    optional string gid1 = 2;

    // MCC and MNC that map to this carrier. Logged only if mccmnc is configured
    // from subscription but its matching rule is unknown
    optional string mccmnc = 3;
  }

  // Time when event happened on device, in milliseconds since epoch
+5 −2
Original line number Diff line number Diff line
@@ -575,10 +575,13 @@ public class CarrierIdentifier extends Handler {
         * 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
        String unknownGid1ToLog = ((maxScore & CarrierMatchingRule.SCORE_GID1) == 0
                && !TextUtils.isEmpty(subscriptionRule.mGid1)) ? subscriptionRule.mGid1 : null;
        String unknownMccmncToLog = (maxScore == CarrierMatchingRule.SCORE_INVALID
                && !TextUtils.isEmpty(subscriptionRule.mMccMnc)) ? subscriptionRule.mMccMnc : null;
        TelephonyMetrics.getInstance().writeCarrierIdMatchingEvent(
                mPhone.getPhoneId(), getCarrierListVersion(), mCarrierId, gid1ToLog);
                mPhone.getPhoneId(), getCarrierListVersion(), mCarrierId,
                unknownMccmncToLog, unknownGid1ToLog);
    }

    private int getCarrierListVersion() {
+5 −1
Original line number Diff line number Diff line
@@ -1754,9 +1754,11 @@ public class TelephonyMetrics {
     * @param phoneId Phone id
     * @param version Carrier table version
     * @param cid Unique Carrier Id
     * @param mccmnc MCC and MNC that map to this carrier
     * @param gid1 Group id level 1
     */
    public void writeCarrierIdMatchingEvent(int phoneId, int version, int cid, String gid1) {
    public void writeCarrierIdMatchingEvent(int phoneId, int version, int cid,
                                            String mccmnc, String gid1) {
        final CarrierIdMatching carrierIdMatching = new CarrierIdMatching();
        final CarrierIdMatchingResult carrierIdMatchingResult = new CarrierIdMatchingResult();

@@ -1765,6 +1767,8 @@ public class TelephonyMetrics {
            if (gid1 != null) {
                carrierIdMatchingResult.gid1 = gid1;
            }
        } else {
            carrierIdMatchingResult.mccmnc = mccmnc;
        }

        carrierIdMatching.cidTableVersion = version;
+4 −2
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ public class TelephonyMetricsTest extends TelephonyTest {
    public void testWriteCarrierIdMatchingEventWithInvalidMatchingScore() throws Exception {

        mMetrics.writeCarrierIdMatchingEvent(mPhone.getPhoneId(), 1,
                TelephonyManager.UNKNOWN_CARRIER_ID, "gid1Test");
                TelephonyManager.UNKNOWN_CARRIER_ID, "mccmncTest", "gid1Test");
        TelephonyLog log = buildProto();

        assertEquals(1, log.events.length);
@@ -198,6 +198,7 @@ public class TelephonyMetricsTest extends TelephonyTest {
        assertEquals(mPhone.getPhoneId(), log.events[0].phoneId);
        assertEquals(1, log.events[0].carrierIdMatching.cidTableVersion);
        assertEquals(TelephonyEvent.Type.CARRIER_ID_MATCHING, log.events[0].type);
        assertEquals("mccmncTest", log.events[0].carrierIdMatching.result.mccmnc);
        assertTrue(log.events[0].carrierIdMatching.result.gid1.isEmpty());
    }

@@ -206,7 +207,7 @@ public class TelephonyMetricsTest extends TelephonyTest {
    @SmallTest
    public void testWriteCarrierIdMatchingEvent() throws Exception {

        mMetrics.writeCarrierIdMatchingEvent(mPhone.getPhoneId(), 1, 1, "gid1Test");
        mMetrics.writeCarrierIdMatchingEvent(mPhone.getPhoneId(), 1, 1, "mccmncTest", "gid1Test");
        TelephonyLog log = buildProto();

        assertEquals(1, log.events.length);
@@ -217,6 +218,7 @@ public class TelephonyMetricsTest extends TelephonyTest {
        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);
        assertTrue(log.events[0].carrierIdMatching.result.mccmnc.isEmpty());
        assertEquals("gid1Test", log.events[0].carrierIdMatching.result.gid1);
    }