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

Commit 0acce5ea authored by Hakjun Choi's avatar Hakjun Choi
Browse files

Add satellite access controller atom into metrics

Bug: 337668745
Test: SatelliteStatsTest PersistAtomsStorageTest
    manually run e2e test which runs satellite service then check the saved atom is reflecting it's behavior

Change-Id: Iabe4b6f93be5c6877d71ad8cfc0d20a47b794223
parent f382aca8
Loading
Loading
Loading
Loading
+22 −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: 80
// Next id: 82
message PersistAtoms {
    /* Aggregated RAT usage during the call. */
    repeated VoiceCallRatUsage voice_call_rat_usage = 1;
@@ -261,6 +261,12 @@ message PersistAtoms {

    /* Timestamp of last satellite_config_updater pull. */
    optional int64 satellite_config_updater_pull_timestamp_millis = 79;

    /** Snapshot of satellite access controller. */
    repeated SatelliteAccessController satellite_access_controller = 80;

    /* Timestamp of last satellite access controller pull. */
    optional int64 satellite_access_controller_pull_timestamp_millis = 81;
}

// The canonical versions of the following enums live in:
@@ -707,6 +713,9 @@ message SatelliteController {
    optional int32 count_of_demo_mode_incoming_datagram_fail = 23;
    optional int32 count_of_datagram_type_keep_alive_success = 24;
    optional int32 count_of_datagram_type_keep_alive_fail = 25;
    optional int32 count_of_allowed_satellite_access = 26;
    optional int32 count_of_disallowed_satellite_access = 27;
    optional int32 count_of_satellite_access_check_fail = 28;
}

message SatelliteSession {
@@ -811,3 +820,15 @@ message SatelliteConfigUpdater {
    optional int32 carrier_config_result = 3;
    optional int32 count = 4;
}

message SatelliteAccessController {
    optional int32 access_control_type = 1;
    optional int64 location_query_time_millis = 2;
    optional int64 on_device_lookup_time_millis = 3;
    optional int64 total_checking_time_millis = 4;
    optional bool is_allowed = 5;
    optional bool is_emergency = 6;
    optional int32 result_code = 7;
    repeated string country_codes = 8;
    optional int32 config_data_source = 9;
}
+36 −1
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import static com.android.internal.telephony.TelephonyStatsLog.PER_SIM_STATUS;
import static com.android.internal.telephony.TelephonyStatsLog.PRESENCE_NOTIFY_EVENT;
import static com.android.internal.telephony.TelephonyStatsLog.RCS_ACS_PROVISIONING_STATS;
import static com.android.internal.telephony.TelephonyStatsLog.RCS_CLIENT_PROVISIONING_STATS;
import static com.android.internal.telephony.TelephonyStatsLog.SATELLITE_ACCESS_CONTROLLER;
import static com.android.internal.telephony.TelephonyStatsLog.SATELLITE_CONFIG_UPDATER;
import static com.android.internal.telephony.TelephonyStatsLog.SATELLITE_CONTROLLER;
import static com.android.internal.telephony.TelephonyStatsLog.SATELLITE_ENTITLEMENT;
@@ -95,6 +96,7 @@ import com.android.internal.telephony.nano.PersistAtomsProto.OutgoingSms;
import com.android.internal.telephony.nano.PersistAtomsProto.PresenceNotifyEvent;
import com.android.internal.telephony.nano.PersistAtomsProto.RcsAcsProvisioningStats;
import com.android.internal.telephony.nano.PersistAtomsProto.RcsClientProvisioningStats;
import com.android.internal.telephony.nano.PersistAtomsProto.SatelliteAccessController;
import com.android.internal.telephony.nano.PersistAtomsProto.SatelliteConfigUpdater;
import com.android.internal.telephony.nano.PersistAtomsProto.SatelliteController;
import com.android.internal.telephony.nano.PersistAtomsProto.SatelliteEntitlement;
@@ -242,6 +244,7 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback {
            registerAtom(CARRIER_ROAMING_SATELLITE_CONTROLLER_STATS);
            registerAtom(SATELLITE_ENTITLEMENT);
            registerAtom(SATELLITE_CONFIG_UPDATER);
            registerAtom(SATELLITE_ACCESS_CONTROLLER);
            Rlog.d(TAG, "registered");
        } else {
            Rlog.e(TAG, "could not get StatsManager, atoms not registered");
@@ -346,6 +349,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback {
                return pullSatelliteEntitlement(data);
            case SATELLITE_CONFIG_UPDATER:
                return pullSatelliteConfigUpdater(data);
            case SATELLITE_ACCESS_CONTROLLER:
                return pullSatelliteAccessController(data);
            default:
                Rlog.e(TAG, String.format("unexpected atom ID %d", atomTag));
                return StatsManager.PULL_SKIP;
@@ -1032,6 +1037,19 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback {
        }
    }

    private int pullSatelliteAccessController(List<StatsEvent> data) {
        SatelliteAccessController[] satelliteAccessControllerAtoms =
                mStorage.getSatelliteAccessControllerStats(MIN_COOLDOWN_MILLIS);
        if (satelliteAccessControllerAtoms != null) {
            Arrays.stream(satelliteAccessControllerAtoms)
                    .forEach(persistAtom -> data.add(buildStatsEvent(persistAtom)));
            return StatsManager.PULL_SUCCESS;
        } else {
            Rlog.w(TAG, "SATELLITE_ACCESS_CONTROLLER pull too frequent, skipping");
            return StatsManager.PULL_SKIP;
        }
    }

    /** Registers a pulled atom ID {@code atomId}. */
    private void registerAtom(int atomId) {
        mStatsManager.setPullAtomCallback(atomId, /* metadata= */ null,
@@ -1452,7 +1470,10 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback {
                satelliteController.countOfDemoModeIncomingDatagramSuccess,
                satelliteController.countOfDemoModeIncomingDatagramFail,
                satelliteController.countOfDatagramTypeKeepAliveSuccess,
                satelliteController.countOfDatagramTypeKeepAliveFail);
                satelliteController.countOfDatagramTypeKeepAliveFail,
                satelliteController.countOfAllowedSatelliteAccess,
                satelliteController.countOfDisallowedSatelliteAccess,
                satelliteController.countOfSatelliteAccessCheckFail);
    }

    private static StatsEvent buildStatsEvent(SatelliteSession satelliteSession) {
@@ -1577,6 +1598,20 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback {
                stats.count);
    }

    private static StatsEvent buildStatsEvent(SatelliteAccessController stats) {
        return TelephonyStatsLog.buildStatsEvent(
                SATELLITE_ACCESS_CONTROLLER,
                stats.accessControlType,
                stats.locationQueryTimeMillis,
                stats.onDeviceLookupTimeMillis,
                stats.totalCheckingTimeMillis,
                stats.isAllowed,
                stats.isEmergency,
                stats.resultCode,
                stats.countryCodes,
                stats.configDataSource);
    }

    /** Returns all phones in {@link PhoneFactory}, or an empty array if phones not made yet. */
    static Phone[] getPhonesIfAny() {
        try {
+38 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import com.android.internal.telephony.nano.PersistAtomsProto.PersistAtoms;
import com.android.internal.telephony.nano.PersistAtomsProto.PresenceNotifyEvent;
import com.android.internal.telephony.nano.PersistAtomsProto.RcsAcsProvisioningStats;
import com.android.internal.telephony.nano.PersistAtomsProto.RcsClientProvisioningStats;
import com.android.internal.telephony.nano.PersistAtomsProto.SatelliteAccessController;
import com.android.internal.telephony.nano.PersistAtomsProto.SatelliteConfigUpdater;
import com.android.internal.telephony.nano.PersistAtomsProto.SatelliteController;
import com.android.internal.telephony.nano.PersistAtomsProto.SatelliteEntitlement;
@@ -766,6 +767,9 @@ public class PersistAtomsStorage {
                += stats.countOfDatagramTypeKeepAliveSuccess;
        atom.countOfDatagramTypeKeepAliveFail
                += stats.countOfDatagramTypeKeepAliveFail;
        atom.countOfAllowedSatelliteAccess += stats.countOfAllowedSatelliteAccess;
        atom.countOfDisallowedSatelliteAccess += stats.countOfDisallowedSatelliteAccess;
        atom.countOfSatelliteAccessCheckFail += stats.countOfSatelliteAccessCheckFail;

        mAtoms.satelliteController = atomArray;
        saveAtomsToFile(SAVE_TO_FILE_DELAY_FOR_UPDATE_MILLIS);
@@ -894,6 +898,14 @@ public class PersistAtomsStorage {
        saveAtomsToFile(SAVE_TO_FILE_DELAY_FOR_UPDATE_MILLIS);
    }

    /** Adds a new {@link SatelliteAccessController} to the storage. */
    public synchronized void addSatelliteAccessControllerStats(SatelliteAccessController stats) {
        mAtoms.satelliteAccessController =
                insertAtRandomPlace(mAtoms.satelliteAccessController, stats,
                        mMaxNumSatelliteStats);
        saveAtomsToFile(SAVE_TO_FILE_DELAY_FOR_UPDATE_MILLIS);
    }

    /**
     * Returns and clears the voice call sessions if last pulled longer than {@code
     * minIntervalMillis} ago, otherwise returns {@code null}.
@@ -1542,7 +1554,7 @@ public class PersistAtomsStorage {
            long minIntervalMillis) {
        if (getWallTimeMillis() - mAtoms.satelliteSosMessageRecommenderPullTimestampMillis
                > minIntervalMillis) {
            mAtoms.satelliteProvisionPullTimestampMillis = getWallTimeMillis();
            mAtoms.satelliteSosMessageRecommenderPullTimestampMillis = getWallTimeMillis();
            SatelliteSosMessageRecommender[] statsArray = mAtoms.satelliteSosMessageRecommender;
            mAtoms.satelliteSosMessageRecommender = new SatelliteSosMessageRecommender[0];
            saveAtomsToFile(SAVE_TO_FILE_DELAY_FOR_GET_MILLIS);
@@ -1648,6 +1660,25 @@ public class PersistAtomsStorage {
        }
    }

    /**
     * Returns and clears the {@link SatelliteAccessController} stats if last pulled longer
     * than {@code minIntervalMillis} ago, otherwise returns {@code null}.
     */
    @Nullable
    public synchronized SatelliteAccessController[] getSatelliteAccessControllerStats(
            long minIntervalMillis) {
        if (getWallTimeMillis() - mAtoms.satelliteAccessControllerPullTimestampMillis
                > minIntervalMillis) {
            mAtoms.satelliteAccessControllerPullTimestampMillis = getWallTimeMillis();
            SatelliteAccessController[] statsArray = mAtoms.satelliteAccessController;
            mAtoms.satelliteAccessController = new SatelliteAccessController[0];
            saveAtomsToFile(SAVE_TO_FILE_DELAY_FOR_GET_MILLIS);
            return statsArray;
        } else {
            return null;
        }
    }

    /** Saves {@link PersistAtoms} to a file in private storage immediately. */
    public synchronized void flushAtoms() {
        saveAtomsToFile(0);
@@ -1814,6 +1845,9 @@ public class PersistAtomsStorage {
                    SatelliteEntitlement.class, mMaxNumSatelliteStats);
            atoms.satelliteConfigUpdater = sanitizeAtoms(atoms.satelliteConfigUpdater,
                    SatelliteConfigUpdater.class, mMaxNumSatelliteStats);
            atoms.satelliteAccessController = sanitizeAtoms(
                    atoms.satelliteAccessController, SatelliteAccessController.class,
                    mMaxNumSatelliteStats);

            // out of caution, sanitize also the timestamps
            atoms.voiceCallRatUsagePullTimestampMillis =
@@ -1886,6 +1920,8 @@ public class PersistAtomsStorage {
                    sanitizeTimestamp(atoms.satelliteEntitlementPullTimestampMillis);
            atoms.satelliteConfigUpdaterPullTimestampMillis =
                    sanitizeTimestamp(atoms.satelliteConfigUpdaterPullTimestampMillis);
            atoms.satelliteAccessControllerPullTimestampMillis =
                    sanitizeTimestamp(atoms.satelliteAccessControllerPullTimestampMillis);
            return atoms;
        } catch (NoSuchFileException e) {
            Rlog.d(TAG, "PersistAtoms file not found");
@@ -2629,6 +2665,7 @@ public class PersistAtomsStorage {
        atoms.carrierRoamingSatelliteControllerStatsPullTimestampMillis = currentTime;
        atoms.satelliteEntitlementPullTimestampMillis = currentTime;
        atoms.satelliteConfigUpdaterPullTimestampMillis = currentTime;
        atoms.satelliteAccessControllerPullTimestampMillis = currentTime;

        Rlog.d(TAG, "created new PersistAtoms");
        return atoms;
+240 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.telephony.satellite.SatelliteManager;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.nano.PersistAtomsProto.CarrierRoamingSatelliteControllerStats;
import com.android.internal.telephony.nano.PersistAtomsProto.CarrierRoamingSatelliteSession;
import com.android.internal.telephony.nano.PersistAtomsProto.SatelliteAccessController;
import com.android.internal.telephony.nano.PersistAtomsProto.SatelliteConfigUpdater;
import com.android.internal.telephony.nano.PersistAtomsProto.SatelliteController;
import com.android.internal.telephony.nano.PersistAtomsProto.SatelliteEntitlement;
@@ -35,6 +36,8 @@ import com.android.internal.telephony.nano.PersistAtomsProto.SatelliteSosMessage
import com.android.internal.telephony.satellite.SatelliteConstants;
import com.android.telephony.Rlog;

import java.util.Arrays;

/** Tracks Satellite metrics for each phone */
public class SatelliteStats {
    private static final String TAG = SatelliteStats.class.getSimpleName();
@@ -85,6 +88,9 @@ public class SatelliteStats {
        private final int mCountOfDemoModeIncomingDatagramFail;
        private final int mCountOfDatagramTypeKeepAliveSuccess;
        private final int mCountOfDatagramTypeKeepAliveFail;
        private final int mCountOfAllowedSatelliteAccess;
        private final int mCountOfDisallowedSatelliteAccess;
        private final int mCountOfSatelliteAccessCheckFail;

        private SatelliteControllerParams(Builder builder) {
            this.mCountOfSatelliteServiceEnablementsSuccess =
@@ -124,6 +130,12 @@ public class SatelliteStats {
                    builder.mCountOfDatagramTypeKeepAliveSuccess;
            this.mCountOfDatagramTypeKeepAliveFail =
                    builder.mCountOfDatagramTypeKeepAliveFail;
            this.mCountOfAllowedSatelliteAccess =
                    builder.mCountOfAllowedSatelliteAccess;
            this.mCountOfDisallowedSatelliteAccess =
                    builder.mCountOfDisallowedSatelliteAccess;
            this.mCountOfSatelliteAccessCheckFail =
                    builder.mCountOfSatelliteAccessCheckFail;
        }

        public int getCountOfSatelliteServiceEnablementsSuccess() {
@@ -226,6 +238,18 @@ public class SatelliteStats {
            return mCountOfDatagramTypeKeepAliveFail;
        }

        public int getCountOfAllowedSatelliteAccess() {
            return mCountOfAllowedSatelliteAccess;
        }

        public int getCountOfDisallowedSatelliteAccess() {
            return mCountOfDisallowedSatelliteAccess;
        }

        public int getCountOfSatelliteAccessCheckFail() {
            return mCountOfSatelliteAccessCheckFail;
        }

        /**
         * A builder class to create {@link SatelliteControllerParams} data structure class
         */
@@ -255,6 +279,9 @@ public class SatelliteStats {
            private int mCountOfDemoModeIncomingDatagramFail = 0;
            private int mCountOfDatagramTypeKeepAliveSuccess = 0;
            private int mCountOfDatagramTypeKeepAliveFail = 0;
            private int mCountOfAllowedSatelliteAccess = 0;
            private int mCountOfDisallowedSatelliteAccess = 0;
            private int mCountOfSatelliteAccessCheckFail = 0;

            /**
             * Sets countOfSatelliteServiceEnablementsSuccess value of {@link SatelliteController}
@@ -502,6 +529,37 @@ public class SatelliteStats {
                return this;
            }

            /**
             * Sets countOfAllowedSatelliteAccess value of {@link SatelliteController} atom
             * then returns Builder class
             */
            public Builder setCountOfAllowedSatelliteAccess(
                    int countOfAllowedSatelliteAccess) {
                this.mCountOfAllowedSatelliteAccess =
                        countOfAllowedSatelliteAccess;
                return this;
            }

            /**
             * Sets countOfDisallowedSatelliteAccess value of {@link SatelliteController} atom
             * then returns Builder class
             */
            public Builder setCountOfDisallowedSatelliteAccess(
                    int countOfDisallowedSatelliteAccess) {
                this.mCountOfDisallowedSatelliteAccess = countOfDisallowedSatelliteAccess;
                return this;
            }

            /**
             * Sets countOfSatelliteAccessCheckFail value of {@link SatelliteController} atom
             * then returns Builder class
             */
            public Builder setCountOfSatelliteAccessCheckFail(
                    int countOfSatelliteAccessCheckFail) {
                this.mCountOfSatelliteAccessCheckFail = countOfSatelliteAccessCheckFail;
                return this;
            }

            /**
             * Returns ControllerParams, which contains whole component of
             * {@link SatelliteController} atom
@@ -548,6 +606,9 @@ public class SatelliteStats {
                    + mCountOfDatagramTypeKeepAliveSuccess
                    + ", countOfDatagramTypeKeepAliveFail="
                    + mCountOfDatagramTypeKeepAliveFail
                    + ", countOfAllowedSatelliteAccess=" + mCountOfAllowedSatelliteAccess
                    + ", countOfDisallowedSatelliteAccess=" + mCountOfDisallowedSatelliteAccess
                    + ", countOfSatelliteAccessCheckFail=" + mCountOfSatelliteAccessCheckFail
                    + ")";
        }
    }
@@ -1915,6 +1976,169 @@ public class SatelliteStats {
        }
    }

    /**
     * A data class to contain whole component of {@link SatelliteAccessControllerParams} atom.
     * Refer to {@link #onSatelliteAccessControllerMetrics(SatelliteAccessControllerParams)}.
     */
    public class SatelliteAccessControllerParams {
        private final @SatelliteConstants.AccessControlType int mAccessControlType;
        private final long mLocationQueryTimeMillis;
        private final long mOnDeviceLookupTimeMillis;
        private final long mTotalCheckingTimeMillis;
        private final boolean mIsAllowed;
        private final boolean mIsEmergency;
        private final @SatelliteManager.SatelliteResult int mResultCode;
        private final String[] mCountryCodes;
        private final @SatelliteConstants.ConfigDataSource int mConfigDataSource;

        private SatelliteAccessControllerParams(Builder builder) {
            this.mAccessControlType = builder.mAccessControlType;
            this.mLocationQueryTimeMillis = builder.mLocationQueryTimeMillis;
            this.mOnDeviceLookupTimeMillis = builder.mOnDeviceLookupTimeMillis;
            this.mTotalCheckingTimeMillis = builder.mTotalCheckingTimeMillis;
            this.mIsAllowed = builder.mIsAllowed;
            this.mIsEmergency = builder.mIsEmergency;
            this.mResultCode = builder.mResultCode;
            this.mCountryCodes = builder.mCountryCodes;
            this.mConfigDataSource = builder.mConfigDataSource;
        }

        public @SatelliteConstants.AccessControlType int getAccessControlType() {
            return mAccessControlType;
        }

        public long getLocationQueryTime() {
            return mLocationQueryTimeMillis;
        }

        public long getOnDeviceLookupTime() {
            return mOnDeviceLookupTimeMillis;
        }

        public long getTotalCheckingTime() {
            return mTotalCheckingTimeMillis;
        }

        public boolean getIsAllowed() {
            return mIsAllowed;
        }

        public boolean getIsEmergency() {
            return mIsEmergency;
        }

        public @SatelliteManager.SatelliteResult int getResultCode() {
            return mResultCode;
        }

        public String[] getCountryCodes() {
            return mCountryCodes;
        }

        public @SatelliteConstants.ConfigDataSource int getConfigDataSource() {
            return mConfigDataSource;
        }

        /**
         * A builder class to create {@link SatelliteAccessControllerParams} data structure class
         */
        public static class Builder {
            private @SatelliteConstants.AccessControlType int mAccessControlType;
            private long mLocationQueryTimeMillis;
            private long mOnDeviceLookupTimeMillis;
            private long mTotalCheckingTimeMillis;
            private boolean mIsAllowed;
            private boolean mIsEmergency;
            private @SatelliteManager.SatelliteResult int mResultCode;
            private String[] mCountryCodes;
            private @SatelliteConstants.ConfigDataSource int mConfigDataSource;

            /**
             * Sets AccessControlType value of {@link #SatelliteAccessController}
             * atom then returns Builder class
             */
            public Builder setAccessControlType(
                    @SatelliteConstants.AccessControlType int accessControlType) {
                this.mAccessControlType = accessControlType;
                return this;
            }

            /** Sets the location query time for current satellite enablement. */
            public Builder setLocationQueryTime(long locationQueryTimeMillis) {
                this.mLocationQueryTimeMillis = locationQueryTimeMillis;
                return this;
            }

            /** Sets the on device lookup time for current satellite enablement. */
            public Builder setOnDeviceLookupTime(long onDeviceLookupTimeMillis) {
                this.mOnDeviceLookupTimeMillis = onDeviceLookupTimeMillis;
                return this;
            }

            /** Sets the total checking time for current satellite enablement. */
            public Builder setTotalCheckingTime(long totalCheckingTimeMillis) {
                this.mTotalCheckingTimeMillis = totalCheckingTimeMillis;
                return this;
            }

            /** Sets whether the satellite communication is allowed from current location. */
            public Builder setIsAllowed(boolean isAllowed) {
                this.mIsAllowed = isAllowed;
                return this;
            }

            /** Sets whether the current satellite enablement is for emergency or not. */
            public Builder setIsEmergency(boolean isEmergency) {
                this.mIsEmergency = isEmergency;
                return this;
            }

            /** Sets the result code for checking whether satellite service is allowed from current
             location. */
            public Builder setResult(int result) {
                this.mResultCode = result;
                return this;
            }

            /** Sets the country code for current location while attempting satellite enablement. */
            public Builder setCountryCodes(String[] countryCodes) {
                this.mCountryCodes = Arrays.stream(countryCodes).toArray(String[]::new);
                return this;
            }

            /** Sets the config data source for checking whether satellite service is allowed from
             current location. */
            public Builder setConfigDatasource(int configDatasource) {
                this.mConfigDataSource = configDatasource;
                return this;
            }

            /**
             * Returns AccessControllerParams, which contains whole component of
             * {@link #SatelliteAccessController} atom
             */
            public SatelliteAccessControllerParams build() {
                return new SatelliteStats()
                        .new SatelliteAccessControllerParams(this);
            }
        }

        @Override
        public String toString() {
            return "AccessControllerParams("
                    + ", AccessControlType=" + mAccessControlType
                    + ", LocationQueryTime=" + mLocationQueryTimeMillis
                    + ", OnDeviceLookupTime=" + mOnDeviceLookupTimeMillis
                    + ", TotalCheckingTime=" + mTotalCheckingTimeMillis
                    + ", IsAllowed=" + mIsAllowed
                    + ", IsEmergency=" + mIsEmergency
                    + ", ResultCode=" + mResultCode
                    + ", CountryCodes=" + Arrays.toString(mCountryCodes)
                    + ", ConfigDataSource=" + mConfigDataSource
                    + ")";
        }
    }

    /**  Create a new atom or update an existing atom for SatelliteController metrics */
    public synchronized void onSatelliteControllerMetrics(SatelliteControllerParams param) {
        SatelliteController proto = new SatelliteController();
@@ -2079,4 +2303,20 @@ public class SatelliteStats {
        proto.count = param.getCount();
        mAtomsStorage.addSatelliteConfigUpdaterStats(proto);
    }

    /**  Create a new atom or update an existing atom for SatelliteAccessController metrics */
    public synchronized void onSatelliteAccessControllerMetrics(
            SatelliteAccessControllerParams param) {
        SatelliteAccessController proto = new SatelliteAccessController();
        proto.accessControlType = param.getAccessControlType();
        proto.locationQueryTimeMillis = param.getLocationQueryTime();
        proto.onDeviceLookupTimeMillis = param.getOnDeviceLookupTime();
        proto.totalCheckingTimeMillis = param.getTotalCheckingTime();
        proto.isAllowed = param.getIsAllowed();
        proto.isEmergency = param.getIsEmergency();
        proto.resultCode = param.getResultCode();
        proto.countryCodes = param.getCountryCodes();
        proto.configDataSource = param.getConfigDataSource();
        mAtomsStorage.addSatelliteAccessControllerStats(proto);
    }
}
+21 −0
Original line number Diff line number Diff line
@@ -83,4 +83,25 @@ public class SatelliteConstants {
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface ConfigUpdateResult {}

    // Access control type is unknown
    public static final int ACCESS_CONTROL_TYPE_UNKNOWN = 0;
    // Network country code is used for satellite access decision
    public static final int ACCESS_CONTROL_TYPE_NETWORK_COUNTRY_CODE = 1;
    // Device's current location is used for satellite access decision
    public static final int ACCESS_CONTROL_TYPE_CURRENT_LOCATION = 2;
    // Device's last known location is used for satellite access decision
    public static final int ACCESS_CONTROL_TYPE_LAST_KNOWN_LOCATION = 3;
    // Cached country codes are used for satellite access decision
    public static final int ACCESS_CONTROL_TYPE_CACHED_COUNTRY_CODE = 4;

    @IntDef(prefix = {"ACCESS_CONTROL_TYPE_"}, value = {
            ACCESS_CONTROL_TYPE_UNKNOWN,
            ACCESS_CONTROL_TYPE_NETWORK_COUNTRY_CODE,
            ACCESS_CONTROL_TYPE_CURRENT_LOCATION,
            ACCESS_CONTROL_TYPE_LAST_KNOWN_LOCATION,
            ACCESS_CONTROL_TYPE_CACHED_COUNTRY_CODE
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface AccessControlType {}
}
Loading