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

Commit de0764ef authored by Hunsuk Choi's avatar Hunsuk Choi Committed by Android (Google) Code Review
Browse files

Merge "Add system apis to receive LTE attach information"

parents e5a40f29 c213d06e
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -13193,10 +13193,18 @@ package android.telephony {
  public final class DataSpecificRegistrationInfo implements android.os.Parcelable {
  public final class DataSpecificRegistrationInfo implements android.os.Parcelable {
    method public int describeContents();
    method public int describeContents();
    method public int getLteAttachExtraInfo();
    method public int getLteAttachResultType();
    method @Deprecated @NonNull public android.telephony.LteVopsSupportInfo getLteVopsSupportInfo();
    method @Deprecated @NonNull public android.telephony.LteVopsSupportInfo getLteVopsSupportInfo();
    method @Nullable public android.telephony.VopsSupportInfo getVopsSupportInfo();
    method @Nullable public android.telephony.VopsSupportInfo getVopsSupportInfo();
    method public void writeToParcel(android.os.Parcel, int);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.DataSpecificRegistrationInfo> CREATOR;
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.DataSpecificRegistrationInfo> CREATOR;
    field public static final int LTE_ATTACH_EXTRA_INFO_CSFB_NOT_PREFERRED = 1; // 0x1
    field public static final int LTE_ATTACH_EXTRA_INFO_NONE = 0; // 0x0
    field public static final int LTE_ATTACH_EXTRA_INFO_SMS_ONLY = 2; // 0x2
    field public static final int LTE_ATTACH_TYPE_COMBINED = 2; // 0x2
    field public static final int LTE_ATTACH_TYPE_EPS_ONLY = 1; // 0x1
    field public static final int LTE_ATTACH_TYPE_UNKNOWN = 0; // 0x0
  }
  }
  public final class DataThrottlingRequest implements android.os.Parcelable {
  public final class DataThrottlingRequest implements android.os.Parcelable {
@@ -13292,6 +13300,7 @@ package android.telephony {
    method public boolean isEmergencyEnabled();
    method public boolean isEmergencyEnabled();
    method public void writeToParcel(android.os.Parcel, int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int REGISTRATION_STATE_DENIED = 3; // 0x3
    field public static final int REGISTRATION_STATE_DENIED = 3; // 0x3
    field public static final int REGISTRATION_STATE_EMERGENCY = 6; // 0x6
    field public static final int REGISTRATION_STATE_HOME = 1; // 0x1
    field public static final int REGISTRATION_STATE_HOME = 1; // 0x1
    field public static final int REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING = 0; // 0x0
    field public static final int REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING = 0; // 0x0
    field public static final int REGISTRATION_STATE_NOT_REGISTERED_SEARCHING = 2; // 0x2
    field public static final int REGISTRATION_STATE_NOT_REGISTERED_SEARCHING = 2; // 0x2
+198 −2
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package android.telephony;
package android.telephony;


import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
@@ -24,6 +25,8 @@ import android.os.Parcelable;


import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;


import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Objects;
import java.util.Objects;




@@ -33,6 +36,69 @@ import java.util.Objects;
 */
 */
@SystemApi
@SystemApi
public final class DataSpecificRegistrationInfo implements Parcelable {
public final class DataSpecificRegistrationInfo implements Parcelable {

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(
        prefix = "LTE_ATTACH_TYPE_",
        value = {
            LTE_ATTACH_TYPE_UNKNOWN,
            LTE_ATTACH_TYPE_EPS_ONLY,
            LTE_ATTACH_TYPE_COMBINED,
        })
    public @interface LteAttachResultType {}

    /**
     * Default value.
     * Attach type is unknown.
     */
    public static final int LTE_ATTACH_TYPE_UNKNOWN = 0;

    /**
     * LTE is attached with EPS only.
     *
     * Reference: 3GPP TS 24.301 9.9.3 EMM information elements.
     */
    public static final int LTE_ATTACH_TYPE_EPS_ONLY = 1;

    /**
     * LTE combined EPS and IMSI attach.
     *
     * Reference: 3GPP TS 24.301 9.9.3 EMM information elements.
     */
    public static final int LTE_ATTACH_TYPE_COMBINED = 2;

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(flag = true, prefix = {"LTE_ATTACH_EXTRA_INFO_"},
            value = {
                    LTE_ATTACH_EXTRA_INFO_NONE,
                    LTE_ATTACH_EXTRA_INFO_CSFB_NOT_PREFERRED,
                    LTE_ATTACH_EXTRA_INFO_SMS_ONLY
            })
    public @interface LteAttachExtraInfo {}

    /**
     * Default value.
     */
    public static final int LTE_ATTACH_EXTRA_INFO_NONE = 0;

    /**
     * CSFB is not preferred.
     * Applicable for LTE only.
     *
     * Reference: 3GPP TS 24.301 9.9.3 EMM information elements.
     */
    public static final int LTE_ATTACH_EXTRA_INFO_CSFB_NOT_PREFERRED = 1 << 0;

    /**
     * Attached for SMS only.
     * Applicable for LTE only.
     *
     * Reference: 3GPP TS 24.301 9.9.3 EMM information elements.
     */
    public static final int LTE_ATTACH_EXTRA_INFO_SMS_ONLY = 1 << 1;

    /**
    /**
     * @hide
     * @hide
     * The maximum number of simultaneous Data Calls that
     * The maximum number of simultaneous Data Calls that
@@ -75,6 +141,22 @@ public final class DataSpecificRegistrationInfo implements Parcelable {
    @Nullable
    @Nullable
    private final VopsSupportInfo mVopsSupportInfo;
    private final VopsSupportInfo mVopsSupportInfo;


    /** The type of network attachment */
    private final @LteAttachResultType int mLteAttachResultType;

    /** LTE attach extra info */
    private final @LteAttachExtraInfo int mLteAttachExtraInfo;

    private DataSpecificRegistrationInfo(Builder builder) {
        this.maxDataCalls = builder.mMaxDataCalls;
        this.isDcNrRestricted = builder.mIsDcNrRestricted;
        this.isNrAvailable = builder.mIsNrAvailable;
        this.isEnDcAvailable = builder.mIsEnDcAvailable;
        this.mVopsSupportInfo = builder.mVopsSupportInfo;
        this.mLteAttachResultType = builder.mLteAttachResultType;
        this.mLteAttachExtraInfo = builder.mLteAttachExtraInfo;
    }

    /**
    /**
     * @hide
     * @hide
     */
     */
@@ -87,6 +169,8 @@ public final class DataSpecificRegistrationInfo implements Parcelable {
        this.isNrAvailable = isNrAvailable;
        this.isNrAvailable = isNrAvailable;
        this.isEnDcAvailable = isEnDcAvailable;
        this.isEnDcAvailable = isEnDcAvailable;
        this.mVopsSupportInfo = vops;
        this.mVopsSupportInfo = vops;
        this.mLteAttachResultType = LTE_ATTACH_TYPE_UNKNOWN;
        this.mLteAttachExtraInfo = LTE_ATTACH_EXTRA_INFO_NONE;
    }
    }


    /**
    /**
@@ -101,6 +185,8 @@ public final class DataSpecificRegistrationInfo implements Parcelable {
        isNrAvailable = dsri.isNrAvailable;
        isNrAvailable = dsri.isNrAvailable;
        isEnDcAvailable = dsri.isEnDcAvailable;
        isEnDcAvailable = dsri.isEnDcAvailable;
        mVopsSupportInfo = dsri.mVopsSupportInfo;
        mVopsSupportInfo = dsri.mVopsSupportInfo;
        mLteAttachResultType = dsri.mLteAttachResultType;
        mLteAttachExtraInfo = dsri.mLteAttachExtraInfo;
    }
    }


    private DataSpecificRegistrationInfo(/* @NonNull */ Parcel source) {
    private DataSpecificRegistrationInfo(/* @NonNull */ Parcel source) {
@@ -109,6 +195,8 @@ public final class DataSpecificRegistrationInfo implements Parcelable {
        isNrAvailable = source.readBoolean();
        isNrAvailable = source.readBoolean();
        isEnDcAvailable = source.readBoolean();
        isEnDcAvailable = source.readBoolean();
        mVopsSupportInfo = source.readParcelable(VopsSupportInfo.class.getClassLoader(), android.telephony.VopsSupportInfo.class);
        mVopsSupportInfo = source.readParcelable(VopsSupportInfo.class.getClassLoader(), android.telephony.VopsSupportInfo.class);
        mLteAttachResultType = source.readInt();
        mLteAttachExtraInfo = source.readInt();
    }
    }


    @Override
    @Override
@@ -118,6 +206,8 @@ public final class DataSpecificRegistrationInfo implements Parcelable {
        dest.writeBoolean(isNrAvailable);
        dest.writeBoolean(isNrAvailable);
        dest.writeBoolean(isEnDcAvailable);
        dest.writeBoolean(isEnDcAvailable);
        dest.writeParcelable(mVopsSupportInfo, flags);
        dest.writeParcelable(mVopsSupportInfo, flags);
        dest.writeInt(mLteAttachResultType);
        dest.writeInt(mLteAttachExtraInfo);
    }
    }


    @Override
    @Override
@@ -134,6 +224,8 @@ public final class DataSpecificRegistrationInfo implements Parcelable {
                .append(" isDcNrRestricted = " + isDcNrRestricted)
                .append(" isDcNrRestricted = " + isDcNrRestricted)
                .append(" isNrAvailable = " + isNrAvailable)
                .append(" isNrAvailable = " + isNrAvailable)
                .append(" isEnDcAvailable = " + isEnDcAvailable)
                .append(" isEnDcAvailable = " + isEnDcAvailable)
                .append(" mLteAttachResultType = " + mLteAttachResultType)
                .append(" mLteAttachExtraInfo = " + mLteAttachExtraInfo)
                .append(" " + mVopsSupportInfo)
                .append(" " + mVopsSupportInfo)
                .append(" }")
                .append(" }")
                .toString();
                .toString();
@@ -142,7 +234,8 @@ public final class DataSpecificRegistrationInfo implements Parcelable {
    @Override
    @Override
    public int hashCode() {
    public int hashCode() {
        return Objects.hash(maxDataCalls, isDcNrRestricted, isNrAvailable,
        return Objects.hash(maxDataCalls, isDcNrRestricted, isNrAvailable,
                isEnDcAvailable, mVopsSupportInfo);
                isEnDcAvailable, mVopsSupportInfo,
                mLteAttachResultType, mLteAttachExtraInfo);
    }
    }


    @Override
    @Override
@@ -156,7 +249,9 @@ public final class DataSpecificRegistrationInfo implements Parcelable {
                && this.isDcNrRestricted == other.isDcNrRestricted
                && this.isDcNrRestricted == other.isDcNrRestricted
                && this.isNrAvailable == other.isNrAvailable
                && this.isNrAvailable == other.isNrAvailable
                && this.isEnDcAvailable == other.isEnDcAvailable
                && this.isEnDcAvailable == other.isEnDcAvailable
                && Objects.equals(mVopsSupportInfo, other.mVopsSupportInfo);
                && Objects.equals(mVopsSupportInfo, other.mVopsSupportInfo)
                && this.mLteAttachResultType == other.mLteAttachResultType
                && this.mLteAttachExtraInfo == other.mLteAttachExtraInfo;
    }
    }


    public static final @NonNull Parcelable.Creator<DataSpecificRegistrationInfo> CREATOR =
    public static final @NonNull Parcelable.Creator<DataSpecificRegistrationInfo> CREATOR =
@@ -196,4 +291,105 @@ public final class DataSpecificRegistrationInfo implements Parcelable {
    public VopsSupportInfo getVopsSupportInfo() {
    public VopsSupportInfo getVopsSupportInfo() {
        return mVopsSupportInfo;
        return mVopsSupportInfo;
    }
    }

    /**
     * Provides the LTE attach type.
     */
    public @LteAttachResultType int getLteAttachResultType() {
        return mLteAttachResultType;
    }

    /**
     * Provides the extra information of LTE attachment.
     *
     * @return the bitwise OR of {@link LteAttachExtraInfo}.
     */
    public @LteAttachExtraInfo int getLteAttachExtraInfo() {
        return mLteAttachExtraInfo;
    }

    /**
     * Builds {@link DataSpecificRegistrationInfo} instances, which may include optional parameters.
     * @hide
     */
    public static final class Builder {
        private final int mMaxDataCalls;

        private boolean mIsDcNrRestricted;
        private boolean mIsNrAvailable;
        private boolean mIsEnDcAvailable;
        private @Nullable VopsSupportInfo mVopsSupportInfo;
        private @LteAttachResultType int mLteAttachResultType = LTE_ATTACH_TYPE_UNKNOWN;
        private @LteAttachExtraInfo int mLteAttachExtraInfo = LTE_ATTACH_EXTRA_INFO_NONE;

        public Builder(int maxDataCalls) {
            mMaxDataCalls = maxDataCalls;
        }

        /**
         * Ses whether the use of dual connectivity with NR is restricted.
         * @param isDcNrRestricted {@code true} if the use of dual connectivity with NR is
         *        restricted.
         */
        public @NonNull Builder setDcNrRestricted(boolean isDcNrRestricted) {
            mIsDcNrRestricted = isDcNrRestricted;
            return this;
        }

        /**
         * Sets whether NR is supported by the selected PLMN.
         * @param isNrAvailable {@code true} if NR is supported.
         */
        public @NonNull Builder setNrAvailable(boolean isNrAvailable) {
            mIsNrAvailable = isNrAvailable;
            return this;
        }

        /**
         * Sets whether E-UTRA-NR Dual Connectivity (EN-DC) is supported by the primary serving
         * cell.
         * @param isEnDcAvailable {@code true} if EN_DC is supported.
         */
        public @NonNull Builder setEnDcAvailable(boolean isEnDcAvailable) {
            mIsEnDcAvailable = isEnDcAvailable;
            return this;
        }

        /**
         * Sets the network support info for VoPS and Emergency bearer support.
         * @param vops The network support info for VoPS and Emergency bearer support.
         */
        @Nullable
        public @NonNull Builder setVopsSupportInfo(VopsSupportInfo vops) {
            mVopsSupportInfo = vops;
            return this;
        }

        /**
         * Sets the LTE attach type.
         * @param lteAttachResultType the Lte attach type
         */
        public @NonNull Builder setLteAttachResultType(
                @LteAttachResultType int lteAttachResultType) {
            mLteAttachResultType = lteAttachResultType;
            return this;
        }

        /**
         * Sets the extra information of LTE attachment.
         * @param lteAttachExtraInfo the extra information of LTE attachment.
         */
        public @NonNull Builder setLteAttachExtraInfo(
                @LteAttachExtraInfo int lteAttachExtraInfo) {
            mLteAttachExtraInfo = lteAttachExtraInfo;
            return this;
        }

        /**
         * @return a built {@link DataSpecificRegistrationInfo} instance.
         */
        public @NonNull DataSpecificRegistrationInfo build() {
            return new DataSpecificRegistrationInfo(this);
        }
    }
}
}
+43 −3
Original line number Original line Diff line number Diff line
@@ -20,6 +20,9 @@ import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.app.compat.CompatChanges;
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledSince;
import android.os.Build;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;
@@ -39,6 +42,16 @@ import java.util.stream.Collectors;
 * Description of a mobile network registration info
 * Description of a mobile network registration info
 */
 */
public final class NetworkRegistrationInfo implements Parcelable {
public final class NetworkRegistrationInfo implements Parcelable {

    /**
     * A new registration state, REGISTRATION_STATE_EMERGENCY, is added to
     * {@link NetworkRegistrationInfo}. This change will affect the result of getRegistration().
     * @hide
     */
    @ChangeId
    @EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
    public static final long RETURN_REGISTRATION_STATE_EMERGENCY = 255938466L;

    /**
    /**
     * Network domain
     * Network domain
     * @hide
     * @hide
@@ -64,7 +77,8 @@ public final class NetworkRegistrationInfo implements Parcelable {
    @IntDef(prefix = "REGISTRATION_STATE_",
    @IntDef(prefix = "REGISTRATION_STATE_",
            value = {REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING, REGISTRATION_STATE_HOME,
            value = {REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING, REGISTRATION_STATE_HOME,
                    REGISTRATION_STATE_NOT_REGISTERED_SEARCHING, REGISTRATION_STATE_DENIED,
                    REGISTRATION_STATE_NOT_REGISTERED_SEARCHING, REGISTRATION_STATE_DENIED,
                    REGISTRATION_STATE_UNKNOWN, REGISTRATION_STATE_ROAMING})
                    REGISTRATION_STATE_UNKNOWN, REGISTRATION_STATE_ROAMING,
                    REGISTRATION_STATE_EMERGENCY})
    public @interface RegistrationState {}
    public @interface RegistrationState {}


    /**
    /**
@@ -103,6 +117,18 @@ public final class NetworkRegistrationInfo implements Parcelable {
     */
     */
    @SystemApi
    @SystemApi
    public static final int REGISTRATION_STATE_ROAMING = 5;
    public static final int REGISTRATION_STATE_ROAMING = 5;
    /**
     * Emergency attached in EPS or in 5GS.
     * IMS service will skip emergency registration if the device is in
     * emergency attached state. {@link #mEmergencyOnly} can be true
     * even in case it's not in emergency attached state.
     *
     * Reference: 3GPP TS 24.301 9.9.3.11 EPS attach type.
     * Reference: 3GPP TS 24.501 9.11.3.6 5GS registration result.
     * @hide
     */
    @SystemApi
    public static final int REGISTRATION_STATE_EMERGENCY = 6;


    /** @hide */
    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @Retention(RetentionPolicy.SOURCE)
@@ -312,8 +338,12 @@ public final class NetworkRegistrationInfo implements Parcelable {
                                   @Nullable VopsSupportInfo vopsSupportInfo) {
                                   @Nullable VopsSupportInfo vopsSupportInfo) {
        this(domain, transportType, registrationState, accessNetworkTechnology, rejectCause,
        this(domain, transportType, registrationState, accessNetworkTechnology, rejectCause,
                emergencyOnly, availableServices, cellIdentity, rplmn, null,
                emergencyOnly, availableServices, cellIdentity, rplmn, null,
                new DataSpecificRegistrationInfo(maxDataCalls, isDcNrRestricted, isNrAvailable,
                new DataSpecificRegistrationInfo.Builder(maxDataCalls)
                        isEndcAvailable, vopsSupportInfo));
                        .setDcNrRestricted(isDcNrRestricted)
                        .setNrAvailable(isNrAvailable)
                        .setEnDcAvailable(isEndcAvailable)
                        .setVopsSupportInfo(vopsSupportInfo)
                        .build());
    }
    }


    private NetworkRegistrationInfo(Parcel source) {
    private NetworkRegistrationInfo(Parcel source) {
@@ -406,6 +436,15 @@ public final class NetworkRegistrationInfo implements Parcelable {
     */
     */
    @SystemApi
    @SystemApi
    public @RegistrationState int getRegistrationState() {
    public @RegistrationState int getRegistrationState() {
        if (mRegistrationState == REGISTRATION_STATE_EMERGENCY) {
            if (!CompatChanges.isChangeEnabled(RETURN_REGISTRATION_STATE_EMERGENCY)) {
                if (mAccessNetworkTechnology == TelephonyManager.NETWORK_TYPE_LTE) {
                    return REGISTRATION_STATE_DENIED;
                } else if (mAccessNetworkTechnology == TelephonyManager.NETWORK_TYPE_NR) {
                    return REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING;
                }
            }
        }
        return mRegistrationState;
        return mRegistrationState;
    }
    }


@@ -630,6 +669,7 @@ public final class NetworkRegistrationInfo implements Parcelable {
            case REGISTRATION_STATE_DENIED: return "DENIED";
            case REGISTRATION_STATE_DENIED: return "DENIED";
            case REGISTRATION_STATE_UNKNOWN: return "UNKNOWN";
            case REGISTRATION_STATE_UNKNOWN: return "UNKNOWN";
            case REGISTRATION_STATE_ROAMING: return "ROAMING";
            case REGISTRATION_STATE_ROAMING: return "ROAMING";
            case REGISTRATION_STATE_EMERGENCY: return "EMERGENCY";
        }
        }
        return "Unknown reg state " + registrationState;
        return "Unknown reg state " + registrationState;
    }
    }