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

Commit 096672f6 authored by Kiwon Park's avatar Kiwon Park Committed by Automerger Merge Worker
Browse files

Merge "Collect unmetered networks information in PerSimStatus atom." into...

Merge "Collect unmetered networks information in PerSimStatus atom." into tm-qpr-dev am: c2e87eef am: 89cb8379

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/18617801



Change-Id: Ic800983f1ffd2bb5c7259a09e94db3d1ccf37985
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 9a00e178 89cb8379
Loading
Loading
Loading
Loading
+10 −1
Original line number Original line 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.
// 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.
// NOTE: using int64 rather than google.protobuf.Timestamp for timestamps simplifies implementation.
// Next id: 50
// Next id: 53
message PersistAtoms {
message PersistAtoms {
    /* Aggregated RAT usage during the call. */
    /* Aggregated RAT usage during the call. */
    repeated VoiceCallRatUsage voice_call_rat_usage = 1;
    repeated VoiceCallRatUsage voice_call_rat_usage = 1;
@@ -177,6 +177,9 @@ message PersistAtoms {


    /* Timestamp of last network_requests_v2 pull. */
    /* Timestamp of last network_requests_v2 pull. */
    optional int64 network_requests_v2_pull_timestamp_millis = 51;
    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:
// The canonical versions of the following enums live in:
@@ -498,3 +501,9 @@ message GbaEvent {
    optional int32 failed_reason = 4;
    optional int32 failed_reason = 4;
    optional int32 count = 5;
    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 Original line Diff line number Diff line
@@ -2718,6 +2718,10 @@ public class DataNetwork extends StateMachine {
        if (changed) {
        if (changed) {
            updateNetworkCapabilities();
            updateNetworkCapabilities();
        }
        }
        if (mTempNotMetered && isInternetSupported()) {
            // NR NSA and NR have the same network type: NR
            mDataCallSessionStats.onUnmeteredUpdate(networkType);
        }
    }
    }


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


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


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


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


    @Nullable
    @Nullable
Loading