Merge "Shorten the output of NetworkAgentInfo#toString()." am: d498a01647 am: d268beb59d
Change-Id: I4fb9efa69133ce8f960a37cfbb73264a4bfbf97a
This commit is contained in:
@@ -22,6 +22,7 @@ import android.compat.annotation.UnsupportedAppUsage;
|
|||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.telephony.Annotation.NetworkType;
|
import android.telephony.Annotation.NetworkType;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
|
|
||||||
@@ -538,7 +539,7 @@ public class NetworkInfo implements Parcelable {
|
|||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
StringBuilder builder = new StringBuilder("[");
|
final StringBuilder builder = new StringBuilder("[");
|
||||||
builder.append("type: ").append(getTypeName()).append("[").append(getSubtypeName()).
|
builder.append("type: ").append(getTypeName()).append("[").append(getSubtypeName()).
|
||||||
append("], state: ").append(mState).append("/").append(mDetailedState).
|
append("], state: ").append(mState).append("/").append(mDetailedState).
|
||||||
append(", reason: ").append(mReason == null ? "(unspecified)" : mReason).
|
append(", reason: ").append(mReason == null ? "(unspecified)" : mReason).
|
||||||
@@ -551,6 +552,32 @@ public class NetworkInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a brief summary string suitable for debugging.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public String toShortString() {
|
||||||
|
synchronized (this) {
|
||||||
|
final StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append(getTypeName());
|
||||||
|
|
||||||
|
final String subtype = getSubtypeName();
|
||||||
|
if (!TextUtils.isEmpty(subtype)) {
|
||||||
|
builder.append("[").append(subtype).append("]");
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.append(" ");
|
||||||
|
builder.append(mDetailedState);
|
||||||
|
if (mIsRoaming) {
|
||||||
|
builder.append(" ROAMING");
|
||||||
|
}
|
||||||
|
if (mExtraInfo != null) {
|
||||||
|
builder.append(" extra: ").append(mExtraInfo);
|
||||||
|
}
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -621,22 +621,23 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> {
|
|||||||
for (LingerTimer timer : mLingerTimers) { pw.println(timer); }
|
for (LingerTimer timer : mLingerTimers) { pw.println(timer); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Print shorter members first and only print the boolean variable which value is true
|
|
||||||
// to improve readability.
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "NetworkAgentInfo{ ni{" + networkInfo + "} "
|
return "NetworkAgentInfo{"
|
||||||
+ "network{" + network + "} nethandle{" + network.getNetworkHandle() + "} "
|
+ "network{" + network + "} handle{" + network.getNetworkHandle() + "} ni{"
|
||||||
+ "lp{" + linkProperties + "} "
|
+ networkInfo.toShortString() + "} "
|
||||||
+ "nc{" + networkCapabilities + "} Score{" + getCurrentScore() + "} "
|
+ " Score{" + getCurrentScore() + "} "
|
||||||
+ "everValidated{" + everValidated + "} lastValidated{" + lastValidated + "} "
|
+ (isLingering() ? " lingering" : "")
|
||||||
+ "created{" + created + "} lingering{" + isLingering() + "} "
|
+ (everValidated ? " everValidated" : "")
|
||||||
+ "explicitlySelected{" + networkAgentConfig.explicitlySelected + "} "
|
+ (lastValidated ? " lastValidated" : "")
|
||||||
+ "acceptUnvalidated{" + networkAgentConfig.acceptUnvalidated + "} "
|
+ (partialConnectivity ? " partialConnectivity" : "")
|
||||||
+ "everCaptivePortalDetected{" + everCaptivePortalDetected + "} "
|
+ (everCaptivePortalDetected ? " everCaptivePortal" : "")
|
||||||
+ "lastCaptivePortalDetected{" + lastCaptivePortalDetected + "} "
|
+ (lastCaptivePortalDetected ? " isCaptivePortal" : "")
|
||||||
+ "partialConnectivity{" + partialConnectivity + "} "
|
+ (networkAgentConfig.explicitlySelected ? " explicitlySelected" : "")
|
||||||
+ "acceptPartialConnectivity{" + networkAgentConfig.acceptPartialConnectivity + "} "
|
+ (networkAgentConfig.acceptUnvalidated ? " acceptUnvalidated" : "")
|
||||||
+ "clat{" + clatd + "} "
|
+ (networkAgentConfig.acceptPartialConnectivity ? " acceptPartialConnectivity" : "")
|
||||||
|
+ (clatd.isStarted() ? " clat{" + clatd + "} " : "")
|
||||||
|
+ " lp{" + linkProperties + "}"
|
||||||
|
+ " nc{" + networkCapabilities + "}"
|
||||||
+ "}";
|
+ "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user