summaryrefslogtreecommitdiffstats
path: root/voip
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2010-12-22 11:35:14 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2010-12-22 11:35:14 -0800
commit33808c6d2448bbc944905819c213f2debf18af5a (patch)
treec0877297ac559f07122c98dca19990b395d01b1d /voip
parentefe5bd77eb2a883c57912a0b4dbed122840f1fdd (diff)
parentaec9a33f1cfc7c32690bc8e24aefaeb137ab9859 (diff)
downloadframeworks_base-33808c6d2448bbc944905819c213f2debf18af5a.zip
frameworks_base-33808c6d2448bbc944905819c213f2debf18af5a.tar.gz
frameworks_base-33808c6d2448bbc944905819c213f2debf18af5a.tar.bz2
am aec9a33f: am e0bd2688: Merge "Check if VoIP API is supported in SipManager." into gingerbread
* commit 'aec9a33f1cfc7c32690bc8e24aefaeb137ab9859': Check if VoIP API is supported in SipManager.
Diffstat (limited to 'voip')
-rw-r--r--voip/java/android/net/sip/SipAudioCall.java20
-rw-r--r--voip/java/android/net/sip/SipManager.java16
2 files changed, 31 insertions, 5 deletions
diff --git a/voip/java/android/net/sip/SipAudioCall.java b/voip/java/android/net/sip/SipAudioCall.java
index 51236fe..ce18ec5 100644
--- a/voip/java/android/net/sip/SipAudioCall.java
+++ b/voip/java/android/net/sip/SipAudioCall.java
@@ -519,10 +519,15 @@ public class SipAudioCall {
* @param session the session that receives the incoming call
* @param sessionDescription the session description of the incoming call
* @throws SipException if the SIP service fails to attach this object to
- * the session
+ * the session or VOIP API is not supported by the device
+ * @see SipManager#isVoipSupported
*/
public void attachCall(SipSession session, String sessionDescription)
throws SipException {
+ if (!SipManager.isVoipSupported(mContext)) {
+ throw new SipException("VOIP API is not supported");
+ }
+
synchronized (this) {
mSipSession = session;
mPeerSd = sessionDescription;
@@ -548,10 +553,15 @@ public class SipAudioCall {
* SIP protocol) is used if {@code timeout} is zero or negative.
* @see Listener#onError
* @throws SipException if the SIP service fails to create a session for the
- * call
+ * call or VOIP API is not supported by the device
+ * @see SipManager#isVoipSupported
*/
public void makeCall(SipProfile peerProfile, SipSession sipSession,
int timeout) throws SipException {
+ if (!SipManager.isVoipSupported(mContext)) {
+ throw new SipException("VOIP API is not supported");
+ }
+
synchronized (this) {
mSipSession = sipSession;
try {
@@ -595,6 +605,9 @@ public class SipAudioCall {
public void holdCall(int timeout) throws SipException {
synchronized (this) {
if (mHold) return;
+ if (mSipSession == null) {
+ throw new SipException("Not in a call to hold call");
+ }
mSipSession.changeCall(createHoldOffer().encode(), timeout);
mHold = true;
setAudioGroupMode();
@@ -614,6 +627,9 @@ public class SipAudioCall {
*/
public void answerCall(int timeout) throws SipException {
synchronized (this) {
+ if (mSipSession == null) {
+ throw new SipException("No call to answer");
+ }
try {
mAudioStream = new AudioStream(InetAddress.getByName(
getLocalIp()));
diff --git a/voip/java/android/net/sip/SipManager.java b/voip/java/android/net/sip/SipManager.java
index 2e38662..dce46fe 100644
--- a/voip/java/android/net/sip/SipManager.java
+++ b/voip/java/android/net/sip/SipManager.java
@@ -133,7 +133,7 @@ public class SipManager {
}
/**
- * Returns true if the system supports SIP-based VoIP.
+ * Returns true if the system supports SIP-based VOIP API.
*/
public static boolean isVoipSupported(Context context) {
return context.getPackageManager().hasSystemFeature(
@@ -305,12 +305,17 @@ public class SipManager {
* @param timeout the timeout value in seconds. Default value (defined by
* SIP protocol) is used if {@code timeout} is zero or negative.
* @return a {@link SipAudioCall} object
- * @throws SipException if calling the SIP service results in an error
+ * @throws SipException if calling the SIP service results in an error or
+ * VOIP API is not supported by the device
* @see SipAudioCall.Listener#onError
+ * @see #isVoipSupported
*/
public SipAudioCall makeAudioCall(SipProfile localProfile,
SipProfile peerProfile, SipAudioCall.Listener listener, int timeout)
throws SipException {
+ if (!isVoipSupported(mContext)) {
+ throw new SipException("VOIP API is not supported");
+ }
SipAudioCall call = new SipAudioCall(mContext, localProfile);
call.setListener(listener);
SipSession s = createSipSession(localProfile, null);
@@ -332,12 +337,17 @@ public class SipManager {
* @param timeout the timeout value in seconds. Default value (defined by
* SIP protocol) is used if {@code timeout} is zero or negative.
* @return a {@link SipAudioCall} object
- * @throws SipException if calling the SIP service results in an error
+ * @throws SipException if calling the SIP service results in an error or
+ * VOIP API is not supported by the device
* @see SipAudioCall.Listener#onError
+ * @see #isVoipSupported
*/
public SipAudioCall makeAudioCall(String localProfileUri,
String peerProfileUri, SipAudioCall.Listener listener, int timeout)
throws SipException {
+ if (!isVoipSupported(mContext)) {
+ throw new SipException("VOIP API is not supported");
+ }
try {
return makeAudioCall(
new SipProfile.Builder(localProfileUri).build(),