diff options
author | Hung-ying Tyan <tyanh@google.com> | 2010-09-02 09:56:04 +0800 |
---|---|---|
committer | Hung-ying Tyan <tyanh@google.com> | 2010-09-02 09:56:04 +0800 |
commit | f83d4f1779eb4801275a56023c343459a95009af (patch) | |
tree | 4add9c90e3b09babc77834b85e6dc89b5053def3 /voip | |
parent | 53d7765eac58f496355147f167fb345e825d6d54 (diff) | |
parent | 3e4975a52ccd9dade7fffc9f8c144bff0f4c3cb1 (diff) | |
download | frameworks_base-f83d4f1779eb4801275a56023c343459a95009af.zip frameworks_base-f83d4f1779eb4801275a56023c343459a95009af.tar.gz frameworks_base-f83d4f1779eb4801275a56023c343459a95009af.tar.bz2 |
resolved conflicts for merge of 3e4975a5 to master
Change-Id: Icd382fc43c8a1975801ab42eb184b633520149c7
Diffstat (limited to 'voip')
-rw-r--r-- | voip/java/android/net/sip/SipManager.java | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/voip/java/android/net/sip/SipManager.java b/voip/java/android/net/sip/SipManager.java index 287a13a..40792b9 100644 --- a/voip/java/android/net/sip/SipManager.java +++ b/voip/java/android/net/sip/SipManager.java @@ -18,6 +18,7 @@ package android.net.sip; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; import android.os.IBinder; import android.os.Looper; import android.os.RemoteException; @@ -69,22 +70,36 @@ public class SipManager { private ISipService mSipService; /** - * Creates a manager instance and initializes the background SIP service. - * Will be removed once the SIP service is integrated into framework. + * Gets a manager instance. Returns null if SIP API is not supported. * - * @param context context to start the SIP service - * @return the manager instance + * @param context application context for checking if SIP API is supported + * @return the manager instance or null if SIP API is not supported */ - public static SipManager getInstance(final Context context) { - final SipManager manager = new SipManager(); - manager.createSipService(context); - return manager; + public static SipManager getInstance(Context context) { + return (isApiSupported(context) ? new SipManager() : null); + } + + /** + * Returns true if the SIP API is supported by the system. + */ + public static boolean isApiSupported(Context context) { + return context.getPackageManager().hasSystemFeature( + PackageManager.FEATURE_SIP); + } + + /** + * Returns true if the system supports SIP-based VoIP. + */ + public static boolean isVoipSupported(Context context) { + return context.getPackageManager().hasSystemFeature( + PackageManager.FEATURE_SIP_VOIP) && isApiSupported(context); } private SipManager() { + createSipService(); } - private void createSipService(Context context) { + private void createSipService() { if (mSipService != null) return; IBinder b = ServiceManager.getService(Context.SIP_SERVICE); mSipService = ISipService.Stub.asInterface(b); |