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

Commit 760664c0 authored by Thomas Nguyen's avatar Thomas Nguyen Committed by Android (Google) Code Review
Browse files

Merge "Support SatelliteSOSMessageRecommender for Starlink" into main

parents b322161f b0201e11
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -677,4 +677,7 @@ message SatelliteSosMessageRecommender {
    optional bool is_ims_registered = 3;
    optional int32 cellular_service_state = 4;
    optional int32 count = 5;
    optional bool is_multi_sim = 6;
    optional int32 recommending_handover_type = 7;
    optional bool is_satellite_allowed_in_current_location = 8;
}
+4 −1
Original line number Diff line number Diff line
@@ -1336,7 +1336,10 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback {
                stats.countOfTimerStarted,
                stats.isImsRegistered,
                stats.cellularServiceState,
                stats.count);
                stats.count,
                stats.isMultiSim,
                stats.recommendingHandoverType,
                stats.isSatelliteAllowedInCurrentLocation);
    }

    /** Returns all phones in {@link PhoneFactory}, or an empty array if phones not made yet. */
+3 −1
Original line number Diff line number Diff line
@@ -2070,7 +2070,9 @@ public class PersistAtomsStorage {
            if (stats.isDisplaySosMessageSent == key.isDisplaySosMessageSent
                    && stats.countOfTimerStarted == key.countOfTimerStarted
                    && stats.isImsRegistered == key.isImsRegistered
                    && stats.cellularServiceState == key.cellularServiceState) {
                    && stats.cellularServiceState == key.cellularServiceState
                    && stats.isMultiSim == key.isMultiSim
                    && stats.recommendingHandoverType == key.recommendingHandoverType) {
                return stats;
            }
        }
+59 −1
Original line number Diff line number Diff line
@@ -732,12 +732,19 @@ public class SatelliteStats {
        private final int mCountOfTimerStarted;
        private final boolean mIsImsRegistered;
        private final int mCellularServiceState;
        private final boolean mIsMultiSim;
        private final int mRecommendingHandoverType;
        private final boolean mIsSatelliteAllowedInCurrentLocation;

        private SatelliteSosMessageRecommenderParams(Builder builder) {
            this.mIsDisplaySosMessageSent = builder.mIsDisplaySosMessageSent;
            this.mCountOfTimerStarted = builder.mCountOfTimerStarted;
            this.mIsImsRegistered = builder.mIsImsRegistered;
            this.mCellularServiceState = builder.mCellularServiceState;
            this.mIsMultiSim = builder.mIsMultiSim;
            this.mRecommendingHandoverType = builder.mRecommendingHandoverType;
            this.mIsSatelliteAllowedInCurrentLocation =
                    builder.mIsSatelliteAllowedInCurrentLocation;
        }

        public boolean isDisplaySosMessageSent() {
@@ -756,6 +763,18 @@ public class SatelliteStats {
            return mCellularServiceState;
        }

        public boolean isMultiSim() {
            return mIsMultiSim;
        }

        public int getRecommendingHandoverType() {
            return mRecommendingHandoverType;
        }

        public boolean isSatelliteAllowedInCurrentLocation() {
            return mIsSatelliteAllowedInCurrentLocation;
        }

        /**
         * A builder class to create {@link SatelliteProvisionParams} data structure class
         */
@@ -764,6 +783,10 @@ public class SatelliteStats {
            private int mCountOfTimerStarted = -1;
            private boolean mIsImsRegistered = false;
            private int mCellularServiceState = -1;
            private boolean mIsMultiSim = false;
            private int mRecommendingHandoverType = -1;
            private boolean mIsSatelliteAllowedInCurrentLocation = false;


            /**
             * Sets resultCode value of {@link SatelliteSosMessageRecommender} atom
@@ -802,6 +825,34 @@ public class SatelliteStats {
                return this;
            }

            /**
             * Sets isMultiSim value of {@link SatelliteSosMessageRecommender} atom
             * then returns Builder class
             */
            public Builder setIsMultiSim(boolean isMultiSim) {
                this.mIsMultiSim = isMultiSim;
                return this;
            }

            /**
             * Sets recommendingHandoverType value of {@link SatelliteSosMessageRecommender} atom
             * then returns Builder class
             */
            public Builder setRecommendingHandoverType(int recommendingHandoverType) {
                this.mRecommendingHandoverType = recommendingHandoverType;
                return this;
            }

            /**
             * Sets isSatelliteAllowedInCurrentLocation value of
             * {@link SatelliteSosMessageRecommender} atom then returns Builder class.
             */
            public Builder setIsSatelliteAllowedInCurrentLocation(
                    boolean satelliteAllowedInCurrentLocation) {
                mIsSatelliteAllowedInCurrentLocation = satelliteAllowedInCurrentLocation;
                return this;
            }

            /**
             * Returns SosMessageRecommenderParams, which contains whole component of
             * {@link SatelliteSosMessageRecommenderParams} atom
@@ -818,7 +869,11 @@ public class SatelliteStats {
                    + "isDisplaySosMessageSent=" + mIsDisplaySosMessageSent
                    + ", countOfTimerStarted=" + mCountOfTimerStarted
                    + ", isImsRegistered=" + mIsImsRegistered
                    + ", cellularServiceState=" + mCellularServiceState + ")";
                    + ", cellularServiceState=" + mCellularServiceState
                    + ", isMultiSim=" + mIsMultiSim
                    + ", recommendingHandoverType=" + mRecommendingHandoverType
                    + ", isSatelliteAllowedInCurrentLocation="
                    + mIsSatelliteAllowedInCurrentLocation + ")";
        }
    }

@@ -899,6 +954,9 @@ public class SatelliteStats {
        proto.countOfTimerStarted = param.getCountOfTimerStarted();
        proto.isImsRegistered = param.isImsRegistered();
        proto.cellularServiceState = param.getCellularServiceState();
        proto.isMultiSim = param.isMultiSim();
        proto.recommendingHandoverType = param.getRecommendingHandoverType();
        proto.isSatelliteAllowedInCurrentLocation = param.isSatelliteAllowedInCurrentLocation();
        proto.count = 1;
        mAtomsStorage.addSatelliteSosMessageRecommenderStats(proto);
    }
+1 −1
Original line number Diff line number Diff line
@@ -496,7 +496,7 @@ public class DatagramReceiver extends Handler {
     */
    @SatelliteManager.SatelliteResult public int registerForSatelliteDatagram(int subId,
            @NonNull ISatelliteDatagramCallback callback) {
        if (!SatelliteController.getInstance().isSatelliteSupported()) {
        if (!SatelliteController.getInstance().isSatelliteSupportedViaOem()) {
            return SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED;
        }

Loading