am 399e4fdc: am 338c4855: Moved the toString method in the parent Connection class.

Merge commit '399e4fdc27592646537582ef922a8c0a8ff9270a'

* commit '399e4fdc27592646537582ef922a8c0a8ff9270a':
  Moved the toString method in the parent Connection class.
This commit is contained in:
Nicolas Catania
2009-09-19 08:13:17 -07:00
committed by Android Git Automerger
3 changed files with 23 additions and 9 deletions

View File

@@ -15,6 +15,7 @@
*/
package com.android.internal.telephony;
import android.util.Log;
/**
* {@hide}
@@ -27,6 +28,7 @@ public abstract class Connection {
public static int PRESENTATION_UNKNOWN = 3; // no specified or unknown by network
public static int PRESENTATION_PAYPHONE = 4; // show pay phone info
private static String LOG_TAG = "TelephonyConnection";
public enum DisconnectCause {
NOT_DISCONNECTED, /* has not yet disconnected */
@@ -269,4 +271,25 @@ public abstract class Connection {
*/
public abstract int getNumberPresentation();
/**
* Build a human representation of a connection instance, suitable for debugging.
* Don't log personal stuff unless in debug mode.
* @return a string representing the internal state of this connection.
*/
public String toString() {
StringBuilder str = new StringBuilder(128);
if (Log.isLoggable(LOG_TAG, Log.DEBUG)) {
str.append("addr: " + getAddress())
.append(" pres.: " + getNumberPresentation())
.append(" dial: " + getOrigDialString())
.append(" postdial: " + getRemainingPostDialString())
.append(" cnap name: " + getCnapName())
.append("(" + getCnapNamePresentation() + ")");
}
str.append(" incoming: " + isIncoming())
.append(" state: " + getState())
.append(" post dial state: " + getPostDialState());
return str.toString();
}
}

View File

@@ -221,10 +221,6 @@ public class CdmaConnection extends Connection {
return isIncoming == c.isMT && equalsHandlesNulls(address, cAddress);
}
public String
toString() {
return (isIncoming ? "incoming" : "outgoing");
}
public String getOrigDialString(){
return dialString;

View File

@@ -180,11 +180,6 @@ public class GsmConnection extends Connection {
return isIncoming == c.isMT && equalsHandlesNulls(address, cAddress);
}
public String
toString() {
return (isIncoming ? "incoming" : "outgoing");
}
public String getAddress() {
return address;
}