Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 338c4855 authored by Nicolas Catania's avatar Nicolas Catania
Browse files

Moved the toString method in the parent Connection class.

Beefed up the output to get more info in the logs about
a connection.
Personal data is only logged at debug level.
parent ba9bf79d
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -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();
    }
}
+0 −4
Original line number Diff line number Diff line
@@ -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;
+0 −5
Original line number Diff line number Diff line
@@ -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;
    }