Move non telecomm schemes to ContactsUtils
Pull telecomm schemes from PhoneAccount in framework
Bug:17398074
Change-Id: I3e73be01949c254a142fe8a4faea062899d35266
diff --git a/src/com/android/contacts/common/CallUtil.java b/src/com/android/contacts/common/CallUtil.java
index 307c975..0d143c7 100644
--- a/src/com/android/contacts/common/CallUtil.java
+++ b/src/com/android/contacts/common/CallUtil.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
+import android.telecomm.PhoneAccount;
import android.telecomm.PhoneAccountHandle;
import android.telecomm.TelecommManager;
import android.telecomm.VideoProfile;
@@ -31,13 +32,6 @@
*/
public class CallUtil {
- public static final String SCHEME_TEL = "tel";
- public static final String SCHEME_SMSTO = "smsto";
- public static final String SCHEME_MAILTO = "mailto";
- public static final String SCHEME_IMTO = "imto";
- public static final String SCHEME_SIP = "sip";
- public static final String SCHEME_VOICEMAIL = "voicemail";
-
/**
* Return an Intent for making a phone call. Scheme (e.g. tel, sip) will be determined
* automatically.
@@ -141,14 +135,14 @@
}
/**
- * Return Uri with an appropriate scheme, accepting Voicemail, SIP, and usual phone call
+ * Return Uri with an appropriate scheme, accepting both SIP and usual phone call
* numbers.
*/
public static Uri getCallUri(String number) {
if (PhoneNumberHelper.isUriNumber(number)) {
- return Uri.fromParts(SCHEME_SIP, number, null);
+ return Uri.fromParts(PhoneAccount.SCHEME_SIP, number, null);
}
- return Uri.fromParts(SCHEME_TEL, number, null);
+ return Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null);
}
public static boolean isVideoEnabled(Context context) {
diff --git a/src/com/android/contacts/common/ContactsUtils.java b/src/com/android/contacts/common/ContactsUtils.java
index 4c31367..857450d 100644
--- a/src/com/android/contacts/common/ContactsUtils.java
+++ b/src/com/android/contacts/common/ContactsUtils.java
@@ -36,6 +36,11 @@
public class ContactsUtils {
private static final String TAG = "ContactsUtils";
+ // Telecomm related schemes are in CallUtil
+ public static final String SCHEME_IMTO = "imto";
+ public static final String SCHEME_MAILTO = "mailto";
+ public static final String SCHEME_SMSTO = "smsto";
+
private static int sThumbnailSize = -1;
// TODO find a proper place for the canonical version of these
@@ -158,7 +163,7 @@
return null;
}
final String authority = host.toLowerCase();
- final Uri imUri = new Uri.Builder().scheme(CallUtil.SCHEME_IMTO).authority(
+ final Uri imUri = new Uri.Builder().scheme(SCHEME_IMTO).authority(
authority).appendPath(data).build();
final Intent intent = new Intent(Intent.ACTION_SENDTO, imUri);
return intent;
diff --git a/src/com/android/contacts/common/list/ShortcutIntentBuilder.java b/src/com/android/contacts/common/list/ShortcutIntentBuilder.java
index b1a3061..90c6d0c 100644
--- a/src/com/android/contacts/common/list/ShortcutIntentBuilder.java
+++ b/src/com/android/contacts/common/list/ShortcutIntentBuilder.java
@@ -38,11 +38,12 @@
import android.provider.ContactsContract.Data;
import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
+import android.telecomm.PhoneAccount;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.TextUtils.TruncateAt;
-import com.android.contacts.common.CallUtil;
+import com.android.contacts.common.ContactsUtils;
import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest;
import com.android.contacts.common.R;
@@ -306,11 +307,11 @@
Uri phoneUri;
if (Intent.ACTION_CALL.equals(shortcutAction)) {
// Make the URI a direct tel: URI so that it will always continue to work
- phoneUri = Uri.fromParts(CallUtil.SCHEME_TEL, phoneNumber, null);
+ phoneUri = Uri.fromParts(PhoneAccount.SCHEME_TEL, phoneNumber, null);
bitmap = generatePhoneNumberIcon(drawable, phoneType, phoneLabel,
R.drawable.badge_action_call);
} else {
- phoneUri = Uri.fromParts(CallUtil.SCHEME_SMSTO, phoneNumber, null);
+ phoneUri = Uri.fromParts(ContactsUtils.SCHEME_SMSTO, phoneNumber, null);
bitmap = generatePhoneNumberIcon(drawable, phoneType, phoneLabel,
R.drawable.badge_action_sms);
}