diff options
author | Chung-yih Wang <cywang@google.com> | 2011-01-06 18:44:43 +0800 |
---|---|---|
committer | Chung-yih Wang <cywang@google.com> | 2011-01-12 11:43:27 +0800 |
commit | 0f7de88cb9eef781117fa2f2b69ba2698237637e (patch) | |
tree | f6c4cc438f5b1dc814c7868021e0dc3990f82b6a /voip | |
parent | 5220834c6ccdabf949dfe7160548ad378850d71b (diff) | |
download | frameworks_base-0f7de88cb9eef781117fa2f2b69ba2698237637e.zip frameworks_base-0f7de88cb9eef781117fa2f2b69ba2698237637e.tar.gz frameworks_base-0f7de88cb9eef781117fa2f2b69ba2698237637e.tar.bz2 |
Merge "Add auth. username in SipProfile." from gingerbread.
bug:3326867
Change-Id: Ic67dd7d4858f28224e4f01ad8b65bcd3a3c15f10
Diffstat (limited to 'voip')
-rw-r--r-- | voip/java/android/net/sip/SipProfile.java | 26 | ||||
-rw-r--r-- | voip/java/com/android/server/sip/SipSessionGroup.java | 4 |
2 files changed, 29 insertions, 1 deletions
diff --git a/voip/java/android/net/sip/SipProfile.java b/voip/java/android/net/sip/SipProfile.java index f8fd2b7..c7e18df 100644 --- a/voip/java/android/net/sip/SipProfile.java +++ b/voip/java/android/net/sip/SipProfile.java @@ -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; @@ -147,6 +148,18 @@ public class SipProfile implements Parcelable, Serializable, Cloneable { } /** + * 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. * * @param name name of the profile @@ -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 @@ -375,6 +390,17 @@ public class SipProfile implements Parcelable, Serializable, Cloneable { } /** + * 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. * * @return the password diff --git a/voip/java/com/android/server/sip/SipSessionGroup.java b/voip/java/com/android/server/sip/SipSessionGroup.java index 3275317..aa616a9 100644 --- a/voip/java/com/android/server/sip/SipSessionGroup.java +++ b/voip/java/com/android/server/sip/SipSessionGroup.java @@ -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() { |