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

Commit 63563a80 authored by Aishwarya Mallampati's avatar Aishwarya Mallampati
Browse files

Add isNonTerrestrialNetwork apis in NetworkRegistrationInfo for satellite connectivity

Bug: 285189512
Test: Flashed build on raven-userdebug and performed basic functionality
tests,
atest NetworkRegistrationInfoTest,
atest ServiceStateTest

Change-Id: Idc106f26209c805cee898e7358574523617a3365
Merged-In: Idc106f26209c805cee898e7358574523617a3365
parent e3ee3356
Loading
Loading
Loading
Loading
+54 −6
Original line number Original line Diff line number Diff line
@@ -257,6 +257,9 @@ public final class NetworkRegistrationInfo implements Parcelable {
    // Updated based on the accessNetworkTechnology
    // Updated based on the accessNetworkTechnology
    private boolean mIsUsingCarrierAggregation;
    private boolean mIsUsingCarrierAggregation;


    // Set to {@code true} when network is a non-terrestrial network.
    private boolean mIsNonTerrestrialNetwork;

    /**
    /**
     * @param domain Network domain. Must be a {@link Domain}. For transport type
     * @param domain Network domain. Must be a {@link Domain}. For transport type
     * {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}, this must set to {@link #DOMAIN_PS}.
     * {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}, this must set to {@link #DOMAIN_PS}.
@@ -280,6 +283,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
     * @param rplmn the registered plmn or the last plmn for attempted registration if reg failed.
     * @param rplmn the registered plmn or the last plmn for attempted registration if reg failed.
     * @param voiceSpecificInfo Voice specific registration information.
     * @param voiceSpecificInfo Voice specific registration information.
     * @param dataSpecificInfo Data specific registration information.
     * @param dataSpecificInfo Data specific registration information.
     * @param isNonTerrestrialNetwork {@code true} if network is a non-terrestrial network.
     */
     */
    private NetworkRegistrationInfo(@Domain int domain, @TransportType int transportType,
    private NetworkRegistrationInfo(@Domain int domain, @TransportType int transportType,
            @RegistrationState int registrationState,
            @RegistrationState int registrationState,
@@ -287,7 +291,8 @@ public final class NetworkRegistrationInfo implements Parcelable {
            boolean emergencyOnly, @Nullable @ServiceType List<Integer> availableServices,
            boolean emergencyOnly, @Nullable @ServiceType List<Integer> availableServices,
            @Nullable CellIdentity cellIdentity, @Nullable String rplmn,
            @Nullable CellIdentity cellIdentity, @Nullable String rplmn,
            @Nullable VoiceSpecificRegistrationInfo voiceSpecificInfo,
            @Nullable VoiceSpecificRegistrationInfo voiceSpecificInfo,
            @Nullable DataSpecificRegistrationInfo dataSpecificInfo) {
            @Nullable DataSpecificRegistrationInfo dataSpecificInfo,
            boolean isNonTerrestrialNetwork) {
        mDomain = domain;
        mDomain = domain;
        mTransportType = transportType;
        mTransportType = transportType;
        mRegistrationState = registrationState;
        mRegistrationState = registrationState;
@@ -304,6 +309,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
        mRplmn = rplmn;
        mRplmn = rplmn;
        mVoiceSpecificInfo = voiceSpecificInfo;
        mVoiceSpecificInfo = voiceSpecificInfo;
        mDataSpecificInfo = dataSpecificInfo;
        mDataSpecificInfo = dataSpecificInfo;
        mIsNonTerrestrialNetwork = isNonTerrestrialNetwork;


        updateNrState();
        updateNrState();
    }
    }
@@ -322,7 +328,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
        this(domain, transportType, registrationState, accessNetworkTechnology, rejectCause,
        this(domain, transportType, registrationState, accessNetworkTechnology, rejectCause,
                emergencyOnly, availableServices, cellIdentity, rplmn,
                emergencyOnly, availableServices, cellIdentity, rplmn,
                new VoiceSpecificRegistrationInfo(cssSupported, roamingIndicator,
                new VoiceSpecificRegistrationInfo(cssSupported, roamingIndicator,
                        systemIsInPrl, defaultRoamingIndicator), null);
                        systemIsInPrl, defaultRoamingIndicator), null, false);
    }
    }


    /**
    /**
@@ -344,7 +350,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
                        .setNrAvailable(isNrAvailable)
                        .setNrAvailable(isNrAvailable)
                        .setEnDcAvailable(isEndcAvailable)
                        .setEnDcAvailable(isEndcAvailable)
                        .setVopsSupportInfo(vopsSupportInfo)
                        .setVopsSupportInfo(vopsSupportInfo)
                        .build());
                        .build(), false);
    }
    }


    private NetworkRegistrationInfo(Parcel source) {
    private NetworkRegistrationInfo(Parcel source) {
@@ -366,6 +372,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
        mNrState = source.readInt();
        mNrState = source.readInt();
        mRplmn = source.readString();
        mRplmn = source.readString();
        mIsUsingCarrierAggregation = source.readBoolean();
        mIsUsingCarrierAggregation = source.readBoolean();
        mIsNonTerrestrialNetwork = source.readBoolean();
    }
    }


    /**
    /**
@@ -382,6 +389,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
        mRoamingType = nri.mRoamingType;
        mRoamingType = nri.mRoamingType;
        mAccessNetworkTechnology = nri.mAccessNetworkTechnology;
        mAccessNetworkTechnology = nri.mAccessNetworkTechnology;
        mIsUsingCarrierAggregation = nri.mIsUsingCarrierAggregation;
        mIsUsingCarrierAggregation = nri.mIsUsingCarrierAggregation;
        mIsNonTerrestrialNetwork = nri.mIsNonTerrestrialNetwork;
        mRejectCause = nri.mRejectCause;
        mRejectCause = nri.mRejectCause;
        mEmergencyOnly = nri.mEmergencyOnly;
        mEmergencyOnly = nri.mEmergencyOnly;
        mAvailableServices = new ArrayList<>(nri.mAvailableServices);
        mAvailableServices = new ArrayList<>(nri.mAvailableServices);
@@ -657,6 +665,27 @@ public final class NetworkRegistrationInfo implements Parcelable {
        return mIsUsingCarrierAggregation;
        return mIsUsingCarrierAggregation;
    }
    }


    /**
     * Set whether the network is a non-terrestrial network.
     *
     * @param isNonTerrestrialNetwork {@code true} if network is a non-terrestrial network
     *                                            else {@code false}.
     * @hide
     */
    public void setIsNonTerrestrialNetwork(boolean isNonTerrestrialNetwork) {
        mIsNonTerrestrialNetwork = isNonTerrestrialNetwork;
    }

    /**
     * Get whether the network is a non-terrestrial network.
     *
     * @return {@code true} if network is a non-terrestrial network else {@code false}.
     * @hide
     */
    public boolean isNonTerrestrialNetwork() {
        return mIsNonTerrestrialNetwork;
    }

    /**
    /**
     * @hide
     * @hide
     */
     */
@@ -769,6 +798,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
                        ? nrStateToString(mNrState) : "****")
                        ? nrStateToString(mNrState) : "****")
                .append(" rRplmn=").append(mRplmn)
                .append(" rRplmn=").append(mRplmn)
                .append(" isUsingCarrierAggregation=").append(mIsUsingCarrierAggregation)
                .append(" isUsingCarrierAggregation=").append(mIsUsingCarrierAggregation)
                .append(" isNonTerrestrialNetwork=").append(mIsNonTerrestrialNetwork)
                .append("}").toString();
                .append("}").toString();
    }
    }


@@ -777,7 +807,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
        return Objects.hash(mDomain, mTransportType, mRegistrationState, mNetworkRegistrationState,
        return Objects.hash(mDomain, mTransportType, mRegistrationState, mNetworkRegistrationState,
                mRoamingType, mAccessNetworkTechnology, mRejectCause, mEmergencyOnly,
                mRoamingType, mAccessNetworkTechnology, mRejectCause, mEmergencyOnly,
                mAvailableServices, mCellIdentity, mVoiceSpecificInfo, mDataSpecificInfo, mNrState,
                mAvailableServices, mCellIdentity, mVoiceSpecificInfo, mDataSpecificInfo, mNrState,
                mRplmn, mIsUsingCarrierAggregation);
                mRplmn, mIsUsingCarrierAggregation, mIsNonTerrestrialNetwork);
    }
    }


    @Override
    @Override
@@ -803,7 +833,8 @@ public final class NetworkRegistrationInfo implements Parcelable {
                && Objects.equals(mVoiceSpecificInfo, other.mVoiceSpecificInfo)
                && Objects.equals(mVoiceSpecificInfo, other.mVoiceSpecificInfo)
                && Objects.equals(mDataSpecificInfo, other.mDataSpecificInfo)
                && Objects.equals(mDataSpecificInfo, other.mDataSpecificInfo)
                && TextUtils.equals(mRplmn, other.mRplmn)
                && TextUtils.equals(mRplmn, other.mRplmn)
                && mNrState == other.mNrState;
                && mNrState == other.mNrState
                && mIsNonTerrestrialNetwork == other.mIsNonTerrestrialNetwork;
    }
    }


    /**
    /**
@@ -827,6 +858,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
        dest.writeInt(mNrState);
        dest.writeInt(mNrState);
        dest.writeString(mRplmn);
        dest.writeString(mRplmn);
        dest.writeBoolean(mIsUsingCarrierAggregation);
        dest.writeBoolean(mIsUsingCarrierAggregation);
        dest.writeBoolean(mIsNonTerrestrialNetwork);
    }
    }


    /**
    /**
@@ -936,6 +968,8 @@ public final class NetworkRegistrationInfo implements Parcelable {
        @Nullable
        @Nullable
        private VoiceSpecificRegistrationInfo mVoiceSpecificRegistrationInfo;
        private VoiceSpecificRegistrationInfo mVoiceSpecificRegistrationInfo;


        private boolean mIsNonTerrestrialNetwork;

        /**
        /**
         * Default constructor for Builder.
         * Default constructor for Builder.
         */
         */
@@ -964,6 +998,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
                mVoiceSpecificRegistrationInfo = new VoiceSpecificRegistrationInfo(
                mVoiceSpecificRegistrationInfo = new VoiceSpecificRegistrationInfo(
                        nri.mVoiceSpecificInfo);
                        nri.mVoiceSpecificInfo);
            }
            }
            mIsNonTerrestrialNetwork = nri.mIsNonTerrestrialNetwork;
        }
        }


        /**
        /**
@@ -1110,6 +1145,19 @@ public final class NetworkRegistrationInfo implements Parcelable {
            return this;
            return this;
        }
        }


        /**
         * Set whether the network is a non-terrestrial network.
         *
         * @param isNonTerrestrialNetwork {@code true} if network is a non-terrestrial network
         *                                            else {@code false}.
         * @return The builder.
         * @hide
         */
        public @NonNull Builder setIsNonTerrestrialNetwork(boolean isNonTerrestrialNetwork) {
            mIsNonTerrestrialNetwork = isNonTerrestrialNetwork;
            return this;
        }

        /**
        /**
         * Build the NetworkRegistrationInfo.
         * Build the NetworkRegistrationInfo.
         * @return the NetworkRegistrationInfo object.
         * @return the NetworkRegistrationInfo object.
@@ -1120,7 +1168,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
            return new NetworkRegistrationInfo(mDomain, mTransportType, mNetworkRegistrationState,
            return new NetworkRegistrationInfo(mDomain, mTransportType, mNetworkRegistrationState,
                    mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices,
                    mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices,
                    mCellIdentity, mRplmn, mVoiceSpecificRegistrationInfo,
                    mCellIdentity, mRplmn, mVoiceSpecificRegistrationInfo,
                    mDataSpecificRegistrationInfo);
                    mDataSpecificRegistrationInfo, mIsNonTerrestrialNetwork);
        }
        }
    }
    }
}
}
+15 −0
Original line number Original line Diff line number Diff line
@@ -2250,4 +2250,19 @@ public class ServiceState implements Parcelable {
            return false;
            return false;
        }
        }
    }
    }

    /**
     * Get whether device is connected to a non-terrestrial network.
     *
     * @return {@code true} if device is connected to a non-terrestrial network else {@code false}.
     * @hide
     */
    public boolean isUsingNonTerrestrialNetwork() {
        synchronized (mNetworkRegistrationInfos) {
            for (NetworkRegistrationInfo nri : mNetworkRegistrationInfos) {
                if (nri.isNonTerrestrialNetwork()) return true;
            }
        }
        return false;
    }
}
}