Loading voip/java/android/net/sip/SipProfile.java +40 −1 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 = Loading Loading @@ -78,6 +79,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. * Loading Loading @@ -225,6 +243,18 @@ public class SipProfile implements Parcelable, Serializable { return this; } /** * 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. * Loading Loading @@ -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 */ Loading @@ -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 */ Loading Loading @@ -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; } } Loading
voip/java/android/net/sip/SipProfile.java +40 −1 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 = Loading Loading @@ -78,6 +79,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. * Loading Loading @@ -225,6 +243,18 @@ public class SipProfile implements Parcelable, Serializable { return this; } /** * 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. * Loading Loading @@ -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 */ Loading @@ -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 */ Loading Loading @@ -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; } }