summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-07-29 20:33:35 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-07-29 20:33:35 +0000
commit795ce1222cbf9dfb03d1f4581b17a36d9154cb29 (patch)
treeecc93875adccf1502cc86adb592b732446af493f
parent77e0358c585ec5007be482dba2cc6a97fc77365a (diff)
parentc42172ece741b46228a81d2a75ee9fdabaf48dfa (diff)
Merge "Removed APN name and types from PreciseDataConnectionState"
-rw-r--r--services/core/java/com/android/server/TelephonyRegistry.java8
-rw-r--r--telephony/java/android/telephony/PreciseDataConnectionState.java68
2 files changed, 20 insertions, 56 deletions
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index a4c6c8751d93..bc7464f45384 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -1800,7 +1800,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(
@@ -1984,7 +1986,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) {
diff --git a/telephony/java/android/telephony/PreciseDataConnectionState.java b/telephony/java/android/telephony/PreciseDataConnectionState.java
index 3dbbf4138b02..aee861768209 100644
--- a/telephony/java/android/telephony/PreciseDataConnectionState.java
+++ b/telephony/java/android/telephony/PreciseDataConnectionState.java
@@ -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;
@@ -354,28 +336,6 @@ public final class PreciseDataConnectionState implements Parcelable {
}
/**
- * 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.
*
* @param linkProperties Link properties
@@ -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);
}
}
}