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

Commit 65ba2c42 authored by Chung-yih Wang's avatar Chung-yih Wang Committed by Android (Google) Code Review
Browse files

Merge "Add auth. username in SipProfile." into gingerbread

parents ca36d863 f268a2f8
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
    private String mDomain;
    private String mProtocol = UDP;
    private String mProfileName;
    private String mAuthUserName;
    private int mPort = DEFAULT_PORT;
    private boolean mSendKeepAlive = false;
    private boolean mAutoRegistration = true;
@@ -146,6 +147,18 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
                    : "sip:" + uriString);
        }

        /**
         * Sets the username used for authentication.
         *
         * @param name auth. name of the profile
         * @return this builder object
         * @hide // TODO: remove when we make it public
         */
        public Builder setAuthUserName(String name) {
            mProfile.mAuthUserName = name;
            return this;
        }

        /**
         * Sets the name of the profile. This name is given by user.
         *
@@ -300,6 +313,7 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
        mAutoRegistration = (in.readInt() == 0) ? false : true;
        mCallingUid = in.readInt();
        mPort = in.readInt();
        mAuthUserName = in.readString();
    }

    @Override
@@ -314,6 +328,7 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
        out.writeInt(mAutoRegistration ? 1 : 0);
        out.writeInt(mCallingUid);
        out.writeInt(mPort);
        out.writeString(mAuthUserName);
    }

    @Override
@@ -374,6 +389,17 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
        return getUri().getUser();
    }

    /**
     * Gets the username for authentication. If it is null, then the username
     * should be used in authentication instead.
     *
     * @return the auth. username
     * @hide // TODO: remove when we make it public
     */
    public String getAuthUserName() {
        return mAuthUserName;
    }

    /**
     * Gets the password.
     *
+3 −1
Original line number Diff line number Diff line
@@ -895,7 +895,9 @@ class SipSessionGroup implements SipListener {
                        challengedTransaction, String realm) {
                    return new UserCredentials() {
                        public String getUserName() {
                            return mLocalProfile.getUserName();
                            String username = mLocalProfile.getAuthUserName();
                            return (!TextUtils.isEmpty(username) ? username :
                                    mLocalProfile.getUserName());
                        }

                        public String getPassword() {