diff options
| author | Stephen Bird <sbird@cyngn.com> | 2015-07-23 18:58:24 -0700 |
|---|---|---|
| committer | Stephen Bird <sbird@cyngn.com> | 2015-07-27 17:38:06 -0700 |
| commit | 60ca51a3cb2736989e59be84b45c2ef21ed60eaf (patch) | |
| tree | 21ae705cbfd7992b43b60c261bd5fbc9e968b5a3 | |
| parent | f46a395a3014bb7ba6d42bdb01cc423ab433e21c (diff) | |
| download | packages_apps_ContactsCommon-caf/cm-12.1.tar.gz packages_apps_ContactsCommon-caf/cm-12.1.tar.bz2 packages_apps_ContactsCommon-caf/cm-12.1.zip | |
EmergencyContacts: Check if quickdial number is an emergency numbercaf/cm-12.1
If the phone number is an emergency number, use ACTION_CALL_PRIVILEGED.
Change-Id: I348d2bff06eb5a9b8218ad9c8a5584ffa84e33f8
(cherry picked from commit 9e828a0093f4fc4589c98428263d05234ac2a303)
| -rwxr-xr-x | src/com/android/contacts/common/list/ContactListAdapter.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/com/android/contacts/common/list/ContactListAdapter.java b/src/com/android/contacts/common/list/ContactListAdapter.java index ea2d8539..751b196b 100755 --- a/src/com/android/contacts/common/list/ContactListAdapter.java +++ b/src/com/android/contacts/common/list/ContactListAdapter.java @@ -25,6 +25,7 @@ import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Directory; import android.provider.ContactsContract.RawContacts; import android.provider.ContactsContract.SearchSnippets; +import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; @@ -243,7 +244,12 @@ public abstract class ContactListAdapter extends ContactEntryListAdapter { if (cursor.moveToNext()) { String phoneNumber = cursor.getString(0); Uri uri = Uri.parse("tel: " + phoneNumber); - Intent intent = new Intent(Intent.ACTION_CALL, uri); + Intent intent; + if (PhoneNumberUtils.isEmergencyNumber(phoneNumber)) { + intent = new Intent(Intent.ACTION_CALL_EMERGENCY, uri); + } else { + intent = new Intent(Intent.ACTION_CALL, uri); + } mContext.startActivity(intent); } cursor.close(); |
