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

Commit 544cea25 authored by Jack Yu's avatar Jack Yu Committed by Automerger Merge Worker
Browse files

Removed APN name and types from PreciseDataConnectionState am: 7c4b48f0 am: def76340

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1436354

Change-Id: I02eee8389b7c0219a4c6757930fbc8dee1f54c01
parents c0f7cf70 def76340
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1801,7 +1801,9 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                mPreciseDataConnectionStates.get(phoneId).put(
                        apnType,
                        new PreciseDataConnectionState.Builder()
                                .setApnTypes(apnType)
                                .setApnSetting(new ApnSetting.Builder()
                                        .setApnTypeBitmask(apnType)
                                        .build())
                                .build());
                for (Record r : mRecords) {
                    if (r.matchPhoneStateListenerEvent(
@@ -1981,7 +1983,9 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                mPreciseDataConnectionStates.get(phoneId).put(
                        apnType,
                        new PreciseDataConnectionState.Builder()
                                .setApnTypes(apnType)
                                .setApnSetting(new ApnSetting.Builder()
                                        .setApnTypeBitmask(apnType)
                                        .build())
                                .setFailCause(failCause)
                                .build());
                for (Record r : mRecords) {
+14 −54
Original line number Diff line number Diff line
@@ -56,8 +56,6 @@ public final class PreciseDataConnectionState implements Parcelable {
    private final @DataState int mState;
    private final @NetworkType int mNetworkType;
    private final @DataFailureCause int mFailCause;
    private final @ApnType int mApnTypes;
    private final String mApn;
    private final LinkProperties mLinkProperties;
    private final ApnSetting mApnSetting;

@@ -76,7 +74,10 @@ public final class PreciseDataConnectionState implements Parcelable {
                                      @ApnType int apnTypes, @NonNull String apn,
                                      @Nullable LinkProperties linkProperties,
                                      @DataFailureCause int failCause) {
        this(state, networkType, apnTypes, apn, linkProperties, failCause, null);
        this(state, networkType, linkProperties, failCause, new ApnSetting.Builder()
                .setApnTypeBitmask(apnTypes)
                .setApnName(apn)
                .build());
    }


@@ -85,26 +86,19 @@ public final class PreciseDataConnectionState implements Parcelable {
     *
     * @param state The state of the data connection
     * @param networkType The access network that is/would carry this data connection
     * @param apnTypes The APN types that this data connection carries
     * @param apn The APN of this data connection
     * @param linkProperties If the data connection is connected, the properties of the connection
     * @param failCause In case a procedure related to this data connection fails, a non-zero error
     *        code indicating the cause of the failure.
     * @param apnSetting If there is a valid APN for this Data Connection, then the APN Settings;
     *        if there is no valid APN setting for the specific type, then this will be null
     * @hide
     */
    private PreciseDataConnectionState(@DataState int state,
                                      @NetworkType int networkType,
                                      @ApnType int apnTypes,
                                      @NonNull String apn,
                                      @Nullable LinkProperties linkProperties,
                                      @DataFailureCause int failCause,
                                      @Nullable ApnSetting apnSetting) {
        mState = state;
        mNetworkType = networkType;
        mApnTypes = apnTypes;
        mApn = apn;
        mLinkProperties = linkProperties;
        mFailCause = failCause;
        mApnSetting = apnSetting;
@@ -118,11 +112,9 @@ public final class PreciseDataConnectionState implements Parcelable {
    private PreciseDataConnectionState(Parcel in) {
        mState = in.readInt();
        mNetworkType = in.readInt();
        mApnTypes = in.readInt();
        mApn = in.readString();
        mLinkProperties = (LinkProperties) in.readParcelable(null);
        mLinkProperties = in.readParcelable(LinkProperties.class.getClassLoader());
        mFailCause = in.readInt();
        mApnSetting = (ApnSetting) in.readParcelable(null);
        mApnSetting = in.readParcelable(ApnSetting.class.getClassLoader());
    }

    /**
@@ -181,7 +173,7 @@ public final class PreciseDataConnectionState implements Parcelable {
    @Deprecated
    @SystemApi
    public @ApnType int getDataConnectionApnTypeBitMask() {
        return mApnTypes;
        return (mApnSetting != null) ? mApnSetting.getApnTypeBitmask() : ApnSetting.TYPE_NONE;
    }

    /**
@@ -194,7 +186,7 @@ public final class PreciseDataConnectionState implements Parcelable {
    @SystemApi
    @Deprecated
    public String getDataConnectionApn() {
        return mApn;
        return (mApnSetting != null) ? mApnSetting.getApnName() : "";
    }

    /**
@@ -245,8 +237,6 @@ public final class PreciseDataConnectionState implements Parcelable {
    public void writeToParcel(@NonNull Parcel out, int flags) {
        out.writeInt(mState);
        out.writeInt(mNetworkType);
        out.writeInt(mApnTypes);
        out.writeString(mApn);
        out.writeParcelable(mLinkProperties, flags);
        out.writeInt(mFailCause);
        out.writeParcelable(mApnSetting, flags);
@@ -266,8 +256,7 @@ public final class PreciseDataConnectionState implements Parcelable {

    @Override
    public int hashCode() {
        return Objects.hash(mState, mNetworkType, mFailCause, mApnTypes, mApn, mLinkProperties,
                mApnSetting);
        return Objects.hash(mState, mNetworkType, mFailCause, mLinkProperties, mApnSetting);
    }


@@ -279,8 +268,6 @@ public final class PreciseDataConnectionState implements Parcelable {
        return mState == that.mState
                && mNetworkType == that.mNetworkType
                && mFailCause == that.mFailCause
                && mApnTypes == that.mApnTypes
                && Objects.equals(mApn, that.mApn)
                && Objects.equals(mLinkProperties, that.mLinkProperties)
                && Objects.equals(mApnSetting, that.mApnSetting);
    }
@@ -292,8 +279,9 @@ public final class PreciseDataConnectionState implements Parcelable {

        sb.append("Data Connection state: " + mState);
        sb.append(", Network type: " + mNetworkType);
        sb.append(", APN types: " + ApnSetting.getApnTypesStringFromBitmask(mApnTypes));
        sb.append(", APN: " + mApn);
        sb.append(", APN types: " + ApnSetting.getApnTypesStringFromBitmask(
                getDataConnectionApnTypeBitMask()));
        sb.append(", APN: " + getDataConnectionApn());
        sb.append(", Link properties: " + mLinkProperties);
        sb.append(", Fail cause: " + DataFailCause.toString(mFailCause));
        sb.append(", Apn Setting: " + mApnSetting);
@@ -313,12 +301,6 @@ public final class PreciseDataConnectionState implements Parcelable {
        /** The network type associated with this data connection */
        private @NetworkType int mNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;

        /** The APN types that this data connection carries */
        private @ApnType int mApnTypes = ApnSetting.TYPE_NONE;

        /** The APN of this data connection */
        private @NonNull String mApn = "";

        /** If the data connection is connected, the properties of the connection */
        private @Nullable LinkProperties mLinkProperties = null;

@@ -353,28 +335,6 @@ public final class PreciseDataConnectionState implements Parcelable {
            return this;
        }

        /**
         * Set the APN types that this data connection carries
         *
         * @param apnTypes The APN types
         * @return The builder
         */
        public Builder setApnTypes(@ApnType int apnTypes) {
            mApnTypes = apnTypes;
            return this;
        }

        /**
         * Set the APN of this data connection
         *
         * @param apn The APN of this data connection
         * @return The builder
         */
        public Builder setApn(@NonNull String apn) {
            mApn = apn;
            return this;
        }

        /**
         * Set the link properties of the connection.
         *
@@ -415,8 +375,8 @@ public final class PreciseDataConnectionState implements Parcelable {
         * @return The {@link PreciseDataConnectionState} instance
         */
        public PreciseDataConnectionState build() {
            return new PreciseDataConnectionState(mState, mNetworkType, mApnTypes, mApn,
                    mLinkProperties, mFailCause, mApnSetting);
            return new PreciseDataConnectionState(mState, mNetworkType, mLinkProperties, mFailCause,
                    mApnSetting);
        }
    }
}