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

Commit bf9b2877 authored by youngtaecha's avatar youngtaecha
Browse files

Support satellite config version for metrics

Bug: 395546769
Flag: EXEMPT (version_of_satellite_access_config)
Test: Build
Test: Manually verified if the version is updated well after manually updating the satellite access config(b/395546769#comment2)

Change-Id: I8a614e762391a4c851214b36dfb8bfa17dd7c4db
parent f4f49361
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -727,6 +727,7 @@ message SatelliteController {
    optional int32 count_of_p2p_sms_available_notification_shown = 34;
    optional int32 count_of_p2p_sms_available_notification_removed = 35;
    optional bool is_ntn_only_carrier = 36;
    optional int32 version_of_satellite_access_config = 37;
}

message SatelliteSession {
+2 −1
Original line number Diff line number Diff line
@@ -1484,7 +1484,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback {
                satelliteController.countOfFailedLocationQueries,
                satelliteController.countOfP2PSmsAvailableNotificationShown,
                satelliteController.countOfP2PSmsAvailableNotificationRemoved,
                satelliteController.isNtnOnlyCarrier);
                satelliteController.isNtnOnlyCarrier,
                satelliteController.versionOfSatelliteAccessConfig);
    }

    private static StatsEvent buildStatsEvent(SatelliteSession satelliteSession) {
+1 −0
Original line number Diff line number Diff line
@@ -785,6 +785,7 @@ public class PersistAtomsStorage {
            existingStats.countOfP2PSmsAvailableNotificationRemoved
                    += stats.countOfP2PSmsAvailableNotificationRemoved;
            // Does not update isNtnOnlyCarrier due to it is a dimension field.
            existingStats.versionOfSatelliteAccessConfig = stats.versionOfSatelliteAccessConfig;
        } else {
            mAtoms.satelliteController = insertAtRandomPlace(mAtoms.satelliteController, stats,
                    mMaxNumSatelliteStats);
+23 −2
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ public class SatelliteStats {
        private final int mCountOfP2PSmsAvailableNotificationShown;
        private final int mCountOfP2PSmsAvailableNotificationRemoved;
        private static boolean sIsNtnOnlyCarrier;
        private static int sVersionOfSatelliteAccessConfig;

        private SatelliteControllerParams(Builder builder) {
            this.mCountOfSatelliteServiceEnablementsSuccess =
@@ -170,10 +171,15 @@ public class SatelliteStats {
            this.mCountOfP2PSmsAvailableNotificationRemoved =
                    builder.mCountOfP2PSmsAvailableNotificationRemoved;

            // Carrier ID value should be updated only when it is meaningful.
            // Ntn only carrier value should be updated only when it is meaningful.
            if (builder.mIsNtnOnlyCarrier.isPresent()) {
                this.sIsNtnOnlyCarrier = builder.mIsNtnOnlyCarrier.get();
            }
            // version satellite access config value should be updated only when it is meaningful.
            if (builder.mVersionOfSatelliteAccessConfig.isPresent()) {
                this.sVersionOfSatelliteAccessConfig =
                        builder.mVersionOfSatelliteAccessConfig.get();
            }
        }

        public int getCountOfSatelliteServiceEnablementsSuccess() {
@@ -320,6 +326,10 @@ public class SatelliteStats {
            return sIsNtnOnlyCarrier;
        }

        public static int getVersionSatelliteAccessConfig() {
            return sVersionOfSatelliteAccessConfig;
        }

        /**
         * A builder class to create {@link SatelliteControllerParams} data structure class
         */
@@ -360,6 +370,7 @@ public class SatelliteStats {
            private int mCountOfP2PSmsAvailableNotificationShown = 0;
            private int mCountOfP2PSmsAvailableNotificationRemoved = 0;
            private Optional<Boolean> mIsNtnOnlyCarrier = Optional.empty();
            private Optional<Integer> mVersionOfSatelliteAccessConfig = Optional.empty();

            /**
             * Sets countOfSatelliteServiceEnablementsSuccess value of {@link SatelliteController}
@@ -718,6 +729,15 @@ public class SatelliteStats {
                return this;
            }

            /**
             * Sets versionOfSatelliteAccessConfig value of {@link SatelliteController} atom
             * then returns Builder class
             */
            public Builder setVersionOfSatelliteAccessControl(int version) {
                this.mVersionOfSatelliteAccessConfig = Optional.of(version);
                return this;
            }

            /**
             * Returns ControllerParams, which contains whole component of
             * {@link SatelliteController} atom
@@ -777,7 +797,7 @@ public class SatelliteStats {
                    + mCountOfP2PSmsAvailableNotificationShown
                    + ", countOfP2PSmsAvailableNotificationRemoved="
                    + mCountOfP2PSmsAvailableNotificationRemoved
                    + ", isNtnOnlyCarrier=" + sIsNtnOnlyCarrier
                    + ", versionOfSatelliteAccessConfig=" + sVersionOfSatelliteAccessConfig
                    + ")";
        }
    }
@@ -2701,6 +2721,7 @@ public class SatelliteStats {
        proto.countOfP2PSmsAvailableNotificationRemoved =
                param.getCountOfP2PSmsAvailableNotificationRemoved();
        proto.isNtnOnlyCarrier = param.isNtnOnlyCarrier();
        proto.versionOfSatelliteAccessConfig = param.getVersionSatelliteAccessConfig();

        mAtomsStorage.addSatelliteControllerStats(proto);
    }
+11 −0
Original line number Diff line number Diff line
@@ -414,6 +414,17 @@ public class ControllerMetricsStats {
        mSatelliteStats.onSatelliteControllerMetrics(controllerParam);
    }

    /**
     * Report a current version of satellite access config.
     */
    public void reportCurrentVersionOfSatelliteAccessConfig(int version) {
        logd("reportCurrentVersionOfSatelliteAccessConfig:" + version);
        mSatelliteStats.onSatelliteControllerMetrics(
                new SatelliteStats.SatelliteControllerParams.Builder()
                        .setVersionOfSatelliteAccessControl(version)
                        .build());
    }

    /**
     * Add count when the notification for P2P SMS over satellite avaibility is shown or removed.
     */