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-07 15:21:54 +0800 |
commit | f268a2f8488b6b111126a7043a5f1f559a566fa7 (patch) | |
tree | cf8cb2f768f77b6309d046ec17bd73e787647d10 /voip/java | |
parent | 9ffb0a0df3a97115234bd50a73ca60efcefb4ef7 (diff) | |
download | frameworks_base-f268a2f8488b6b111126a7043a5f1f559a566fa7.zip frameworks_base-f268a2f8488b6b111126a7043a5f1f559a566fa7.tar.gz frameworks_base-f268a2f8488b6b111126a7043a5f1f559a566fa7.tar.bz2 |
Add auth. username in SipProfile.
bug:3326867
Change-Id: I2a62c75fb3f5e9c6ec2e00b29396e93b0c183d9b
Diffstat (limited to 'voip/java')
-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() { |