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

Commit 6730f345 authored by Chen Xu's avatar Chen Xu Committed by Gerrit Code Review
Browse files

Merge "NWRegState.getAccessNetworkTechnology in sync with SS.getNetworkType"

parents e09f7b5e f513b528
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
@@ -102,7 +102,7 @@ public class NetworkRegistrationState implements Parcelable {
    @ServiceState.RoamingType
    @ServiceState.RoamingType
    private int mRoamingType;
    private int mRoamingType;


    private final int mAccessNetworkTechnology;
    private int mAccessNetworkTechnology;


    private final int mRejectCause;
    private final int mRejectCause;


@@ -256,12 +256,20 @@ public class NetworkRegistrationState implements Parcelable {
    public int[] getAvailableServices() { return mAvailableServices; }
    public int[] getAvailableServices() { return mAvailableServices; }


    /**
    /**
     * @return The access network technology. Must be one of TelephonyManager.NETWORK_TYPE_XXXX.
     * @return The access network technology {@link TelephonyManager.NetworkType}.
     */
     */
    public int getAccessNetworkTechnology() {
    public @TelephonyManager.NetworkType int getAccessNetworkTechnology() {
        return mAccessNetworkTechnology;
        return mAccessNetworkTechnology;
    }
    }


    /**
     * override the access network technology {@link TelephonyManager.NetworkType} e.g, rat ratchet.
     * @hide
     */
    public void setAccessNetworkTechnology(@TelephonyManager.NetworkType int tech) {
        mAccessNetworkTechnology = tech;
    }

    /**
    /**
     * @return Network reject cause
     * @return Network reject cause
     */
     */
+56 −9
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.annotation.UnsupportedAppUsage;
import android.content.Intent;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;
@@ -250,8 +251,17 @@ public class ServiceState implements Parcelable {
    private boolean mIsManualNetworkSelection;
    private boolean mIsManualNetworkSelection;


    private boolean mIsEmergencyOnly;
    private boolean mIsEmergencyOnly;

    /**
     * TODO: remove mRilVoiceRadioTechnology after completely migrate to
     * {@link TelephonyManager.NetworkType}
     */
    @RilRadioTechnology
    private int mRilVoiceRadioTechnology;
    private int mRilVoiceRadioTechnology;
    /**
     * TODO: remove mRilDataRadioTechnology after completely migrate to
     * {@link TelephonyManager.NetworkType}
     */
    @RilRadioTechnology
    private int mRilDataRadioTechnology;
    private int mRilDataRadioTechnology;


    @UnsupportedAppUsage
    @UnsupportedAppUsage
@@ -1218,17 +1228,30 @@ public class ServiceState implements Parcelable {


    /** @hide */
    /** @hide */
    @TestApi
    @TestApi
    public void setRilVoiceRadioTechnology(int rt) {
    public void setRilVoiceRadioTechnology(@RilRadioTechnology int rt) {
        if (rt == RIL_RADIO_TECHNOLOGY_LTE_CA) {
        if (rt == RIL_RADIO_TECHNOLOGY_LTE_CA) {
            rt = RIL_RADIO_TECHNOLOGY_LTE;
            rt = RIL_RADIO_TECHNOLOGY_LTE;
        }
        }


        this.mRilVoiceRadioTechnology = rt;
        this.mRilVoiceRadioTechnology = rt;

        // sync to network registration state
        NetworkRegistrationState regState = getNetworkRegistrationState(
                NetworkRegistrationState.DOMAIN_CS, AccessNetworkConstants.TransportType.WWAN);
        if (regState == null) {
            regState = new NetworkRegistrationState(
                    NetworkRegistrationState.DOMAIN_CS, AccessNetworkConstants.TransportType.WWAN,
                    ServiceState.ROAMING_TYPE_NOT_ROAMING, TelephonyManager.NETWORK_TYPE_UNKNOWN,
                    0, false, null, null);
            addNetworkRegistrationState(regState);
        }
        regState.setAccessNetworkTechnology(
                rilRadioTechnologyToNetworkType(mRilVoiceRadioTechnology));
    }
    }


    /** @hide */
    /** @hide */
    @TestApi
    @TestApi
    public void setRilDataRadioTechnology(int rt) {
    public void setRilDataRadioTechnology(@RilRadioTechnology int rt) {
        if (rt == RIL_RADIO_TECHNOLOGY_LTE_CA) {
        if (rt == RIL_RADIO_TECHNOLOGY_LTE_CA) {
            rt = RIL_RADIO_TECHNOLOGY_LTE;
            rt = RIL_RADIO_TECHNOLOGY_LTE;
            this.mIsUsingCarrierAggregation = true;
            this.mIsUsingCarrierAggregation = true;
@@ -1238,6 +1261,20 @@ public class ServiceState implements Parcelable {
        this.mRilDataRadioTechnology = rt;
        this.mRilDataRadioTechnology = rt;
        if (VDBG) Rlog.d(LOG_TAG, "[ServiceState] setRilDataRadioTechnology=" +
        if (VDBG) Rlog.d(LOG_TAG, "[ServiceState] setRilDataRadioTechnology=" +
                mRilDataRadioTechnology);
                mRilDataRadioTechnology);

        // sync to network registration state
        NetworkRegistrationState regState = getNetworkRegistrationState(
                NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TransportType.WWAN);

        if (regState == null) {
            regState = new NetworkRegistrationState(
                    NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TransportType.WWAN,
                    ServiceState.ROAMING_TYPE_NOT_ROAMING, TelephonyManager.NETWORK_TYPE_UNKNOWN,
                    0, false, null, null);
            addNetworkRegistrationState(regState);
        }
        regState.setAccessNetworkTechnology(
                rilRadioTechnologyToNetworkType(mRilDataRadioTechnology));
    }
    }


    /** @hide */
    /** @hide */
@@ -1418,15 +1455,25 @@ public class ServiceState implements Parcelable {




    /** @hide */
    /** @hide */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
    public int getDataNetworkType() {
    public @TelephonyManager.NetworkType int getDataNetworkType() {
        return rilRadioTechnologyToNetworkType(mRilDataRadioTechnology);
        final NetworkRegistrationState regState = getNetworkRegistrationState(
                NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TransportType.WWAN);
        if (regState != null) {
            return regState.getAccessNetworkTechnology();
        }
        return TelephonyManager.NETWORK_TYPE_UNKNOWN;
    }
    }


    /** @hide */
    /** @hide */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
    public int getVoiceNetworkType() {
    public @TelephonyManager.NetworkType int getVoiceNetworkType() {
        return rilRadioTechnologyToNetworkType(mRilVoiceRadioTechnology);
        final NetworkRegistrationState regState = getNetworkRegistrationState(
                NetworkRegistrationState.DOMAIN_CS, AccessNetworkConstants.TransportType.WWAN);
        if (regState != null) {
            return regState.getAccessNetworkTechnology();
        }
        return TelephonyManager.NETWORK_TYPE_UNKNOWN;
    }
    }


    /** @hide */
    /** @hide */