diff options
author | Hung-ying Tyan <tyanh@google.com> | 2010-08-24 23:57:50 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-24 23:57:50 -0700 |
commit | 37f709aeb0424948a8f69577c6fad39dc95d7733 (patch) | |
tree | f3dd08708cc7e90d3398f9a4b1a55e7bc24dda46 /voip | |
parent | bfc9325f8981173db51bc46af0e762dad1341671 (diff) | |
parent | cf95f5d26363d4cd3815d31f5798f932a7720c17 (diff) | |
download | frameworks_base-37f709aeb0424948a8f69577c6fad39dc95d7733.zip frameworks_base-37f709aeb0424948a8f69577c6fad39dc95d7733.tar.gz frameworks_base-37f709aeb0424948a8f69577c6fad39dc95d7733.tar.bz2 |
Merge "SipProfile: add isOutgoingCallAllowed() and new builder constructor" into gingerbread
Diffstat (limited to 'voip')
-rw-r--r-- | voip/java/android/net/sip/SipProfile.java | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/voip/java/android/net/sip/SipProfile.java b/voip/java/android/net/sip/SipProfile.java index e71c293..ec8d0ed 100644 --- a/voip/java/android/net/sip/SipProfile.java +++ b/voip/java/android/net/sip/SipProfile.java @@ -35,7 +35,7 @@ import javax.sip.address.URI; * Class containing a SIP account, domain and server information. * @hide */ -public class SipProfile implements Parcelable, Serializable { +public class SipProfile implements Parcelable, Serializable, Cloneable { private static final long serialVersionUID = 1L; private static final int DEFAULT_PORT = 5060; private Address mAddress; @@ -46,6 +46,7 @@ public class SipProfile implements Parcelable, Serializable { private String mProfileName; private boolean mSendKeepAlive = false; private boolean mAutoRegistration = true; + private boolean mAllowOutgoingCall = false; /** @hide */ public static final Parcelable.Creator<SipProfile> CREATOR = @@ -79,6 +80,23 @@ public class SipProfile implements Parcelable, Serializable { } /** + * Creates a builder based on the given profile. + */ + public Builder(SipProfile profile) { + if (profile == null) throw new NullPointerException(); + try { + mProfile = (SipProfile) profile.clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeException("should not occur", e); + } + mProfile.mAddress = null; + mUri = profile.getUri(); + mUri.setUserPassword(profile.getPassword()); + mDisplayName = profile.getDisplayName(); + mProxyAddress = profile.getProxyAddress(); + } + + /** * Constructor. * * @param uriString the URI string as "sip:<user_name>@<domain>" @@ -226,6 +244,18 @@ public class SipProfile implements Parcelable, Serializable { } /** + * Sets the allow-outgoing-call flag. + * + * @param flag true if allowing to make outgoing call on the profile; + * false otherwise + * @return this builder object + */ + public Builder setOutgoingCallAllowed(boolean flag) { + mProfile.mAllowOutgoingCall = flag; + return this; + } + + /** * Builds and returns the SIP profile object. * * @return the profile object created @@ -262,6 +292,7 @@ public class SipProfile implements Parcelable, Serializable { mProfileName = in.readString(); mSendKeepAlive = (in.readInt() == 0) ? false : true; mAutoRegistration = (in.readInt() == 0) ? false : true; + mAllowOutgoingCall = (in.readInt() == 0) ? false : true; } /** @hide */ @@ -274,6 +305,7 @@ public class SipProfile implements Parcelable, Serializable { out.writeString(mProfileName); out.writeInt(mSendKeepAlive ? 1 : 0); out.writeInt(mAutoRegistration ? 1 : 0); + out.writeInt(mAllowOutgoingCall ? 1 : 0); } /** @hide */ @@ -398,4 +430,11 @@ public class SipProfile implements Parcelable, Serializable { public boolean getAutoRegistration() { return mAutoRegistration; } + + /** + * Returns true if allowing to make outgoing calls on this profile. + */ + public boolean isOutgoingCallAllowed() { + return mAllowOutgoingCall; + } } |