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

Commit 51234f70 authored by Sarah Chin's avatar Sarah Chin Committed by android-build-merger
Browse files

Add NrState and NrFrequency to telephony metrics

am: 039e2517

Change-Id: I59695df0db9958551f3b80d58612d54c02b06c6d
parents b70c1daf 039e2517
Loading
Loading
Loading
Loading
+44 −0
Original line number Original line Diff line number Diff line
@@ -262,6 +262,44 @@ message TelephonyServiceState {
    ROAMING_TYPE_INTERNATIONAL = 3;
    ROAMING_TYPE_INTERNATIONAL = 3;
  }
  }


  enum FrequencyRange {
    // Unknown. The default value.
    FREQUENCY_RANGE_UNKNOWN = -1;

    // Frequency range is below 1GHz.
    FREQUENCY_RANGE_LOW = 1;

    // Frequency range is between 1GHz and 3GHz.
    FREQUENCY_RANGE_MID = 2;

    // Frequency range is between 3GHz and 6GHz.
    FREQUENCY_RANGE_HIGH = 3;

    // Frequency range is above 6GHz (millimeter wave frequency).
    FREQUENCY_RANGE_MMWAVE = 4;
  }

  enum NrState {
    // The device isn't camped on an LTE cell
    // or the LTE cell doesn't support EN-DC.
    NR_STATE_NONE = -1;

    // The device is camped on an LTE cell that supports EN-DC
    // but either DCNR is restricted
    // or NR is not supported by the selected PLMN.
    NR_STATE_RESTRICTED = 1;

    // The device is camped on an LTE cell that supports EN-DC
    // and both DCNR is not restricted and NR is supported
    // by the selected PLMN.
    NR_STATE_NOT_RESTRICTED = 2;

    // The device is camped on an LTE cell that supports EN-DC
    // and connected to at least one 5G cell
    // as a secondary serving cell.
    NR_STATE_CONNECTED = 3;
  }

  // Current registered operator
  // Current registered operator
  optional TelephonyOperator voice_operator = 1;
  optional TelephonyOperator voice_operator = 1;


@@ -282,6 +320,12 @@ message TelephonyServiceState {


  // Current Channel Number
  // Current Channel Number
  optional int32 channel_number = 7;
  optional int32 channel_number = 7;

  // Current NR frequency range
  optional FrequencyRange nr_frequency_range = 8;

  // Current NR state
  optional NrState nr_state = 9;
}
}


// Radio access families
// Radio access families
+13 −2
Original line number Original line Diff line number Diff line
@@ -1560,6 +1560,8 @@ public class ServiceStateTracker extends Handler {
                    if (hasChanged
                    if (hasChanged
                            || RatRatcheter.updateBandwidths(getBandwidthsFromConfigs(list), mSS)) {
                            || RatRatcheter.updateBandwidths(getBandwidthsFromConfigs(list), mSS)) {
                        mPhone.notifyServiceStateChanged(mSS);
                        mPhone.notifyServiceStateChanged(mSS);
                        TelephonyMetrics.getInstance().writeServiceStateChanged(
                                mPhone.getPhoneId(), mSS);
                    }
                    }
                }
                }
                break;
                break;
@@ -2133,6 +2135,7 @@ public class ServiceStateTracker extends Handler {
                int serviceState = regCodeToServiceState(registrationState);
                int serviceState = regCodeToServiceState(registrationState);
                int newDataRat = ServiceState.networkTypeToRilRadioTechnology(
                int newDataRat = ServiceState.networkTypeToRilRadioTechnology(
                        networkRegState.getAccessNetworkTechnology());
                        networkRegState.getAccessNetworkTechnology());
                boolean nrHasChanged = false;


                if (DBG) {
                if (DBG) {
                    log("handlePollStateResultMessage: PS cellular. " + networkRegState);
                    log("handlePollStateResultMessage: PS cellular. " + networkRegState);
@@ -2143,11 +2146,17 @@ public class ServiceStateTracker extends Handler {
                // (2 or more cells) to a new cell if they camp for emergency service only.
                // (2 or more cells) to a new cell if they camp for emergency service only.
                if (serviceState == ServiceState.STATE_OUT_OF_SERVICE) {
                if (serviceState == ServiceState.STATE_OUT_OF_SERVICE) {
                    mLastPhysicalChannelConfigList = null;
                    mLastPhysicalChannelConfigList = null;
                    updateNrFrequencyRangeFromPhysicalChannelConfigs(null, mNewSS);
                    nrHasChanged |= updateNrFrequencyRangeFromPhysicalChannelConfigs(null, mNewSS);
                }
                }
                updateNrStateFromPhysicalChannelConfigs(mLastPhysicalChannelConfigList, mNewSS);
                nrHasChanged |= updateNrStateFromPhysicalChannelConfigs(
                        mLastPhysicalChannelConfigList, mNewSS);
                setPhyCellInfoFromCellIdentity(mNewSS, networkRegState.getCellIdentity());
                setPhyCellInfoFromCellIdentity(mNewSS, networkRegState.getCellIdentity());


                if (nrHasChanged) {
                    TelephonyMetrics.getInstance().writeServiceStateChanged(
                            mPhone.getPhoneId(), mSS);
                }

                if (mPhone.isPhoneTypeGsm()) {
                if (mPhone.isPhoneTypeGsm()) {


                    mNewReasonDataDenied = networkRegState.getRejectCause();
                    mNewReasonDataDenied = networkRegState.getRejectCause();
@@ -3385,7 +3394,9 @@ public class ServiceStateTracker extends Handler {
            mPhone.getContext().getContentResolver()
            mPhone.getContext().getContentResolver()
                    .insert(getUriForSubscriptionId(mPhone.getSubId()),
                    .insert(getUriForSubscriptionId(mPhone.getSubId()),
                            getContentValuesForServiceState(mSS));
                            getContentValuesForServiceState(mSS));
        }


        if (hasChanged || hasNrStateChanged) {
            TelephonyMetrics.getInstance().writeServiceStateChanged(mPhone.getPhoneId(), mSS);
            TelephonyMetrics.getInstance().writeServiceStateChanged(mPhone.getPhoneId(), mSS);
        }
        }


+6 −0
Original line number Original line Diff line number Diff line
@@ -433,6 +433,8 @@ public class TelephonyMetrics {
                        + "(" + "Data RAT " + event.serviceState.dataRat
                        + "(" + "Data RAT " + event.serviceState.dataRat
                        + " Voice RAT " + event.serviceState.voiceRat
                        + " Voice RAT " + event.serviceState.voiceRat
                        + " Channel Number " + event.serviceState.channelNumber
                        + " Channel Number " + event.serviceState.channelNumber
                        + " NR Frequency Range " + event.serviceState.nrFrequencyRange
                        + " NR State " + event.serviceState.nrState
                        + ")");
                        + ")");
            } else {
            } else {
                pw.print(telephonyEventToString(event.type));
                pw.print(telephonyEventToString(event.type));
@@ -462,6 +464,8 @@ public class TelephonyMetrics {
                            + "(" + "Data RAT " + event.serviceState.dataRat
                            + "(" + "Data RAT " + event.serviceState.dataRat
                            + " Voice RAT " + event.serviceState.voiceRat
                            + " Voice RAT " + event.serviceState.voiceRat
                            + " Channel Number " + event.serviceState.channelNumber
                            + " Channel Number " + event.serviceState.channelNumber
                            + " NR Frequency Range " + event.serviceState.nrFrequencyRange
                            + " NR State " + event.serviceState.nrState
                            + ")");
                            + ")");
                } else if (event.type == TelephonyCallSession.Event.Type.RIL_CALL_LIST_CHANGED) {
                } else if (event.type == TelephonyCallSession.Event.Type.RIL_CALL_LIST_CHANGED) {
                    pw.println(callSessionEventToString(event.type));
                    pw.println(callSessionEventToString(event.type));
@@ -911,6 +915,8 @@ public class TelephonyMetrics {
        ssProto.voiceRat = serviceState.getRilVoiceRadioTechnology();
        ssProto.voiceRat = serviceState.getRilVoiceRadioTechnology();
        ssProto.dataRat = serviceState.getRilDataRadioTechnology();
        ssProto.dataRat = serviceState.getRilDataRadioTechnology();
        ssProto.channelNumber = serviceState.getChannelNumber();
        ssProto.channelNumber = serviceState.getChannelNumber();
        ssProto.nrFrequencyRange = serviceState.getNrFrequencyRange();
        ssProto.nrState = serviceState.getNrState();
        return ssProto;
        return ssProto;
    }
    }