diff options
Diffstat (limited to 'src')
10 files changed, 81 insertions, 81 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 984537756..72a50127e 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -51,6 +51,7 @@ import com.android.dialer.calllog.PhoneAccountUtils; import com.android.dialer.util.IntentUtil.CallIntentBuilder; import com.android.dialer.util.PhoneNumberUtil; import com.android.dialer.util.TelecomUtil; +import com.android.incallui.Call.LogState; /** * Displays the details of a specific call log entry. @@ -240,7 +241,10 @@ public class CallDetailActivity extends AppCompatActivity mCallButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - mContext.startActivity(new CallIntentBuilder(mNumber).build()); + mContext.startActivity( + new CallIntentBuilder(mNumber) + .setCallInitiationType(LogState.INITIATION_CALL_DETAILS) + .build()); } }); diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index f62dea161..dbff276e5 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -89,6 +89,7 @@ import com.android.dialer.widget.ActionBarController; import com.android.dialer.widget.SearchEditTextLayout; import com.android.dialer.widget.SearchEditTextLayout.Callback; import com.android.dialerbind.DatabaseHelperManager; +import com.android.incallui.Call.LogState; import com.android.phone.common.animation.AnimUtils; import com.android.phone.common.animation.AnimationListenerAdapter; @@ -1243,21 +1244,15 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } @Override - public void onPickPhoneNumberAction(Uri dataUri) { - // Specify call-origin so that users will see the previous tab instead of - // CallLog screen (search UI will be automatically exited). - PhoneNumberInteraction.startInteractionForPhoneCall( - DialtactsActivity.this, dataUri, null); + public void onPickPhoneNumberAction(Uri dataUri, int callInitiationType) { mClearSearchOnPause = true; + PhoneNumberInteraction.startInteractionForPhoneCall( + DialtactsActivity.this, dataUri, callInitiationType); } @Override - public void onCallNumberDirectly(String phoneNumber) { - onCallNumberDirectly(phoneNumber, false /* isVideoCall */); - } - - @Override - public void onCallNumberDirectly(String phoneNumber, boolean isVideoCall) { + public void onCallNumberDirectly(String phoneNumber, boolean isVideoCall, + int callInitiationType) { if (phoneNumber == null) { // Invalid phone number, but let the call go through so that InCallUI can show // an error message. @@ -1266,6 +1261,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O final Intent intent = new CallIntentBuilder(phoneNumber) .setIsVideoCall(isVideoCall) + .setCallInitiationType(callInitiationType) .build(); DialerUtils.startActivityWithErrorToast(this, intent); diff --git a/src/com/android/dialer/calllog/IntentProvider.java b/src/com/android/dialer/calllog/IntentProvider.java index 79743b0b7..773436be4 100644 --- a/src/com/android/dialer/calllog/IntentProvider.java +++ b/src/com/android/dialer/calllog/IntentProvider.java @@ -31,6 +31,7 @@ import com.android.dialer.CallDetailActivity; import com.android.dialer.util.IntentUtil; import com.android.dialer.util.IntentUtil.CallIntentBuilder; import com.android.dialer.util.TelecomUtil; +import com.android.incallui.Call.LogState; import java.util.ArrayList; @@ -56,6 +57,7 @@ public abstract class IntentProvider { public Intent getIntent(Context context) { return new CallIntentBuilder(number) .setPhoneAccountHandle(accountHandle) + .setCallInitiationType(LogState.INITIATION_CALL_LOG) .build(); } }; @@ -72,6 +74,7 @@ public abstract class IntentProvider { public Intent getIntent(Context context) { return new CallIntentBuilder(number) .setPhoneAccountHandle(accountHandle) + .setCallInitiationType(LogState.INITIATION_CALL_LOG) .setIsVideoCall(true) .build(); } @@ -82,7 +85,9 @@ public abstract class IntentProvider { return new IntentProvider() { @Override public Intent getIntent(Context context) { - return new CallIntentBuilder(CallUtil.getVoicemailUri()).build(); + return new CallIntentBuilder(CallUtil.getVoicemailUri()) + .setCallInitiationType(LogState.INITIATION_CALL_LOG) + .build(); } }; } diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index eb17fefe3..d2628da5e 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -82,6 +82,7 @@ import com.android.dialer.SpecialCharSequenceMgr; import com.android.dialer.calllog.PhoneAccountUtils; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil.CallIntentBuilder; +import com.android.incallui.Call.LogState; import com.android.phone.common.CallLogAsync; import com.android.phone.common.animation.AnimUtils; import com.android.phone.common.dialpad.DialpadKeyButton; @@ -1045,7 +1046,9 @@ public class DialpadFragment extends Fragment public void callVoicemail() { DialerUtils.startActivityWithErrorToast(getActivity(), - new CallIntentBuilder(CallUtil.getVoicemailUri()).build()); + new CallIntentBuilder(CallUtil.getVoicemailUri()) + .setCallInitiationType(LogState.INITIATION_DIALPAD) + .build()); hideAndClearDialpad(false); } @@ -1141,7 +1144,9 @@ public class DialpadFragment extends Fragment // Clear the digits just in case. clearDialpad(); } else { - final Intent intent = new CallIntentBuilder(number).build(); + final Intent intent = new CallIntentBuilder(number). + setCallInitiationType(LogState.INITIATION_DIALPAD) + .build(); DialerUtils.startActivityWithErrorToast(getActivity(), intent); hideAndClearDialpad(false); } diff --git a/src/com/android/dialer/interactions/PhoneNumberInteraction.java b/src/com/android/dialer/interactions/PhoneNumberInteraction.java index e4c3158ea..96742fd11 100644 --- a/src/com/android/dialer/interactions/PhoneNumberInteraction.java +++ b/src/com/android/dialer/interactions/PhoneNumberInteraction.java @@ -54,6 +54,7 @@ import com.android.dialer.TransactionSafeActivity; import com.android.dialer.contact.ContactUpdateService; import com.android.dialer.util.IntentUtil; import com.android.dialer.util.IntentUtil.CallIntentBuilder; +import com.android.incallui.Call.LogState; import com.android.dialer.util.DialerUtils; import com.google.common.annotations.VisibleForTesting; @@ -189,21 +190,20 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { private static final String ARG_PHONE_LIST = "phoneList"; private static final String ARG_INTERACTION_TYPE = "interactionType"; - private static final String ARG_CALL_ORIGIN = "callOrigin"; + private static final String ARG_CALL_INITIATION_TYPE = "callInitiation"; private int mInteractionType; private ListAdapter mPhonesAdapter; private List<PhoneItem> mPhoneList; - private String mCallOrigin; + private int mCallInitiationType; - public static void show(FragmentManager fragmentManager, - ArrayList<PhoneItem> phoneList, int interactionType, - String callOrigin) { + public static void show(FragmentManager fragmentManager, ArrayList<PhoneItem> phoneList, + int interactionType, int callInitiationType) { PhoneDisambiguationDialogFragment fragment = new PhoneDisambiguationDialogFragment(); Bundle bundle = new Bundle(); bundle.putParcelableArrayList(ARG_PHONE_LIST, phoneList); - bundle.putSerializable(ARG_INTERACTION_TYPE, interactionType); - bundle.putString(ARG_CALL_ORIGIN, callOrigin); + bundle.putInt(ARG_INTERACTION_TYPE, interactionType); + bundle.putInt(ARG_CALL_INITIATION_TYPE, callInitiationType); fragment.setArguments(bundle); fragment.show(fragmentManager, TAG); } @@ -213,7 +213,7 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { final Activity activity = getActivity(); mPhoneList = getArguments().getParcelableArrayList(ARG_PHONE_LIST); mInteractionType = getArguments().getInt(ARG_INTERACTION_TYPE); - mCallOrigin = getArguments().getString(ARG_CALL_ORIGIN); + mCallInitiationType = getArguments().getInt(ARG_CALL_INITIATION_TYPE); mPhonesAdapter = new PhoneItemAdapter(activity, mPhoneList, mInteractionType); final LayoutInflater inflater = activity.getLayoutInflater(); @@ -242,7 +242,7 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { } PhoneNumberInteraction.performAction(activity, phoneItem.phoneNumber, - mInteractionType, mCallOrigin); + mInteractionType, mCallInitiationType); } else { dialog.dismiss(); } @@ -281,7 +281,7 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { private final OnDismissListener mDismissListener; private final int mInteractionType; - private final String mCallOrigin; + private final int mCallInitiationType; private boolean mUseDefault; private static final int UNKNOWN_CONTACT_ID = -1; @@ -298,24 +298,25 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { @VisibleForTesting /* package */ PhoneNumberInteraction(Context context, int interactionType, DialogInterface.OnDismissListener dismissListener) { - this(context, interactionType, dismissListener, null); + this(context, interactionType, dismissListener, LogState.INITIATION_UNKNOWN); } private PhoneNumberInteraction(Context context, int interactionType, - DialogInterface.OnDismissListener dismissListener, String callOrigin) { + DialogInterface.OnDismissListener dismissListener, int callInitiationType) { mContext = context; mInteractionType = interactionType; mDismissListener = dismissListener; - mCallOrigin = callOrigin; + mCallInitiationType = callInitiationType; } private void performAction(String phoneNumber) { - PhoneNumberInteraction.performAction(mContext, phoneNumber, mInteractionType, mCallOrigin); + PhoneNumberInteraction.performAction(mContext, phoneNumber, mInteractionType, + mCallInitiationType); } private static void performAction( Context context, String phoneNumber, int interactionType, - String callOrigin) { + int callInitiationType) { Intent intent; switch (interactionType) { case ContactDisplayUtils.INTERACTION_SMS: @@ -323,7 +324,9 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { Intent.ACTION_SENDTO, Uri.fromParts("sms", phoneNumber, null)); break; default: - intent = new CallIntentBuilder(phoneNumber).build(); + intent = new CallIntentBuilder(phoneNumber) + .setCallInitiationType(callInitiationType) + .build(); break; } DialerUtils.startActivityWithErrorToast(context, intent); @@ -448,54 +451,15 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { } /** - * Start call action using given contact Uri. If there are multiple candidates for the phone - * call, dialog is automatically shown and the user is asked to choose one. - * * @param activity that is calling this interaction. This must be of type * {@link TransactionSafeActivity} because we need to check on the activity state after the * phone numbers have been queried for. - * @param uri contact Uri (built from {@link Contacts#CONTENT_URI}) or data Uri - * (built from {@link Data#CONTENT_URI}). Contact Uri may show the disambiguation dialog while - * data Uri won't. - */ - public static void startInteractionForPhoneCall(TransactionSafeActivity activity, Uri uri) { - (new PhoneNumberInteraction(activity, ContactDisplayUtils.INTERACTION_CALL, null)) - .startInteraction(uri, true); - } - - /** - * Start call action using given contact Uri. If there are multiple candidates for the phone - * call, dialog is automatically shown and the user is asked to choose one. - * - * @param activity that is calling this interaction. This must be of type - * {@link TransactionSafeActivity} because we need to check on the activity state after the - * phone numbers have been queried for. - * @param uri contact Uri (built from {@link Contacts#CONTENT_URI}) or data Uri - * (built from {@link Data#CONTENT_URI}). Contact Uri may show the disambiguation dialog while - * data Uri won't. - * @param useDefault Whether or not to use the primary(default) phone number. If true, the - * primary phone number will always be used by default if one is available. If false, a - * disambiguation dialog will be shown regardless of whether or not a primary phone number - * is available. - */ - public static void startInteractionForPhoneCall(TransactionSafeActivity activity, Uri uri, - boolean useDefault) { - (new PhoneNumberInteraction(activity, ContactDisplayUtils.INTERACTION_CALL, null)) - .startInteraction(uri, useDefault); - } - - /** - * @param activity that is calling this interaction. This must be of type - * {@link TransactionSafeActivity} because we need to check on the activity state after the - * phone numbers have been queried for. - * @param callOrigin If non null, {@link PhoneConstants#EXTRA_CALL_ORIGIN} will be - * appended to the Intent initiating phone call. See comments in Phone package (PhoneApp) - * for more detail. + * @param callInitiationType Indicates the UI affordance that was used to initiate the call. */ public static void startInteractionForPhoneCall(TransactionSafeActivity activity, Uri uri, - String callOrigin) { - (new PhoneNumberInteraction(activity, ContactDisplayUtils.INTERACTION_CALL, null, callOrigin)) - .startInteraction(uri, true); + int callInitiationType) { + (new PhoneNumberInteraction(activity, ContactDisplayUtils.INTERACTION_CALL, null, + callInitiationType)).startInteraction(uri, true); } /** @@ -529,7 +493,7 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { } try { PhoneDisambiguationDialogFragment.show(activity.getFragmentManager(), - phoneList, mInteractionType, mCallOrigin); + phoneList, mInteractionType, mCallInitiationType); } catch (IllegalStateException e) { // ignore to be safe. Shouldn't happen because we checked the // activity wasn't destroyed, but to be safe. diff --git a/src/com/android/dialer/list/RegularSearchFragment.java b/src/com/android/dialer/list/RegularSearchFragment.java index c715de8ca..5c3117d89 100644 --- a/src/com/android/dialer/list/RegularSearchFragment.java +++ b/src/com/android/dialer/list/RegularSearchFragment.java @@ -20,6 +20,7 @@ import static android.Manifest.permission.READ_CONTACTS; import android.app.Activity; import android.content.pm.PackageManager; +import android.util.Log; import android.view.LayoutInflater; import android.view.ViewGroup; @@ -28,7 +29,7 @@ import com.android.contacts.common.list.PinnedHeaderListView; import com.android.contacts.common.util.PermissionsUtil; import com.android.contacts.commonbind.analytics.AnalyticsUtil; import com.android.dialerbind.ObjectFactory; - +import com.android.incallui.Call.LogState; import com.android.dialer.R; import com.android.dialer.service.CachedNumberLookupService; import com.android.dialer.widget.EmptyContentView; @@ -119,4 +120,10 @@ public class RegularSearchFragment extends SearchFragment } } } + + @Override + protected int getCallInitiationType(boolean isRemoteDirectory) { + return isRemoteDirectory ? LogState.INITIATION_REMOTE_DIRECTORY + : LogState.INITIATION_REGULAR_SEARCH; + } } diff --git a/src/com/android/dialer/list/SearchFragment.java b/src/com/android/dialer/list/SearchFragment.java index 315cfb914..26ed117a4 100644 --- a/src/com/android/dialer/list/SearchFragment.java +++ b/src/com/android/dialer/list/SearchFragment.java @@ -53,6 +53,7 @@ import com.android.dialer.R; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; import com.android.dialer.widget.EmptyContentView; +import com.android.incallui.Call.LogState; import com.android.phone.common.animation.AnimUtils; public class SearchFragment extends PhoneNumberPickerFragment { @@ -250,7 +251,8 @@ public class SearchFragment extends PhoneNumberPickerFragment { number = adapter.getQueryString(); listener = getOnPhoneNumberPickerListener(); if (listener != null && !checkForProhibitedPhoneNumber(number)) { - listener.onCallNumberDirectly(number); + listener.onCallNumberDirectly(number, false /* isVideoCall */, + getCallInitiationType(false /* isRemoteDirectory */)); } break; case DialerPhoneNumberListAdapter.SHORTCUT_CREATE_NEW_CONTACT: @@ -275,7 +277,8 @@ public class SearchFragment extends PhoneNumberPickerFragment { number = adapter.getQueryString(); listener = getOnPhoneNumberPickerListener(); if (listener != null && !checkForProhibitedPhoneNumber(number)) { - listener.onCallNumberDirectly(number, true /* isVideoCall */); + listener.onCallNumberDirectly(number, true /* isVideoCall */, + getCallInitiationType(false /* isRemoteDirectory */)); } break; } diff --git a/src/com/android/dialer/list/SmartDialSearchFragment.java b/src/com/android/dialer/list/SmartDialSearchFragment.java index 72d3abf68..9aedfe847 100644 --- a/src/com/android/dialer/list/SmartDialSearchFragment.java +++ b/src/com/android/dialer/list/SmartDialSearchFragment.java @@ -30,6 +30,7 @@ import com.android.contacts.common.util.PermissionsUtil; import com.android.dialer.dialpad.SmartDialCursorLoader; import com.android.dialer.R; import com.android.dialer.widget.EmptyContentView; +import com.android.incallui.Call.LogState; import java.util.ArrayList; @@ -116,6 +117,11 @@ public class SmartDialSearchFragment extends SearchFragment } } + @Override + protected int getCallInitiationType(boolean isRemoteDirectory) { + return LogState.INITIATION_SMART_DIAL; + } + public boolean isShowingPermissionRequest() { return mEmptyView != null && mEmptyView.isShowingContent(); } diff --git a/src/com/android/dialer/list/SpeedDialFragment.java b/src/com/android/dialer/list/SpeedDialFragment.java index 324caefb6..7b72e453d 100644 --- a/src/com/android/dialer/list/SpeedDialFragment.java +++ b/src/com/android/dialer/list/SpeedDialFragment.java @@ -54,6 +54,7 @@ import com.android.contacts.common.util.PermissionsUtil; import com.android.dialer.R; import com.android.dialer.util.DialerUtils; import com.android.dialer.widget.EmptyContentView; +import com.android.incallui.Call.LogState; import java.util.ArrayList; import java.util.HashMap; @@ -115,14 +116,16 @@ public class SpeedDialFragment extends Fragment implements OnItemClickListener, @Override public void onContactSelected(Uri contactUri, Rect targetRect) { if (mPhoneNumberPickerActionListener != null) { - mPhoneNumberPickerActionListener.onPickPhoneNumberAction(contactUri); + mPhoneNumberPickerActionListener.onPickPhoneNumberAction(contactUri, + LogState.INITIATION_SPEED_DIAL); } } @Override public void onCallNumberDirectly(String phoneNumber) { if (mPhoneNumberPickerActionListener != null) { - mPhoneNumberPickerActionListener.onCallNumberDirectly(phoneNumber); + mPhoneNumberPickerActionListener.onCallNumberDirectly(phoneNumber, + false /* isVideoCall */, LogState.INITIATION_SPEED_DIAL); } } diff --git a/src/com/android/dialer/util/DialerUtils.java b/src/com/android/dialer/util/DialerUtils.java index e25ada59d..fbe14ba9e 100644 --- a/src/com/android/dialer/util/DialerUtils.java +++ b/src/com/android/dialer/util/DialerUtils.java @@ -81,7 +81,14 @@ public class DialerUtils { // All dialer-initiated calls should pass the touch point to the InCallUI Point touchPoint = TouchPointManager.getInstance().getPoint(); if (touchPoint.x != 0 || touchPoint.y != 0) { - Bundle extras = new Bundle(); + Bundle extras; + // Make sure to not accidentally clobber any existing extras + if (intent.hasExtra(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS)) { + extras = intent.getParcelableExtra( + TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS); + } else { + extras = new Bundle(); + } extras.putParcelable(TouchPointManager.TOUCH_POINT, touchPoint); intent.putExtra(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, extras); } |