diff options
author | Stephen Bird <sbird@cyngn.com> | 2016-02-18 10:27:28 -0800 |
---|---|---|
committer | Richard MacGregor <rmacgregor@cyngn.com> | 2016-03-25 11:42:20 -0700 |
commit | 2f2dd2e9d4bbf0be58b749413ac44747d7aa0bdd (patch) | |
tree | edd803959f8c7f8ed95b73239bba826686397c26 /src | |
parent | b725baf7c7b4926d3f3101893865ec20f8fe7f0a (diff) | |
download | android_packages_apps_ContactsCommon-2f2dd2e9d4bbf0be58b749413ac44747d7aa0bdd.tar.gz android_packages_apps_ContactsCommon-2f2dd2e9d4bbf0be58b749413ac44747d7aa0bdd.tar.bz2 android_packages_apps_ContactsCommon-2f2dd2e9d4bbf0be58b749413ac44747d7aa0bdd.zip |
Add origin option to call methods.
Ticket: CD-425
Change-Id: Ifd0562a6e59d8b7fd245fbaf27e66fe35332dc86
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/contacts/common/CallUtil.java | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/com/android/contacts/common/CallUtil.java b/src/com/android/contacts/common/CallUtil.java index f11ea047..0d360522 100644 --- a/src/com/android/contacts/common/CallUtil.java +++ b/src/com/android/contacts/common/CallUtil.java @@ -65,7 +65,15 @@ public class CallUtil { * automatically. */ public static Intent getCallIntent(String number) { - return getCallIntent(number, null); + return getCallIntent(number, null, null); + } + + /** + * Return an Intent for making a phone call. Scheme (e.g. tel, sip) will be determined + * automatically. + */ + public static Intent getCallIntent(String number, String origin) { + return getCallIntent(number, null, origin); } /** @@ -73,7 +81,15 @@ public class CallUtil { * sanity check). */ public static Intent getCallIntent(Uri uri) { - return new Intent(Intent.ACTION_CALL, uri); + return getCallIntent(uri, null, null); + } + + /** + * Return an Intent for making a phone call. A given Uri will be used as is (without any + * sanity check). + */ + public static Intent getCallIntent(Uri uri, String origin) { + return getCallIntent(uri, null, origin); } /** @@ -81,7 +97,15 @@ public class CallUtil { */ public static Intent getCallIntent( String number, PhoneAccountHandle accountHandle) { - return getCallIntent(CallUtil.getCallUri(number), accountHandle); + return getCallIntent(number, accountHandle, null); + } + + /** + * A variant of {@link #getCallIntent(String, String)} but also include {@code Account}. + */ + public static Intent getCallIntent( + String number, PhoneAccountHandle accountHandle, String origin) { + return getCallIntent(CallUtil.getCallUri(number), accountHandle, origin); } /** @@ -89,11 +113,14 @@ public class CallUtil { * origin and {@code Account} and {@code VideoCallProfile} state. * For more information about call origin, see comments in Phone package (PhoneApp). */ - public static Intent getCallIntent(Uri uri, PhoneAccountHandle accountHandle) { + public static Intent getCallIntent(Uri uri, PhoneAccountHandle accountHandle, String origin) { final Intent intent = new Intent(Intent.ACTION_CALL, uri); if (accountHandle != null) { intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, accountHandle); } + if (origin != null) { + intent.putExtra(PhoneConstants.EXTRA_CALL_ORIGIN, origin); + } return intent; } |