From 2636dd435a7054b3101b041ef1570573c04afe96 Mon Sep 17 00:00:00 2001 From: Nathan Harold Date: Tue, 24 Apr 2018 15:41:17 -0700 Subject: [PATCH] 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 --- .../telephony/PhysicalChannelConfig.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/telephony/java/android/telephony/PhysicalChannelConfig.java b/telephony/java/android/telephony/PhysicalChannelConfig.java index ce444dd00ce41..d2001ae6ea0e4 100644 --- a/telephony/java/android/telephony/PhysicalChannelConfig.java +++ b/telephony/java/android/telephony/PhysicalChannelConfig.java @@ -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(); + } }