summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2010-08-09 19:52:28 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-08-09 19:52:28 -0700
commit8b8b4536314d1354c244af2c9e665c4db4e27522 (patch)
tree340c5f84a1a570ce8f7dae69c2bf348682f0013d /telephony
parent51128faa8cf1f3d25ee7db745b9e18e69e04cd31 (diff)
parent8fb2e6e4720385961083a150a3e848ccaef544ae (diff)
downloadframeworks_base-8b8b4536314d1354c244af2c9e665c4db4e27522.zip
frameworks_base-8b8b4536314d1354c244af2c9e665c4db4e27522.tar.gz
frameworks_base-8b8b4536314d1354c244af2c9e665c4db4e27522.tar.bz2
am 8fb2e6e4: PhoneFactory: add makeSipPhone()
Merge commit '8fb2e6e4720385961083a150a3e848ccaef544ae' into gingerbread-plus-aosp * commit '8fb2e6e4720385961083a150a3e848ccaef544ae': PhoneFactory: add makeSipPhone()
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/com/android/internal/telephony/PhoneFactory.java11
-rw-r--r--telephony/java/com/android/internal/telephony/sip/SipPhoneFactory.java46
2 files changed, 25 insertions, 32 deletions
diff --git a/telephony/java/com/android/internal/telephony/PhoneFactory.java b/telephony/java/com/android/internal/telephony/PhoneFactory.java
index 803b736..2e391cb 100644
--- a/telephony/java/com/android/internal/telephony/PhoneFactory.java
+++ b/telephony/java/com/android/internal/telephony/PhoneFactory.java
@@ -24,6 +24,8 @@ import android.util.Log;
import com.android.internal.telephony.cdma.CDMAPhone;
import com.android.internal.telephony.gsm.GSMPhone;
+import com.android.internal.telephony.sip.SipPhone;
+import com.android.internal.telephony.sip.SipPhoneFactory;
/**
* {@hide}
@@ -175,4 +177,13 @@ public class PhoneFactory {
return phone;
}
}
+
+ /**
+ * Makes a {@link SipPhone} object.
+ * @param sipUri the local SIP URI the phone runs on
+ * @return the {@code SipPhone} object or null if the SIP URI is not valid
+ */
+ public static SipPhone makeSipPhone(String sipUri) {
+ return SipPhoneFactory.makePhone(sipUri, sContext, sPhoneNotifier);
+ }
}
diff --git a/telephony/java/com/android/internal/telephony/sip/SipPhoneFactory.java b/telephony/java/com/android/internal/telephony/sip/SipPhoneFactory.java
index c9e9762..a1bdd2f 100644
--- a/telephony/java/com/android/internal/telephony/sip/SipPhoneFactory.java
+++ b/telephony/java/com/android/internal/telephony/sip/SipPhoneFactory.java
@@ -16,7 +16,6 @@
package com.android.internal.telephony.sip;
-import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneNotifier;
import android.content.Context;
@@ -26,42 +25,25 @@ import android.util.Log;
import java.text.ParseException;
/**
- * @hide
+ * {@hide}
*/
public class SipPhoneFactory {
- private static PhoneNotifier sPhoneNotifier = makeDefaultPhoneNotifier();
- private static Context sContext;
-
- public static void makeDefaultPhones(Context context) {
- makeDefaultPhone(context);
- }
-
- public static void makeDefaultPhone(Context context) {
- sContext = context;
- SipPhoneProxy.getInstance().setPhone(
- makePhone("sip:anonymous@localhost"));
- }
-
- public static Phone getDefaultPhone() {
- return SipPhoneProxy.getInstance();
- }
-
- public static SipPhone makePhone(String sipProfileUri) {
+ /**
+ * Makes a {@link SipPhone} object.
+ * @param sipUri the local SIP URI the phone runs on
+ * @param context {@code Context} needed to create a Phone object
+ * @param phoneNotifier {@code PhoneNotifier} needed to create a Phone
+ * object
+ * @return the {@code SipPhone} object or null if the SIP URI is not valid
+ */
+ public static SipPhone makePhone(String sipUri, Context context,
+ PhoneNotifier phoneNotifier) {
try {
- SipProfile profile = new SipProfile.Builder(sipProfileUri).build();
- return new SipPhone(sContext, sPhoneNotifier, profile);
+ SipProfile profile = new SipProfile.Builder(sipUri).build();
+ return new SipPhone(context, phoneNotifier, profile);
} catch (ParseException e) {
- Log.v("SipPhoneProxy", "setPhone", e);
+ Log.w("SipPhoneProxy", "setPhone", e);
return null;
}
}
-
- private static PhoneNotifier makeDefaultPhoneNotifier() {
- try {
- return new com.android.internal.telephony.SipPhoneNotifier();
- } catch (Error e) {
- Log.e("SipPhoneProxy", "makeDefaultPhoneNotifier", e);
- throw e;
- }
- }
}