Update phone number picker listener to provide call initiation data
Bug: 23164804
Change-Id: Id14126ddd8bc430850ed71675834cfaef80ebf08
diff --git a/src/com/android/contacts/common/list/OnPhoneNumberPickerActionListener.java b/src/com/android/contacts/common/list/OnPhoneNumberPickerActionListener.java
index f69df9d..138a1dc 100644
--- a/src/com/android/contacts/common/list/OnPhoneNumberPickerActionListener.java
+++ b/src/com/android/contacts/common/list/OnPhoneNumberPickerActionListener.java
@@ -23,21 +23,17 @@
* Action callbacks that can be sent by a phone number picker.
*/
public interface OnPhoneNumberPickerActionListener {
+ public static final int CALL_INITIATION_UNKNOWN = 0;
/**
* Returns the selected phone number to the requester.
*/
- void onPickPhoneNumberAction(Uri dataUri);
-
- /**
- * Calls the specified phone number audio call.
- */
- void onCallNumberDirectly(String phoneNumber);
+ void onPickPhoneNumberAction(Uri dataUri, int callInitiationType);
/**
* Calls the specified phone number, either as an audio or video call.
*/
- void onCallNumberDirectly(String phoneNumber, boolean isVideoCall);
+ void onCallNumberDirectly(String phoneNumber, boolean isVideoCall, int callInitiationType);
/**
* Returns the selected number as a shortcut intent.
diff --git a/src/com/android/contacts/common/list/PhoneNumberPickerFragment.java b/src/com/android/contacts/common/list/PhoneNumberPickerFragment.java
index 7f98fde..43f7ade 100644
--- a/src/com/android/contacts/common/list/PhoneNumberPickerFragment.java
+++ b/src/com/android/contacts/common/list/PhoneNumberPickerFragment.java
@@ -196,7 +196,8 @@
final String number = getPhoneNumber(position);
if (!TextUtils.isEmpty(number)) {
cacheContactInfo(position);
- mListener.onCallNumberDirectly(number);
+ mListener.onCallNumberDirectly(number, false /* isVideoCall */,
+ getCallInitiationType(true /* isRemoteDirectory */));
} else {
Log.w(TAG, "Item at " + position + " was clicked before"
+ " adapter is ready. Ignoring");
@@ -286,7 +287,8 @@
public void pickPhoneNumber(Uri uri) {
if (mShortcutAction == null) {
- mListener.onPickPhoneNumberAction(uri);
+ mListener.onPickPhoneNumberAction(uri,
+ getCallInitiationType(false /* isRemoteDirectory */));
} else {
startPhoneNumberShortcutIntent(uri);
}
@@ -297,13 +299,15 @@
builder.createPhoneNumberShortcutIntent(uri, mShortcutAction);
}
+ @Override
public void onShortcutIntentCreated(Uri uri, Intent shortcutIntent) {
mListener.onShortcutIntentCreated(shortcutIntent);
}
@Override
public void onPickerResult(Intent data) {
- mListener.onPickPhoneNumberAction(data.getData());
+ mListener.onPickPhoneNumberAction(data.getData(),
+ getCallInitiationType(false /* isRemoteDirectory */));
}
@Override
@@ -345,6 +349,14 @@
}
/**
+ * @param isRemoteDirectory {@code true} if the call was initiated using a contact/phone number
+ * not in the local contacts database
+ */
+ protected int getCallInitiationType(boolean isRemoteDirectory) {
+ return OnPhoneNumberPickerActionListener.CALL_INITIATION_UNKNOWN;
+ }
+
+ /**
* Where a lookup key contains analytic event information, logs the associated analytics event.
*
* @param lookupKey The lookup key JSON object.