Removed APN name and types from PreciseDataConnectionState am: 7c4b48f0e5 am: def7634066

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

Change-Id: I02eee8389b7c0219a4c6757930fbc8dee1f54c01
This commit is contained in:
Jack Yu
2020-09-25 07:09:33 +00:00
committed by Automerger Merge Worker
2 changed files with 20 additions and 56 deletions

View File

@@ -1801,7 +1801,9 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mPreciseDataConnectionStates.get(phoneId).put( mPreciseDataConnectionStates.get(phoneId).put(
apnType, apnType,
new PreciseDataConnectionState.Builder() new PreciseDataConnectionState.Builder()
.setApnTypes(apnType) .setApnSetting(new ApnSetting.Builder()
.setApnTypeBitmask(apnType)
.build())
.build()); .build());
for (Record r : mRecords) { for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent( if (r.matchPhoneStateListenerEvent(
@@ -1981,7 +1983,9 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mPreciseDataConnectionStates.get(phoneId).put( mPreciseDataConnectionStates.get(phoneId).put(
apnType, apnType,
new PreciseDataConnectionState.Builder() new PreciseDataConnectionState.Builder()
.setApnTypes(apnType) .setApnSetting(new ApnSetting.Builder()
.setApnTypeBitmask(apnType)
.build())
.setFailCause(failCause) .setFailCause(failCause)
.build()); .build());
for (Record r : mRecords) { for (Record r : mRecords) {

View File

@@ -56,8 +56,6 @@ public final class PreciseDataConnectionState implements Parcelable {
private final @DataState int mState; private final @DataState int mState;
private final @NetworkType int mNetworkType; private final @NetworkType int mNetworkType;
private final @DataFailureCause int mFailCause; private final @DataFailureCause int mFailCause;
private final @ApnType int mApnTypes;
private final String mApn;
private final LinkProperties mLinkProperties; private final LinkProperties mLinkProperties;
private final ApnSetting mApnSetting; private final ApnSetting mApnSetting;
@@ -76,7 +74,10 @@ public final class PreciseDataConnectionState implements Parcelable {
@ApnType int apnTypes, @NonNull String apn, @ApnType int apnTypes, @NonNull String apn,
@Nullable LinkProperties linkProperties, @Nullable LinkProperties linkProperties,
@DataFailureCause int failCause) { @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 state The state of the data connection
* @param networkType The access network that is/would carry this 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 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 * @param failCause In case a procedure related to this data connection fails, a non-zero error
* code indicating the cause of the failure. * code indicating the cause of the failure.
* @param apnSetting If there is a valid APN for this Data Connection, then the APN Settings; * @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 * if there is no valid APN setting for the specific type, then this will be null
* @hide
*/ */
private PreciseDataConnectionState(@DataState int state, private PreciseDataConnectionState(@DataState int state,
@NetworkType int networkType, @NetworkType int networkType,
@ApnType int apnTypes,
@NonNull String apn,
@Nullable LinkProperties linkProperties, @Nullable LinkProperties linkProperties,
@DataFailureCause int failCause, @DataFailureCause int failCause,
@Nullable ApnSetting apnSetting) { @Nullable ApnSetting apnSetting) {
mState = state; mState = state;
mNetworkType = networkType; mNetworkType = networkType;
mApnTypes = apnTypes;
mApn = apn;
mLinkProperties = linkProperties; mLinkProperties = linkProperties;
mFailCause = failCause; mFailCause = failCause;
mApnSetting = apnSetting; mApnSetting = apnSetting;
@@ -118,11 +112,9 @@ public final class PreciseDataConnectionState implements Parcelable {
private PreciseDataConnectionState(Parcel in) { private PreciseDataConnectionState(Parcel in) {
mState = in.readInt(); mState = in.readInt();
mNetworkType = in.readInt(); mNetworkType = in.readInt();
mApnTypes = in.readInt(); mLinkProperties = in.readParcelable(LinkProperties.class.getClassLoader());
mApn = in.readString();
mLinkProperties = (LinkProperties) in.readParcelable(null);
mFailCause = in.readInt(); 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 @Deprecated
@SystemApi @SystemApi
public @ApnType int getDataConnectionApnTypeBitMask() { 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 @SystemApi
@Deprecated @Deprecated
public String getDataConnectionApn() { 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) { public void writeToParcel(@NonNull Parcel out, int flags) {
out.writeInt(mState); out.writeInt(mState);
out.writeInt(mNetworkType); out.writeInt(mNetworkType);
out.writeInt(mApnTypes);
out.writeString(mApn);
out.writeParcelable(mLinkProperties, flags); out.writeParcelable(mLinkProperties, flags);
out.writeInt(mFailCause); out.writeInt(mFailCause);
out.writeParcelable(mApnSetting, flags); out.writeParcelable(mApnSetting, flags);
@@ -266,8 +256,7 @@ public final class PreciseDataConnectionState implements Parcelable {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(mState, mNetworkType, mFailCause, mApnTypes, mApn, mLinkProperties, return Objects.hash(mState, mNetworkType, mFailCause, mLinkProperties, mApnSetting);
mApnSetting);
} }
@@ -279,8 +268,6 @@ public final class PreciseDataConnectionState implements Parcelable {
return mState == that.mState return mState == that.mState
&& mNetworkType == that.mNetworkType && mNetworkType == that.mNetworkType
&& mFailCause == that.mFailCause && mFailCause == that.mFailCause
&& mApnTypes == that.mApnTypes
&& Objects.equals(mApn, that.mApn)
&& Objects.equals(mLinkProperties, that.mLinkProperties) && Objects.equals(mLinkProperties, that.mLinkProperties)
&& Objects.equals(mApnSetting, that.mApnSetting); && Objects.equals(mApnSetting, that.mApnSetting);
} }
@@ -292,8 +279,9 @@ public final class PreciseDataConnectionState implements Parcelable {
sb.append("Data Connection state: " + mState); sb.append("Data Connection state: " + mState);
sb.append(", Network type: " + mNetworkType); sb.append(", Network type: " + mNetworkType);
sb.append(", APN types: " + ApnSetting.getApnTypesStringFromBitmask(mApnTypes)); sb.append(", APN types: " + ApnSetting.getApnTypesStringFromBitmask(
sb.append(", APN: " + mApn); getDataConnectionApnTypeBitMask()));
sb.append(", APN: " + getDataConnectionApn());
sb.append(", Link properties: " + mLinkProperties); sb.append(", Link properties: " + mLinkProperties);
sb.append(", Fail cause: " + DataFailCause.toString(mFailCause)); sb.append(", Fail cause: " + DataFailCause.toString(mFailCause));
sb.append(", Apn Setting: " + mApnSetting); sb.append(", Apn Setting: " + mApnSetting);
@@ -313,12 +301,6 @@ public final class PreciseDataConnectionState implements Parcelable {
/** The network type associated with this data connection */ /** The network type associated with this data connection */
private @NetworkType int mNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN; 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 */ /** If the data connection is connected, the properties of the connection */
private @Nullable LinkProperties mLinkProperties = null; private @Nullable LinkProperties mLinkProperties = null;
@@ -353,28 +335,6 @@ public final class PreciseDataConnectionState implements Parcelable {
return this; 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. * Set the link properties of the connection.
* *
@@ -415,8 +375,8 @@ public final class PreciseDataConnectionState implements Parcelable {
* @return The {@link PreciseDataConnectionState} instance * @return The {@link PreciseDataConnectionState} instance
*/ */
public PreciseDataConnectionState build() { public PreciseDataConnectionState build() {
return new PreciseDataConnectionState(mState, mNetworkType, mApnTypes, mApn, return new PreciseDataConnectionState(mState, mNetworkType, mLinkProperties, mFailCause,
mLinkProperties, mFailCause, mApnSetting); mApnSetting);
} }
} }
} }