Add toString() method to PhysicalChannelConfig

We need to be able to print the PhysicalChannelConfig
for debugging/dumping, so adding a toString() method
to print in a format that we can easily digest and
is consistent with other Telephony log formatting.

Bug: 78791811
Test: manual / TelephonyDebugMenu
Change-Id: Ieb12f78a821369072ca9f03d28b28759836f84b4
This commit is contained in:
Nathan Harold
2018-04-24 15:41:17 -07:00
parent c9bad6ef7a
commit 2636dd435a

View File

@@ -99,6 +99,20 @@ public final class PhysicalChannelConfig implements Parcelable {
return mCellConnectionStatus;
}
/** @return String representation of the connection status */
private String getConnectionStatusString() {
switch(mCellConnectionStatus) {
case CONNECTION_PRIMARY_SERVING:
return "PrimaryServing";
case CONNECTION_SECONDARY_SERVING:
return "SecondaryServing";
case CONNECTION_UNKNOWN:
return "Unknown";
default:
return "Invalid(" + mCellConnectionStatus + ")";
}
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -129,4 +143,15 @@ public final class PhysicalChannelConfig implements Parcelable {
return new PhysicalChannelConfig[size];
}
};
@Override
public String toString() {
return new StringBuilder()
.append("{mConnectionStatus=")
.append(getConnectionStatusString())
.append(",mCellBandwidthDownlinkKhz=")
.append(mCellBandwidthDownlinkKhz)
.append("}")
.toString();
}
}