Added transport type and id in precise data connection state am: b5d6274622 am: dfd397ba5f am: 2ba154c8c9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1436355 Change-Id: I4cac7d743ff897a4d68fc76646dd110299807c0c
This commit is contained in:
@@ -47830,6 +47830,7 @@ package android.telephony {
|
|||||||
method @Nullable public android.net.LinkProperties getLinkProperties();
|
method @Nullable public android.net.LinkProperties getLinkProperties();
|
||||||
method public int getNetworkType();
|
method public int getNetworkType();
|
||||||
method public int getState();
|
method public int getState();
|
||||||
|
method public int getTransportType();
|
||||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||||
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PreciseDataConnectionState> CREATOR;
|
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PreciseDataConnectionState> CREATOR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10838,6 +10838,7 @@ package android.telephony {
|
|||||||
method @Deprecated public int getDataConnectionApnTypeBitMask();
|
method @Deprecated public int getDataConnectionApnTypeBitMask();
|
||||||
method @Deprecated public int getDataConnectionFailCause();
|
method @Deprecated public int getDataConnectionFailCause();
|
||||||
method @Deprecated public int getDataConnectionState();
|
method @Deprecated public int getDataConnectionState();
|
||||||
|
method public int getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class PreciseDisconnectCause {
|
public final class PreciseDisconnectCause {
|
||||||
|
|||||||
@@ -45998,6 +45998,7 @@ package android.telephony {
|
|||||||
method @Nullable public android.net.LinkProperties getLinkProperties();
|
method @Nullable public android.net.LinkProperties getLinkProperties();
|
||||||
method public int getNetworkType();
|
method public int getNetworkType();
|
||||||
method public int getState();
|
method public int getState();
|
||||||
|
method public int getTransportType();
|
||||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||||
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PreciseDataConnectionState> CREATOR;
|
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PreciseDataConnectionState> CREATOR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9720,6 +9720,7 @@ package android.telephony {
|
|||||||
method @Deprecated public int getDataConnectionApnTypeBitMask();
|
method @Deprecated public int getDataConnectionApnTypeBitMask();
|
||||||
method @Deprecated public int getDataConnectionFailCause();
|
method @Deprecated public int getDataConnectionFailCause();
|
||||||
method @Deprecated public int getDataConnectionState();
|
method @Deprecated public int getDataConnectionState();
|
||||||
|
method public int getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class PreciseDisconnectCause {
|
public final class PreciseDisconnectCause {
|
||||||
|
|||||||
@@ -316,6 +316,7 @@ package android.telephony {
|
|||||||
method @Deprecated public int getDataConnectionApnTypeBitMask();
|
method @Deprecated public int getDataConnectionApnTypeBitMask();
|
||||||
method @Deprecated public int getDataConnectionFailCause();
|
method @Deprecated public int getDataConnectionFailCause();
|
||||||
method @Deprecated public int getDataConnectionState();
|
method @Deprecated public int getDataConnectionState();
|
||||||
|
method public int getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class PreciseDisconnectCause {
|
public final class PreciseDisconnectCause {
|
||||||
|
|||||||
@@ -28,11 +28,13 @@ import android.net.LinkProperties;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
import android.telephony.AccessNetworkConstants.TransportType;
|
||||||
import android.telephony.Annotation.ApnType;
|
import android.telephony.Annotation.ApnType;
|
||||||
import android.telephony.Annotation.DataFailureCause;
|
import android.telephony.Annotation.DataFailureCause;
|
||||||
import android.telephony.Annotation.DataState;
|
import android.telephony.Annotation.DataState;
|
||||||
import android.telephony.Annotation.NetworkType;
|
import android.telephony.Annotation.NetworkType;
|
||||||
import android.telephony.data.ApnSetting;
|
import android.telephony.data.ApnSetting;
|
||||||
|
import android.telephony.data.DataCallResponse;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -53,6 +55,8 @@ import java.util.Objects;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class PreciseDataConnectionState implements Parcelable {
|
public final class PreciseDataConnectionState implements Parcelable {
|
||||||
|
private final @TransportType int mTransportType;
|
||||||
|
private final int mId;
|
||||||
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;
|
||||||
@@ -74,16 +78,19 @@ 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, linkProperties, failCause, new ApnSetting.Builder()
|
this(AccessNetworkConstants.TRANSPORT_TYPE_INVALID, -1, state, networkType,
|
||||||
.setApnTypeBitmask(apnTypes)
|
linkProperties, failCause, new ApnSetting.Builder()
|
||||||
.setApnName(apn)
|
.setApnTypeBitmask(apnTypes)
|
||||||
.build());
|
.setApnName(apn)
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor of PreciseDataConnectionState
|
* Constructor of PreciseDataConnectionState
|
||||||
*
|
*
|
||||||
|
* @param transportType The transport of the data connection
|
||||||
|
* @param id The id of the data connection
|
||||||
* @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 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
|
||||||
@@ -92,11 +99,12 @@ public final class PreciseDataConnectionState implements Parcelable {
|
|||||||
* @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
|
||||||
*/
|
*/
|
||||||
private PreciseDataConnectionState(@DataState int state,
|
private PreciseDataConnectionState(@TransportType int transportType, int id,
|
||||||
@NetworkType int networkType,
|
@DataState int state, @NetworkType int networkType,
|
||||||
@Nullable LinkProperties linkProperties,
|
@Nullable LinkProperties linkProperties, @DataFailureCause int failCause,
|
||||||
@DataFailureCause int failCause,
|
@Nullable ApnSetting apnSetting) {
|
||||||
@Nullable ApnSetting apnSetting) {
|
mTransportType = transportType;
|
||||||
|
mId = id;
|
||||||
mState = state;
|
mState = state;
|
||||||
mNetworkType = networkType;
|
mNetworkType = networkType;
|
||||||
mLinkProperties = linkProperties;
|
mLinkProperties = linkProperties;
|
||||||
@@ -110,6 +118,8 @@ public final class PreciseDataConnectionState implements Parcelable {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
private PreciseDataConnectionState(Parcel in) {
|
private PreciseDataConnectionState(Parcel in) {
|
||||||
|
mTransportType = in.readInt();
|
||||||
|
mId = in.readInt();
|
||||||
mState = in.readInt();
|
mState = in.readInt();
|
||||||
mNetworkType = in.readInt();
|
mNetworkType = in.readInt();
|
||||||
mLinkProperties = in.readParcelable(LinkProperties.class.getClassLoader());
|
mLinkProperties = in.readParcelable(LinkProperties.class.getClassLoader());
|
||||||
@@ -144,7 +154,29 @@ public final class PreciseDataConnectionState implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the high-level state of this data connection.
|
* @return The transport type of this data connection.
|
||||||
|
*/
|
||||||
|
public @TransportType int getTransportType() {
|
||||||
|
return mTransportType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The unique id of the data connection
|
||||||
|
*
|
||||||
|
* Note this is the id assigned in {@link DataCallResponse}.
|
||||||
|
* The id remains the same for data connection handover between
|
||||||
|
* {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN} and
|
||||||
|
* {@link AccessNetworkConstants#TRANSPORT_TYPE_WWAN}
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
public int getId() {
|
||||||
|
return mId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The high-level state of this data connection.
|
||||||
*/
|
*/
|
||||||
public @DataState int getState() {
|
public @DataState int getState() {
|
||||||
return mState;
|
return mState;
|
||||||
@@ -235,6 +267,8 @@ public final class PreciseDataConnectionState implements Parcelable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(@NonNull Parcel out, int flags) {
|
public void writeToParcel(@NonNull Parcel out, int flags) {
|
||||||
|
out.writeInt(mTransportType);
|
||||||
|
out.writeInt(mId);
|
||||||
out.writeInt(mState);
|
out.writeInt(mState);
|
||||||
out.writeInt(mNetworkType);
|
out.writeInt(mNetworkType);
|
||||||
out.writeParcelable(mLinkProperties, flags);
|
out.writeParcelable(mLinkProperties, flags);
|
||||||
@@ -256,7 +290,8 @@ public final class PreciseDataConnectionState implements Parcelable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mState, mNetworkType, mFailCause, mLinkProperties, mApnSetting);
|
return Objects.hash(mTransportType, mId, mState, mNetworkType, mFailCause,
|
||||||
|
mLinkProperties, mApnSetting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -265,7 +300,9 @@ public final class PreciseDataConnectionState implements Parcelable {
|
|||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
PreciseDataConnectionState that = (PreciseDataConnectionState) o;
|
PreciseDataConnectionState that = (PreciseDataConnectionState) o;
|
||||||
return mState == that.mState
|
return mTransportType == that.mTransportType
|
||||||
|
&& mId == that.mId
|
||||||
|
&& mState == that.mState
|
||||||
&& mNetworkType == that.mNetworkType
|
&& mNetworkType == that.mNetworkType
|
||||||
&& mFailCause == that.mFailCause
|
&& mFailCause == that.mFailCause
|
||||||
&& Objects.equals(mLinkProperties, that.mLinkProperties)
|
&& Objects.equals(mLinkProperties, that.mLinkProperties)
|
||||||
@@ -278,6 +315,9 @@ public final class PreciseDataConnectionState implements Parcelable {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append("Data Connection state: " + mState);
|
sb.append("Data Connection state: " + mState);
|
||||||
|
sb.append(", Transport type: "
|
||||||
|
+ AccessNetworkConstants.transportTypeToString(mTransportType));
|
||||||
|
sb.append(", Id: " + mId);
|
||||||
sb.append(", Network type: " + mNetworkType);
|
sb.append(", Network type: " + mNetworkType);
|
||||||
sb.append(", APN types: " + ApnSetting.getApnTypesStringFromBitmask(
|
sb.append(", APN types: " + ApnSetting.getApnTypesStringFromBitmask(
|
||||||
getDataConnectionApnTypeBitMask()));
|
getDataConnectionApnTypeBitMask()));
|
||||||
@@ -295,6 +335,15 @@ public final class PreciseDataConnectionState implements Parcelable {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
|
/** The transport type of the data connection */
|
||||||
|
private @TransportType int mTransportType = AccessNetworkConstants.TRANSPORT_TYPE_INVALID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unique ID of the data connection. This is the id assigned in
|
||||||
|
* {@link DataCallResponse)}.
|
||||||
|
*/
|
||||||
|
private int mId = -1;
|
||||||
|
|
||||||
/** The state of the data connection */
|
/** The state of the data connection */
|
||||||
private @DataState int mState = TelephonyManager.DATA_UNKNOWN;
|
private @DataState int mState = TelephonyManager.DATA_UNKNOWN;
|
||||||
|
|
||||||
@@ -313,13 +362,35 @@ public final class PreciseDataConnectionState implements Parcelable {
|
|||||||
/** The APN Setting for this data connection */
|
/** The APN Setting for this data connection */
|
||||||
private @Nullable ApnSetting mApnSetting = null;
|
private @Nullable ApnSetting mApnSetting = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the transport type of the data connection.
|
||||||
|
*
|
||||||
|
* @param transportType The transport type of the data connection
|
||||||
|
* @return The builder
|
||||||
|
*/
|
||||||
|
public @NonNull Builder setTransportType(@TransportType int transportType) {
|
||||||
|
mTransportType = transportType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the id of the data connection.
|
||||||
|
*
|
||||||
|
* @param id The id of the data connection
|
||||||
|
* @return The builder
|
||||||
|
*/
|
||||||
|
public @NonNull Builder setId(int id) {
|
||||||
|
mId = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the state of the data connection.
|
* Set the state of the data connection.
|
||||||
*
|
*
|
||||||
* @param state The state of the data connection
|
* @param state The state of the data connection
|
||||||
* @return The builder
|
* @return The builder
|
||||||
*/
|
*/
|
||||||
public Builder setState(@DataState int state) {
|
public @NonNull Builder setState(@DataState int state) {
|
||||||
mState = state;
|
mState = state;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -330,7 +401,7 @@ public final class PreciseDataConnectionState implements Parcelable {
|
|||||||
* @param networkType The network type
|
* @param networkType The network type
|
||||||
* @return The builder
|
* @return The builder
|
||||||
*/
|
*/
|
||||||
public Builder setNetworkType(@NetworkType int networkType) {
|
public @NonNull Builder setNetworkType(@NetworkType int networkType) {
|
||||||
mNetworkType = networkType;
|
mNetworkType = networkType;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -341,7 +412,7 @@ public final class PreciseDataConnectionState implements Parcelable {
|
|||||||
* @param linkProperties Link properties
|
* @param linkProperties Link properties
|
||||||
* @return The builder
|
* @return The builder
|
||||||
*/
|
*/
|
||||||
public Builder setLinkProperties(@NonNull LinkProperties linkProperties) {
|
public @NonNull Builder setLinkProperties(LinkProperties linkProperties) {
|
||||||
mLinkProperties = linkProperties;
|
mLinkProperties = linkProperties;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -353,7 +424,7 @@ public final class PreciseDataConnectionState implements Parcelable {
|
|||||||
* error code indicating the cause of the failure.
|
* error code indicating the cause of the failure.
|
||||||
* @return The builder
|
* @return The builder
|
||||||
*/
|
*/
|
||||||
public Builder setFailCause(@DataFailureCause int failCause) {
|
public @NonNull Builder setFailCause(@DataFailureCause int failCause) {
|
||||||
mFailCause = failCause;
|
mFailCause = failCause;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -364,7 +435,7 @@ public final class PreciseDataConnectionState implements Parcelable {
|
|||||||
* @param apnSetting APN setting
|
* @param apnSetting APN setting
|
||||||
* @return This builder
|
* @return This builder
|
||||||
*/
|
*/
|
||||||
public Builder setApnSetting(@NonNull ApnSetting apnSetting) {
|
public @NonNull Builder setApnSetting(@NonNull ApnSetting apnSetting) {
|
||||||
mApnSetting = apnSetting;
|
mApnSetting = apnSetting;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -375,8 +446,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, mLinkProperties, mFailCause,
|
return new PreciseDataConnectionState(mTransportType, mId, mState, mNetworkType,
|
||||||
mApnSetting);
|
mLinkProperties, mFailCause, mApnSetting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user