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

Commit c2e87eef authored by Kiwon Park's avatar Kiwon Park Committed by Android (Google) Code Review
Browse files

Merge "Collect unmetered networks information in PerSimStatus atom." into tm-qpr-dev

parents f1579a95 4388bef0
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ option java_outer_classname = "PersistAtomsProto";

// Holds atoms to store on persist storage in case of power cycle or process crash.
// NOTE: using int64 rather than google.protobuf.Timestamp for timestamps simplifies implementation.
// Next id: 50
// Next id: 53
message PersistAtoms {
    /* Aggregated RAT usage during the call. */
    repeated VoiceCallRatUsage voice_call_rat_usage = 1;
@@ -177,6 +177,9 @@ message PersistAtoms {

    /* Timestamp of last network_requests_v2 pull. */
    optional int64 network_requests_v2_pull_timestamp_millis = 51;

    /* Unmetered networks information. */
    repeated UnmeteredNetworks unmetered_networks = 52;
}

// The canonical versions of the following enums live in:
@@ -498,3 +501,9 @@ message GbaEvent {
    optional int32 failed_reason = 4;
    optional int32 count = 5;
}

message UnmeteredNetworks {
    optional int32 phone_id = 1;
    optional int32 carrier_id = 2;
    optional int64 unmetered_networks_bitmask = 3;
}
+4 −0
Original line number Diff line number Diff line
@@ -2718,6 +2718,10 @@ public class DataNetwork extends StateMachine {
        if (changed) {
            updateNetworkCapabilities();
        }
        if (mTempNotMetered && isInternetSupported()) {
            // NR NSA and NR have the same network type: NR
            mDataCallSessionStats.onUnmeteredUpdate(networkType);
        }
    }

    /**
+9 −0
Original line number Diff line number Diff line
@@ -209,6 +209,15 @@ public class DataCallSessionStats {
        }
    }

    /** Stores the current unmetered network types information in permanent storage. */
    public void onUnmeteredUpdate(@NetworkType int networkType) {
        mAtomsStorage
                .addUnmeteredNetworks(
                        mPhone.getPhoneId(),
                        mPhone.getCarrierId(),
                        TelephonyManager.getBitMaskForNetworkType(networkType));
    }

    /**
     * Take a snapshot of the on-going data call segment to add to the atom storage.
     *
+2 −1
Original line number Diff line number Diff line
@@ -683,7 +683,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback {
                    perSimStatus.disabled2g, // is2gDisabled
                    perSimStatus.pin1Enabled, // isPin1Enabled
                    perSimStatus.minimumVoltageClass, // simVoltageClass
                    perSimStatus.userModifiedApnTypes); // userModifiedApnTypeBitmask
                    perSimStatus.userModifiedApnTypes, // userModifiedApnTypeBitmask
                    perSimStatus.unmeteredNetworks); // unmeteredNetworks
            data.add(statsEvent);
            result = StatsManager.PULL_SUCCESS;
        }
+11 −3
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.text.TextUtils;

import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.telephony.uicc.UiccSlot;
@@ -74,16 +75,20 @@ public class PerSimStatus {
    public final boolean pin1Enabled;
    public final int minimumVoltageClass;
    public final int userModifiedApnTypes;
    public final long unmeteredNetworks;

    /** Returns the current sim status of the given {@link Phone}. */
    @Nullable
    public static PerSimStatus getCurrentState(Phone phone) {
        int[] numberIds = getNumberIds(phone);
        if (numberIds == null) return null;
        int carrierId = phone.getCarrierId();
        ImsMmTelManager imsMmTelManager = getImsMmTelManager(phone);
        IccCard iccCard = phone.getIccCard();
        PersistAtomsStorage persistAtomsStorage =
                PhoneFactory.getMetricsCollector().getAtomsStorage();
        return new PerSimStatus(
                phone.getCarrierId(),
                carrierId,
                numberIds[0],
                numberIds[1],
                numberIds[2],
@@ -101,7 +106,8 @@ public class PerSimStatus {
                is2gDisabled(phone),
                iccCard == null ? false : iccCard.getIccLockEnabled(),
                getMinimumVoltageClass(phone),
                getUserModifiedApnTypes(phone));
                getUserModifiedApnTypes(phone),
                persistAtomsStorage.getUnmeteredNetworks(phone.getPhoneId(), carrierId));
    }

    private PerSimStatus(
@@ -119,7 +125,8 @@ public class PerSimStatus {
            boolean disabled2g,
            boolean pin1Enabled,
            int minimumVoltageClass,
            int userModifiedApnTypes) {
            int userModifiedApnTypes,
            long unmeteredNetworks) {
        this.carrierId = carrierId;
        this.phoneNumberSourceUicc = phoneNumberSourceUicc;
        this.phoneNumberSourceCarrier = phoneNumberSourceCarrier;
@@ -135,6 +142,7 @@ public class PerSimStatus {
        this.pin1Enabled = pin1Enabled;
        this.minimumVoltageClass = minimumVoltageClass;
        this.userModifiedApnTypes = userModifiedApnTypes;
        this.unmeteredNetworks = unmeteredNetworks;
    }

    @Nullable
Loading