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

Commit f30be7ee authored by Ling Ma's avatar Ling Ma
Browse files

Add metrics for AutoDataSwitch

Add DataCallSessionStats.is_non_dds and
DataStallRecoveryReported.other_phone_signal_strength to track the
effectiveness of auto data switch feature.

AMD: https://eldar.corp.google.com/assessments/296451350/drafts/795146072?jsmode=o#sections/999001
PDD: https://eldar.corp.google.com/assessments/653114600/drafts/771765910?jsmode=o#sections/55001

Bug: 253081968
Test: pull and check DataCallSessionStats.is_non_dds on local device +
basic data browsing + phone call

Change-Id: If8342b9150d56546c85c1a9ad255f4d17c5c04bc
parent 0aefbf18
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -313,6 +313,7 @@ message DataCallSession {
    optional int32 band_at_end = 19;
    repeated int32 handover_failure_causes = 20;
    repeated int32 handover_failure_rat = 21;
    optional bool is_non_dds = 22;
}

message CellularServiceState {
+14 −0
Original line number Diff line number Diff line
@@ -29,7 +29,9 @@ import android.telephony.Annotation.DataFailureCause;
import android.telephony.Annotation.NetworkType;
import android.telephony.DataFailCause;
import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting;
import android.telephony.data.ApnSetting.ProtocolType;
import android.telephony.data.DataCallResponse;
import android.telephony.data.DataService;
@@ -257,6 +259,16 @@ public class DataCallSessionStats {
    private void endDataCallSession() {
        mDataCallSession.oosAtEnd = getIsOos();
        mDataCallSession.ongoing = false;
        // set if this data call is established for internet on the non-Dds
        SubscriptionInfo subInfo = SubscriptionController.getInstance()
                .getSubscriptionInfo(mPhone.getSubId());
        if (mPhone.getSubId() != SubscriptionController.getInstance().getDefaultDataSubId()
                && ((mDataCallSession.apnTypeBitmask & ApnSetting.TYPE_DEFAULT)
                == ApnSetting.TYPE_DEFAULT)
                && subInfo != null && !subInfo.isOpportunistic()) {
            mDataCallSession.isNonDds = true;
        }

        // store for the data call list event, after DataCall is disconnected and entered into
        // inactive mode
        PhoneFactory.getMetricsCollector().unregisterOngoingDataCallStat(this);
@@ -292,6 +304,7 @@ public class DataCallSessionStats {
                call.handoverFailureCauses.length);
        copy.handoverFailureRat = Arrays.copyOf(call.handoverFailureRat,
                call.handoverFailureRat.length);
        copy.isNonDds = call.isNonDds;
        return copy;
    }

@@ -316,6 +329,7 @@ public class DataCallSessionStats {
        proto.ongoing = true;
        proto.handoverFailureCauses = new int[0];
        proto.handoverFailureRat = new int[0];
        proto.isNonDds = false;
        return proto;
    }

+26 −1
Original line number Diff line number Diff line
@@ -16,12 +16,16 @@

package com.android.internal.telephony.metrics;

import android.telephony.AccessNetworkConstants;
import android.telephony.Annotation.NetworkType;
import android.telephony.CellSignalStrength;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;

import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.ServiceStateTracker;
import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.TelephonyStatsLog;
@@ -74,6 +78,25 @@ public class DataStallRecoveryStats {
            recoveryAction = RECOVERY_ACTION_RESET_MODEM_MAPPING;
        }

        // collect info of the other device in case of DSDS
        int otherSignalStrength = CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
        // the number returned here matches the NetworkRegistrationState enum we have
        int otherNetworkRegState = NetworkRegistrationInfo
                .REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING;
        for (Phone otherPhone : PhoneFactory.getPhones()) {
            if (otherPhone.getPhoneId() == phone.getPhoneId()) continue;
            if (!getIsOpportunistic(otherPhone)) {
                otherSignalStrength = otherPhone.getSignalStrength().getLevel();
                NetworkRegistrationInfo regInfo = otherPhone.getServiceState()
                        .getNetworkRegistrationInfo(NetworkRegistrationInfo.DOMAIN_PS,
                                AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
                if (regInfo != null) {
                    otherNetworkRegState = regInfo.getRegistrationState();
                }
                break;
            }
        }

        TelephonyStatsLog.write(
                TelephonyStatsLog.DATA_STALL_RECOVERY_REPORTED,
                carrierId,
@@ -85,7 +108,9 @@ public class DataStallRecoveryStats {
                band,
                isRecovered,
                durationMillis,
                reason);
                reason,
                otherSignalStrength,
                otherNetworkRegState);
    }

    /** Returns the RAT used for data (including IWLAN). */
+2 −1
Original line number Diff line number Diff line
@@ -858,7 +858,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback {
                dataCallSession.ongoing,
                dataCallSession.bandAtEnd,
                dataCallSession.handoverFailureCauses,
                dataCallSession.handoverFailureRat);
                dataCallSession.handoverFailureRat,
                dataCallSession.isNonDds);
    }

    private static StatsEvent buildStatsEvent(ImsRegistrationStats stats) {