From 91ce7d2a476bd04fe525049a37a2f8b2824e9724 Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Mon, 5 Jun 2017 13:35:02 -0700 Subject: Update AOSP Dialer source from internal google3 repository at cl/158012278. Test: make, treehugger This CL updates the AOSP Dialer source with all the changes that have gone into the private google3 repository. This includes all the changes from cl/152373142 (4/06/2017) to cl/158012278 (6/05/2017). This goal of these drops is to keep the AOSP source in sync with the internal google3 repository. Currently these sync are done by hand with very minor modifications to the internal source code. See the Android.mk file for list of modifications. Our current goal is to do frequent drops (daily if possible) and eventually switched to an automated process. Change-Id: I4d3f14b5140e2e51bead9497bc118a205b3ebe76 --- .../dialer/app/list/PhoneFavoriteTileView.java | 38 +++++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'java/com/android/dialer/app/list/PhoneFavoriteTileView.java') diff --git a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java index db89cf3dc..835b448bd 100644 --- a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java +++ b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java @@ -18,16 +18,22 @@ package com.android.dialer.app.list; import android.content.ClipData; import android.content.Context; +import android.provider.ContactsContract.PinnedPositions; import android.text.TextUtils; import android.util.AttributeSet; import android.view.View; import android.widget.ImageView; -import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; import com.android.contacts.common.MoreContactUtils; +import com.android.contacts.common.lettertiles.LetterTileDrawable; import com.android.contacts.common.list.ContactEntry; import com.android.contacts.common.list.ContactTileView; import com.android.dialer.app.R; +import com.android.dialer.callintent.CallInitiationType; +import com.android.dialer.callintent.CallSpecificAppData; +import com.android.dialer.callintent.SpeedDialContactType; +import com.android.dialer.logging.InteractionEvent; +import com.android.dialer.logging.Logger; /** * A light version of the {@link com.android.contacts.common.list.ContactTileView} that is used in @@ -42,7 +48,6 @@ public abstract class PhoneFavoriteTileView extends ContactTileView { // tile is long pressed. static final String DRAG_PHONE_FAVORITE_TILE = "PHONE_FAVORITE_TILE"; private static final String TAG = PhoneFavoriteTileView.class.getSimpleName(); - private static final boolean DEBUG = false; // These parameters instruct the photo manager to display the default image/letter at 70% of // its normal size, and vertically offset upwards 12% towards the top of the letter tile, to // make room for the contact name and number label at the bottom of the image. @@ -55,6 +60,8 @@ public abstract class PhoneFavoriteTileView extends ContactTileView { private View mShadowOverlay; /** Users' most frequent phone number. */ private String mPhoneNumberString; + private boolean isPinned; + private boolean isStarred; public PhoneFavoriteTileView(Context context, AttributeSet attrs) { super(context, attrs); @@ -83,6 +90,8 @@ public abstract class PhoneFavoriteTileView extends ContactTileView { super.loadFromContact(entry); // Set phone number to null in case we're reusing the view. mPhoneNumberString = null; + isPinned = (entry.pinned != PinnedPositions.UNPINNED); + isStarred = entry.isFavorite; if (entry != null) { // Grab the phone-number to call directly. See {@link onClick()}. mPhoneNumberString = entry.phoneNumber; @@ -113,16 +122,35 @@ public abstract class PhoneFavoriteTileView extends ContactTileView { if (mListener == null) { return; } + + CallSpecificAppData.Builder callSpecificAppData = + CallSpecificAppData.newBuilder() + .setCallInitiationType(CallInitiationType.Type.SPEED_DIAL) + .setSpeedDialContactPosition( + ((PhoneFavoriteListView) v.getParent()).getPositionForView(v)); + if (isStarred) { + callSpecificAppData.addSpeedDialContactType(SpeedDialContactType.Type.STARRED_CONTACT); + } else { + callSpecificAppData.addSpeedDialContactType(SpeedDialContactType.Type.FREQUENT_CONTACT); + } + if (isPinned) { + callSpecificAppData.addSpeedDialContactType(SpeedDialContactType.Type.PINNED_CONTACT); + } + if (TextUtils.isEmpty(mPhoneNumberString)) { // Copy "superclass" implementation + Logger.get(getContext()) + .logInteraction(InteractionEvent.Type.SPEED_DIAL_CLICK_CONTACT_WITH_AMBIGUOUS_NUMBER); mListener.onContactSelected( - getLookupUri(), MoreContactUtils.getTargetRectFromView(PhoneFavoriteTileView.this)); + getLookupUri(), + MoreContactUtils.getTargetRectFromView(PhoneFavoriteTileView.this), + callSpecificAppData.build()); } else { // When you tap a frequently-called contact, you want to // call them at the number that you usually talk to them // at (i.e. the one displayed in the UI), regardless of // whether that's their default number. - mListener.onCallNumberDirectly(mPhoneNumberString); + mListener.onCallNumberDirectly(mPhoneNumberString, callSpecificAppData.build()); } } }; @@ -133,7 +161,7 @@ public abstract class PhoneFavoriteTileView extends ContactTileView { return new DefaultImageRequest( displayName, lookupKey, - ContactPhotoManager.TYPE_DEFAULT, + LetterTileDrawable.TYPE_DEFAULT, DEFAULT_IMAGE_LETTER_SCALE, DEFAULT_IMAGE_LETTER_OFFSET, false); -- cgit v1.2.3