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

Commit a3a4f0e8 authored by Hakjun Choi's avatar Hakjun Choi
Browse files

Introduce multiple satellite controller atom per carrier id

Satellite controller atom is designed to report sum of events per day, therefore it reports only one atom per day.
However it is needed to report multiple atoms per carrier id because VZW and Skylo service can be activated both in a day, thus introduce multiple atom report

Bug: 381488202
Flag: com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn
Test: atest PersistAtomsStorageTest SatelliteStatsTest
Change-Id: I73464e1ee485edd685d087d465b3f09b63cfedd1
parent 4557d64b
Loading
Loading
Loading
Loading
+84 −73
Original line number Diff line number Diff line
@@ -177,7 +177,6 @@ public class PersistAtomsStorage {

    /** Maximum number of Satellite relevant stats to store between pulls. */
    private final int mMaxNumSatelliteStats;
    private final int mMaxNumSatelliteControllerStats = 1;
    private final int mMaxNumCarrierRoamingSatelliteSessionStats = 1;

    /** Maximum number of data network validation to store during pulls. */
@@ -710,76 +709,75 @@ public class PersistAtomsStorage {

    /** Adds a new {@link SatelliteController} to the storage. */
    public synchronized void addSatelliteControllerStats(SatelliteController stats) {
        // SatelliteController is a single data point
        SatelliteController[] atomArray = mAtoms.satelliteController;
        if (atomArray == null || atomArray.length == 0) {
            atomArray = new SatelliteController[] {new SatelliteController()};
        }

        SatelliteController atom = atomArray[0];
        atom.countOfSatelliteServiceEnablementsSuccess
        // find existing satellite controller atom with same carrier ID.
        SatelliteController existingStats = find(stats);
        if (existingStats != null) {
            existingStats.countOfSatelliteServiceEnablementsSuccess
                    += stats.countOfSatelliteServiceEnablementsSuccess;
        atom.countOfSatelliteServiceEnablementsFail
            existingStats.countOfSatelliteServiceEnablementsFail
                    += stats.countOfSatelliteServiceEnablementsFail;
        atom.countOfOutgoingDatagramSuccess
            existingStats.countOfOutgoingDatagramSuccess
                    += stats.countOfOutgoingDatagramSuccess;
        atom.countOfOutgoingDatagramFail
            existingStats.countOfOutgoingDatagramFail
                    += stats.countOfOutgoingDatagramFail;
        atom.countOfIncomingDatagramSuccess
            existingStats.countOfIncomingDatagramSuccess
                    += stats.countOfIncomingDatagramSuccess;
        atom.countOfIncomingDatagramFail
            existingStats.countOfIncomingDatagramFail
                    += stats.countOfIncomingDatagramFail;
        atom.countOfDatagramTypeSosSmsSuccess
            existingStats.countOfDatagramTypeSosSmsSuccess
                    += stats.countOfDatagramTypeSosSmsSuccess;
        atom.countOfDatagramTypeSosSmsFail
            existingStats.countOfDatagramTypeSosSmsFail
                    += stats.countOfDatagramTypeSosSmsFail;
        atom.countOfDatagramTypeLocationSharingSuccess
            existingStats.countOfDatagramTypeLocationSharingSuccess
                    += stats.countOfDatagramTypeLocationSharingSuccess;
        atom.countOfDatagramTypeLocationSharingFail
            existingStats.countOfDatagramTypeLocationSharingFail
                    += stats.countOfDatagramTypeLocationSharingFail;
        atom.countOfProvisionSuccess
            existingStats.countOfProvisionSuccess
                    += stats.countOfProvisionSuccess;
        atom.countOfProvisionFail
            existingStats.countOfProvisionFail
                    += stats.countOfProvisionFail;
        atom.countOfDeprovisionSuccess
            existingStats.countOfDeprovisionSuccess
                    += stats.countOfDeprovisionSuccess;
        atom.countOfDeprovisionFail
            existingStats.countOfDeprovisionFail
                    += stats.countOfDeprovisionFail;
        atom.totalServiceUptimeSec
            existingStats.totalServiceUptimeSec
                    += stats.totalServiceUptimeSec;
        atom.totalBatteryConsumptionPercent
            existingStats.totalBatteryConsumptionPercent
                    += stats.totalBatteryConsumptionPercent;
        atom.totalBatteryChargedTimeSec
            existingStats.totalBatteryChargedTimeSec
                    += stats.totalBatteryChargedTimeSec;
        atom.countOfDemoModeSatelliteServiceEnablementsSuccess
            existingStats.countOfDemoModeSatelliteServiceEnablementsSuccess
                    += stats.countOfDemoModeSatelliteServiceEnablementsSuccess;
        atom.countOfDemoModeSatelliteServiceEnablementsFail
            existingStats.countOfDemoModeSatelliteServiceEnablementsFail
                    += stats.countOfDemoModeSatelliteServiceEnablementsFail;
        atom.countOfDemoModeOutgoingDatagramSuccess
            existingStats.countOfDemoModeOutgoingDatagramSuccess
                    += stats.countOfDemoModeOutgoingDatagramSuccess;
        atom.countOfDemoModeOutgoingDatagramFail
            existingStats.countOfDemoModeOutgoingDatagramFail
                    += stats.countOfDemoModeOutgoingDatagramFail;
        atom.countOfDemoModeIncomingDatagramSuccess
            existingStats.countOfDemoModeIncomingDatagramSuccess
                    += stats.countOfDemoModeIncomingDatagramSuccess;
        atom.countOfDemoModeIncomingDatagramFail
            existingStats.countOfDemoModeIncomingDatagramFail
                    += stats.countOfDemoModeIncomingDatagramFail;
        atom.countOfDatagramTypeKeepAliveSuccess
            existingStats.countOfDatagramTypeKeepAliveSuccess
                    += stats.countOfDatagramTypeKeepAliveSuccess;
        atom.countOfDatagramTypeKeepAliveFail
            existingStats.countOfDatagramTypeKeepAliveFail
                    += stats.countOfDatagramTypeKeepAliveFail;
        atom.countOfAllowedSatelliteAccess += stats.countOfAllowedSatelliteAccess;
        atom.countOfDisallowedSatelliteAccess += stats.countOfDisallowedSatelliteAccess;
        atom.countOfSatelliteAccessCheckFail += stats.countOfSatelliteAccessCheckFail;
            existingStats.countOfAllowedSatelliteAccess += stats.countOfAllowedSatelliteAccess;
            existingStats.countOfDisallowedSatelliteAccess
                    += stats.countOfDisallowedSatelliteAccess;
            existingStats.countOfSatelliteAccessCheckFail += stats.countOfSatelliteAccessCheckFail;

        atom.isProvisioned = stats.isProvisioned;
        atom.carrierId = stats.carrierId;
            existingStats.isProvisioned = stats.isProvisioned;

        atom.countOfSatelliteAllowedStateChangedEvents
            existingStats.countOfSatelliteAllowedStateChangedEvents
                    += stats.countOfSatelliteAllowedStateChangedEvents;
        atom.countOfSuccessfulLocationQueries += stats.countOfSuccessfulLocationQueries;
        atom.countOfFailedLocationQueries += stats.countOfFailedLocationQueries;

        mAtoms.satelliteController = atomArray;
            existingStats.countOfSuccessfulLocationQueries +=
                    stats.countOfSuccessfulLocationQueries;
            existingStats.countOfFailedLocationQueries += stats.countOfFailedLocationQueries;
        } else {
            mAtoms.satelliteController = insertAtRandomPlace(mAtoms.satelliteController, stats,
                    mMaxNumSatelliteStats);
        }
        saveAtomsToFile(SAVE_TO_FILE_DELAY_FOR_UPDATE_MILLIS);
    }

@@ -1825,7 +1823,7 @@ public class PersistAtomsStorage {
            atoms.outgoingShortCodeSms = sanitizeAtoms(atoms.outgoingShortCodeSms,
                    OutgoingShortCodeSms.class, mMaxOutgoingShortCodeSms);
            atoms.satelliteController = sanitizeAtoms(atoms.satelliteController,
                            SatelliteController.class, mMaxNumSatelliteControllerStats);
                            SatelliteController.class, mMaxNumSatelliteStats);
            atoms.satelliteSession = sanitizeAtoms(atoms.satelliteSession,
                    SatelliteSession.class, mMaxNumSatelliteStats);
            atoms.satelliteIncomingDatagram = sanitizeAtoms(atoms.satelliteIncomingDatagram,
@@ -1848,7 +1846,7 @@ public class PersistAtomsStorage {
                    mMaxNumSatelliteStats);
            atoms.carrierRoamingSatelliteControllerStats = sanitizeAtoms(
                    atoms.carrierRoamingSatelliteControllerStats,
                    CarrierRoamingSatelliteControllerStats.class, mMaxNumSatelliteControllerStats);
                    CarrierRoamingSatelliteControllerStats.class, mMaxNumSatelliteStats);
            atoms.satelliteEntitlement = sanitizeAtoms(atoms.satelliteEntitlement,
                    SatelliteEntitlement.class, mMaxNumSatelliteStats);
            atoms.satelliteConfigUpdater = sanitizeAtoms(atoms.satelliteConfigUpdater,
@@ -2389,6 +2387,19 @@ public class PersistAtomsStorage {
        return null;
    }

    /**
     * Returns SatelliteController atom that has same carrier_id value or
     * {@code null} if does not exist.
     */
    private @Nullable SatelliteController find(SatelliteController key) {
        for (SatelliteController stats : mAtoms.satelliteController) {
            if (stats.carrierId == key.carrierId) {
                return stats;
            }
        }
        return null;
    }

    /**
     * Returns CarrierRoamingSatelliteControllerStats atom that has same carrier_id value or
     * {@code null} if does not exist.
+120 −108

File changed.

Preview size limit exceeded, changes collapsed.