summaryrefslogtreecommitdiff
path: root/voip/java/android/net/sip/SipManager.java
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2010-12-20 19:08:24 +0800
committerHung-ying Tyan <tyanh@google.com>2010-12-21 11:51:03 +0800
commit5bd3782f244212cd8ef51bf9f3578869b08b4e18 (patch)
tree364788179909a427cda113bd2611ed464bfa8de3 /voip/java/android/net/sip/SipManager.java
parentc724f2fba330da275f46586aeb5f0ae7bd2fae99 (diff)
Check if VoIP API is supported in SipManager.
This is to make SipManager.isVoipSupported() effective. Also add NPE check now that we may return null SipAudioCall when VOIP is not supported. Bug: 3251016 Change-Id: Icd551123499f55eef190743b90980922893c4a13
Diffstat (limited to 'voip/java/android/net/sip/SipManager.java')
-rw-r--r--voip/java/android/net/sip/SipManager.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/voip/java/android/net/sip/SipManager.java b/voip/java/android/net/sip/SipManager.java
index 2e38662065e8..dce46fe7ce08 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(),