am 37f709ae: Merge "SipProfile: add isOutgoingCallAllowed() and new builder constructor" into gingerbread
Merge commit '37f709aeb0424948a8f69577c6fad39dc95d7733' into gingerbread-plus-aosp * commit '37f709aeb0424948a8f69577c6fad39dc95d7733': SipProfile: add isOutgoingCallAllowed() and new builder constructor
This commit is contained in:
@@ -35,7 +35,7 @@ import javax.sip.address.URI;
|
|||||||
* Class containing a SIP account, domain and server information.
|
* Class containing a SIP account, domain and server information.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public class SipProfile implements Parcelable, Serializable {
|
public class SipProfile implements Parcelable, Serializable, Cloneable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final int DEFAULT_PORT = 5060;
|
private static final int DEFAULT_PORT = 5060;
|
||||||
private Address mAddress;
|
private Address mAddress;
|
||||||
@@ -46,6 +46,7 @@ public class SipProfile implements Parcelable, Serializable {
|
|||||||
private String mProfileName;
|
private String mProfileName;
|
||||||
private boolean mSendKeepAlive = false;
|
private boolean mSendKeepAlive = false;
|
||||||
private boolean mAutoRegistration = true;
|
private boolean mAutoRegistration = true;
|
||||||
|
private boolean mAllowOutgoingCall = false;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final Parcelable.Creator<SipProfile> CREATOR =
|
public static final Parcelable.Creator<SipProfile> CREATOR =
|
||||||
@@ -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.
|
* Constructor.
|
||||||
*
|
*
|
||||||
@@ -225,6 +243,18 @@ public class SipProfile implements Parcelable, Serializable {
|
|||||||
return this;
|
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.
|
* Builds and returns the SIP profile object.
|
||||||
*
|
*
|
||||||
@@ -262,6 +292,7 @@ public class SipProfile implements Parcelable, Serializable {
|
|||||||
mProfileName = in.readString();
|
mProfileName = in.readString();
|
||||||
mSendKeepAlive = (in.readInt() == 0) ? false : true;
|
mSendKeepAlive = (in.readInt() == 0) ? false : true;
|
||||||
mAutoRegistration = (in.readInt() == 0) ? false : true;
|
mAutoRegistration = (in.readInt() == 0) ? false : true;
|
||||||
|
mAllowOutgoingCall = (in.readInt() == 0) ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@@ -274,6 +305,7 @@ public class SipProfile implements Parcelable, Serializable {
|
|||||||
out.writeString(mProfileName);
|
out.writeString(mProfileName);
|
||||||
out.writeInt(mSendKeepAlive ? 1 : 0);
|
out.writeInt(mSendKeepAlive ? 1 : 0);
|
||||||
out.writeInt(mAutoRegistration ? 1 : 0);
|
out.writeInt(mAutoRegistration ? 1 : 0);
|
||||||
|
out.writeInt(mAllowOutgoingCall ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@@ -398,4 +430,11 @@ public class SipProfile implements Parcelable, Serializable {
|
|||||||
public boolean getAutoRegistration() {
|
public boolean getAutoRegistration() {
|
||||||
return mAutoRegistration;
|
return mAutoRegistration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if allowing to make outgoing calls on this profile.
|
||||||
|
*/
|
||||||
|
public boolean isOutgoingCallAllowed() {
|
||||||
|
return mAllowOutgoingCall;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user