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

Commit f713c1ff authored by Jack Yu's avatar Jack Yu Committed by android-build-merger
Browse files

Merge "Moved transport to IntDef"

am: b7463a63

Change-Id: I80d2bf5b3d195d4b05135006418ba4b638271f4f
parents c35c355d b7463a63
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -5508,9 +5508,10 @@ package android.telecom {
package android.telephony {
  public static final class AccessNetworkConstants.TransportType {
    field public static final int WLAN = 2; // 0x2
    field public static final int WWAN = 1; // 0x1
  public final class AccessNetworkConstants {
    field public static final int TRANSPORT_TYPE_INVALID = -1; // 0xffffffff
    field public static final int TRANSPORT_TYPE_WLAN = 2; // 0x2
    field public static final int TRANSPORT_TYPE_WWAN = 1; // 0x1
  }
  public final class CallAttributes implements android.os.Parcelable {
+1 −1
Original line number Diff line number Diff line
@@ -1617,7 +1617,7 @@ public class NetworkMonitor extends StateMachine {
            // See if the data sub is registered for PS services on cell.
            final NetworkRegistrationState nrs = dataSs.getNetworkRegistrationState(
                    NetworkRegistrationState.DOMAIN_PS,
                    AccessNetworkConstants.TransportType.WWAN);
                    AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
            latencyBroadcast.putExtra(
                    NetworkMonitorUtils.EXTRA_CELL_ID,
                    nrs == null ? null : nrs.getCellIdentity());
+2 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.content.Intent;
import android.content.res.Resources;
import android.net.wifi.WifiInfo;
import android.os.UserHandle;
import android.telephony.AccessNetworkConstants.TransportType;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Slog;
@@ -92,7 +93,7 @@ public class NetworkNotificationManager {
        return -1;
    }

    private static String getTransportName(int transportType) {
    private static String getTransportName(@TransportType int transportType) {
        Resources r = Resources.getSystem();
        String[] networkTypes = r.getStringArray(R.array.network_switch_type_name);
        try {
+47 −33
Original line number Diff line number Diff line
@@ -16,13 +16,59 @@

package android.telephony;

import android.annotation.IntDef;
import android.annotation.SystemApi;

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

/**
 * Contains access network related constants.
 */
public final class AccessNetworkConstants {

    /**
     * Wireless transportation type
     *
     * @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = {"TRANSPORT_TYPE_"},
            value = {
                    TRANSPORT_TYPE_INVALID,
                    TRANSPORT_TYPE_WWAN,
                    TRANSPORT_TYPE_WLAN})
    public @interface TransportType {}

    /**
     * Invalid transport type
     * @hide
     */
    @SystemApi
    public static final int TRANSPORT_TYPE_INVALID = -1;

    /**
     * Transport type for Wireless Wide Area Networks (i.e. Cellular)
     * @hide
     */
    @SystemApi
    public static final int TRANSPORT_TYPE_WWAN = 1;

    /**
     * Transport type for Wireless Local Area Networks (i.e. Wifi)
     * @hide
     */
    @SystemApi
    public static final int TRANSPORT_TYPE_WLAN = 2;

    /** @hide */
    public static String transportTypeToString(@TransportType int transportType) {
        switch (transportType) {
            case TRANSPORT_TYPE_WWAN: return "WWAN";
            case TRANSPORT_TYPE_WLAN: return "WLAN";
            default: return Integer.toString(transportType);
        }
    }

    public static final class AccessNetworkType {
        public static final int UNKNOWN = 0;
        public static final int GERAN = 1;
@@ -49,39 +95,7 @@ public final class AccessNetworkConstants {
    }

    /**
     * Wireless transportation type
     * @hide
     */
    @SystemApi
    public static final class TransportType {
        /**
         * Invalid transport type.
         * @hide
         */
        public static final int INVALID = -1;

        /** Wireless Wide Area Networks (i.e. Cellular) */
        public static final int WWAN = 1;

        /** Wireless Local Area Networks (i.e. Wifi) */
        public static final int WLAN = 2;

        /** @hide */
        private TransportType() {}

        /** @hide */
        public static String toString(int type) {
            switch (type) {
                case INVALID: return "INVALID";
                case WWAN: return "WWAN";
                case WLAN: return "WLAN";
                default: return Integer.toString(type);
            }
        }
    }

    /**
     * Frenquency bands for GERAN.
     * Frequency bands for GERAN.
     * http://www.etsi.org/deliver/etsi_ts/145000_145099/145005/14.00.00_60/ts_145005v140000p.pdf
     */
    public static final class GeranBand {
+15 −13
Original line number Diff line number Diff line
@@ -129,7 +129,6 @@ public class NetworkRegistrationState implements Parcelable {
    @Domain
    private final int mDomain;

    /** {@link TransportType} */
    private final int mTransportType;

    @RegState
@@ -165,14 +164,15 @@ public class NetworkRegistrationState implements Parcelable {
    private DataSpecificRegistrationStates mDataSpecificStates;

    /**
     * @param domain Network domain. Must be a {@link Domain}. For {@link TransportType#WLAN}
     * transport, this must set to {@link #DOMAIN_PS}.
     * @param transportType Transport type. Must be one of the{@link TransportType}.
     * @param domain Network domain. Must be a {@link Domain}. For transport type
     * {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}, this must set to {@link #DOMAIN_PS}.
     * @param transportType Transport type.
     * @param regState Network registration state. Must be one of the {@link RegState}. For
     * {@link TransportType#WLAN} transport, only {@link #REG_STATE_HOME} and
     * {@link #REG_STATE_NOT_REG_NOT_SEARCHING} are valid states.
     * @param accessNetworkTechnology Access network technology.For {@link TransportType#WLAN}
     * transport, set to {@link TelephonyManager#NETWORK_TYPE_IWLAN}.
     * transport type {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}, only
     * {@link #REG_STATE_HOME} and {@link #REG_STATE_NOT_REG_NOT_SEARCHING} are valid states.
     * @param accessNetworkTechnology Access network technology.For transport type
     * {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}, set to
     * {@link TelephonyManager#NETWORK_TYPE_IWLAN}.
     * @param rejectCause Reason for denial if the registration state is {@link #REG_STATE_DENIED}.
     * Depending on {@code accessNetworkTechnology}, the values are defined in 3GPP TS 24.008
     * 10.5.3.6 for UMTS, 3GPP TS 24.301 9.9.3.9 for LTE, and 3GPP2 A.S0001 6.2.2.44 for CDMA. If
@@ -184,7 +184,8 @@ public class NetworkRegistrationState implements Parcelable {
     * @param cellIdentity The identity representing a unique cell or wifi AP. Set to null if the
     * information is not available.
     */
    public NetworkRegistrationState(@Domain int domain, int transportType, @RegState int regState,
    public NetworkRegistrationState(@Domain int domain, @TransportType int transportType,
                                    @RegState int regState,
                                    @NetworkType int accessNetworkTechnology, int rejectCause,
                                    boolean emergencyOnly,
                                    @NonNull @ServiceType int[] availableServices,
@@ -206,7 +207,7 @@ public class NetworkRegistrationState implements Parcelable {
     * Constructor for voice network registration states.
     * @hide
     */
    public NetworkRegistrationState(int domain, int transportType, int regState,
    public NetworkRegistrationState(int domain, @TransportType int transportType, int regState,
            int accessNetworkTechnology, int rejectCause, boolean emergencyOnly,
            int[] availableServices, @Nullable CellIdentity cellIdentity, boolean cssSupported,
            int roamingIndicator, int systemIsInPrl, int defaultRoamingIndicator) {
@@ -221,7 +222,7 @@ public class NetworkRegistrationState implements Parcelable {
     * Constructor for data network registration states.
     * @hide
     */
    public NetworkRegistrationState(int domain, int transportType, int regState,
    public NetworkRegistrationState(int domain, @TransportType int transportType, int regState,
            int accessNetworkTechnology, int rejectCause, boolean emergencyOnly,
            int[] availableServices, @Nullable CellIdentity cellIdentity, int maxDataCalls,
            boolean isDcNrRestricted, boolean isNrAvailable, boolean isEndcAvailable,
@@ -434,7 +435,8 @@ public class NetworkRegistrationState implements Parcelable {
    public String toString() {
        return new StringBuilder("NetworkRegistrationState{")
                .append(" domain=").append((mDomain == DOMAIN_CS) ? "CS" : "PS")
                .append(" transportType=").append(TransportType.toString(mTransportType))
                .append(" transportType=").append(
                        AccessNetworkConstants.transportTypeToString(mTransportType))
                .append(" regState=").append(regStateToString(mRegState))
                .append(" roamingType=").append(ServiceState.roamingTypeToString(mRoamingType))
                .append(" accessNetworkTechnology=")
@@ -627,7 +629,7 @@ public class NetworkRegistrationState implements Parcelable {
         *
         * @return The same instance of the builder.
         */
        public @NonNull Builder setTransportType(int transportType) {
        public @NonNull Builder setTransportType(@TransportType int transportType) {
            mTransportType = transportType;
            return this;
        }
Loading