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

Commit 24e343e3 authored by sqian's avatar sqian
Browse files

Add mccmnc for unknown gid1 case in carrier Id metrics

Bug: 74132252
Bug: 77334923
Test: atest FrameworksTelephonyTests
Change-Id: Icc9f7dd9e86e86399c9a9aebcf0d98024ae46e90
Merged-In: Icc9f7dd9e86e86399c9a9aebcf0d98024ae46e90
(cherry picked from commit 7549b131)
parent b9290da5
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -567,7 +567,7 @@ public class CarrierIdentifier extends Handler {

        /*
         * Write Carrier Identification Matching event, logging with the
         * carrierId, gid1 and carrier list version to differentiate below cases of metrics:
         * carrierId, mccmnc, 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,
@@ -577,7 +577,8 @@ public class CarrierIdentifier extends Handler {
         */
        String unknownGid1ToLog = ((maxScore & CarrierMatchingRule.SCORE_GID1) == 0
                && !TextUtils.isEmpty(subscriptionRule.mGid1)) ? subscriptionRule.mGid1 : null;
        String unknownMccmncToLog = (maxScore == CarrierMatchingRule.SCORE_INVALID
        String unknownMccmncToLog = ((maxScore == CarrierMatchingRule.SCORE_INVALID
                || (maxScore & CarrierMatchingRule.SCORE_GID1) == 0)
                && !TextUtils.isEmpty(subscriptionRule.mMccMnc)) ? subscriptionRule.mMccMnc : null;
        TelephonyMetrics.getInstance().writeCarrierIdMatchingEvent(
                mPhone.getPhoneId(), getCarrierListVersion(), mCarrierId,
+7 −1
Original line number Diff line number Diff line
@@ -1782,13 +1782,19 @@ public class TelephonyMetrics {
        final CarrierIdMatchingResult carrierIdMatchingResult = new CarrierIdMatchingResult();

        if (cid != TelephonyManager.UNKNOWN_CARRIER_ID) {
            // Successful matching event if result only has carrierId
            carrierIdMatchingResult.carrierId = cid;
            // Unknown Gid1 event if result only has carrierId, gid1 and mccmnc
            if (gid1 != null) {
                carrierIdMatchingResult.mccmnc = mccmnc;
                carrierIdMatchingResult.gid1 = gid1;
            }
        } else {
            // Unknown mccmnc event if result only has mccmnc
            if (mccmnc != null) {
                carrierIdMatchingResult.mccmnc = mccmnc;
            }
        }

        carrierIdMatching.cidTableVersion = version;
        carrierIdMatching.result = carrierIdMatchingResult;
+1 −1
Original line number Diff line number Diff line
@@ -218,7 +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("mccmncTest", log.events[0].carrierIdMatching.result.mccmnc);
        assertEquals("gid1Test", log.events[0].carrierIdMatching.result.gid1);
    }