summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-06-21 23:08:36 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-06-21 23:08:36 +0000
commit3d97f592b5902b885dfe47e700b8e960047a090b (patch)
tree2cc59bf8464510e5ac8596810aeb587e757215c2
parent9893a89dbe2378736464b31c40090454e9a8c08e (diff)
parentc451dd563c5d7d15220c9d7a9c0ff42b2600e85b (diff)
Merge "NUI favorite logging"
-rw-r--r--java/com/android/dialer/callintent/call_initiation_type.proto1
-rw-r--r--java/com/android/dialer/logging/dialer_impression.proto16
-rw-r--r--java/com/android/dialer/speeddial/DisambigDialog.java8
-rw-r--r--java/com/android/dialer/speeddial/SpeedDialFragment.java14
-rw-r--r--java/com/android/dialer/speeddial/draghelper/SpeedDialItemTouchHelperCallback.java21
5 files changed, 53 insertions, 7 deletions
diff --git a/java/com/android/dialer/callintent/call_initiation_type.proto b/java/com/android/dialer/callintent/call_initiation_type.proto
index 27d446119..3823e49fb 100644
--- a/java/com/android/dialer/callintent/call_initiation_type.proto
+++ b/java/com/android/dialer/callintent/call_initiation_type.proto
@@ -21,6 +21,7 @@ message CallInitiationType {
DIALPAD = 2;
SPEED_DIAL = 3;
+ SPEED_DIAL_DISAMBIG_DIALOG = 20;
REMOTE_DIRECTORY = 4;
diff --git a/java/com/android/dialer/logging/dialer_impression.proto b/java/com/android/dialer/logging/dialer_impression.proto
index 96775ca66..f3173f82e 100644
--- a/java/com/android/dialer/logging/dialer_impression.proto
+++ b/java/com/android/dialer/logging/dialer_impression.proto
@@ -12,7 +12,7 @@ message DialerImpression {
// Event enums to be used for Impression Logging in Dialer.
// It's perfectly acceptable for this enum to be large
// Values should be from 1000 to 100000.
- // Next Tag: 1399
+ // Next Tag: 1409
enum Type {
UNKNOWN_AOSP_EVENT_TYPE = 1000;
@@ -783,5 +783,19 @@ message DialerImpression {
// Impressions for PhoneLookup
PEOPLE_API_PHONE_LOOKUP_TIMEOUT = 1397;
CP2_EXTENDED_DIRECTORY_PHONE_LOOKUP_TIMEOUT = 1398;
+
+ // Favorite general
+ FAVORITE_ADD_FAVORITE = 1399;
+ FAVORITE_OPEN_DISAMBIG_DIALOG = 1400;
+ FAVORITE_REMOVE_FAVORITE_BY_DRAG_AND_DROP = 1401;
+ FAVORITE_MOVE_FAVORITE_BY_DRAG_AND_DROP = 1402;
+ // Favorite menu
+ FAVORITE_OPEN_FAVORITE_MENU = 1403;
+ FAVORITE_SEND_MESSAGE = 1404;
+ FAVORITE_OPEN_CONTACT_CARD = 1405;
+ FAVORITE_REMOVE_FAVORITE = 1406; // Include drag and drop
+ // Favorite disambig
+ FAVORITE_SET_VIDEO_DEFAULT = 1407;
+ FAVORITE_SET_VOICE_DEFAULT = 1408;
}
}
diff --git a/java/com/android/dialer/speeddial/DisambigDialog.java b/java/com/android/dialer/speeddial/DisambigDialog.java
index 868f91d17..15b81098b 100644
--- a/java/com/android/dialer/speeddial/DisambigDialog.java
+++ b/java/com/android/dialer/speeddial/DisambigDialog.java
@@ -61,7 +61,7 @@ public class DisambigDialog extends DialogFragment {
private SpeedDialUiItem speedDialUiItem;
@VisibleForTesting public List<Channel> channels;
@VisibleForTesting public LinearLayout container;
- private CheckBox rememberThisChoice;
+ @VisibleForTesting public CheckBox rememberThisChoice;
/** Show a disambiguation dialog for a starred contact without a favorite communication avenue. */
public static DisambigDialog show(SpeedDialUiItem speedDialUiItem, FragmentManager manager) {
@@ -174,6 +174,7 @@ public class DisambigDialog extends DialogFragment {
private void onVideoOptionClicked(Channel channel) {
if (rememberThisChoice.isChecked()) {
+ Logger.get(getContext()).logImpression(DialerImpression.Type.FAVORITE_SET_VIDEO_DEFAULT);
setDefaultChannel(getContext().getApplicationContext(), speedDialUiItem, channel);
}
@@ -185,7 +186,7 @@ public class DisambigDialog extends DialogFragment {
PreCall.start(
getContext(),
- new CallIntentBuilder(channel.number(), CallInitiationType.Type.SPEED_DIAL)
+ new CallIntentBuilder(channel.number(), CallInitiationType.Type.SPEED_DIAL_DISAMBIG_DIALOG)
.setAllowAssistedDial(true)
.setIsVideoCall(true)
.setIsDuoCall(channel.technology() == Channel.DUO));
@@ -194,12 +195,13 @@ public class DisambigDialog extends DialogFragment {
private void onVoiceOptionClicked(Channel channel) {
if (rememberThisChoice.isChecked()) {
+ Logger.get(getContext()).logImpression(DialerImpression.Type.FAVORITE_SET_VOICE_DEFAULT);
setDefaultChannel(getContext().getApplicationContext(), speedDialUiItem, channel);
}
PreCall.start(
getContext(),
- new CallIntentBuilder(channel.number(), CallInitiationType.Type.SPEED_DIAL)
+ new CallIntentBuilder(channel.number(), CallInitiationType.Type.SPEED_DIAL_DISAMBIG_DIALOG)
.setAllowAssistedDial(true));
dismiss();
}
diff --git a/java/com/android/dialer/speeddial/SpeedDialFragment.java b/java/com/android/dialer/speeddial/SpeedDialFragment.java
index aabf28bcb..a958d443a 100644
--- a/java/com/android/dialer/speeddial/SpeedDialFragment.java
+++ b/java/com/android/dialer/speeddial/SpeedDialFragment.java
@@ -28,6 +28,7 @@ import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Contacts;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
+import android.support.annotation.VisibleForTesting;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
@@ -162,7 +163,7 @@ public class SpeedDialFragment extends Fragment {
recyclerView.setAdapter(adapter);
// Setup drag and drop touch helper
- ItemTouchHelper.Callback callback = new SpeedDialItemTouchHelperCallback(adapter);
+ ItemTouchHelper.Callback callback = new SpeedDialItemTouchHelperCallback(getContext(), adapter);
ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
touchHelper.attachToRecyclerView(recyclerView);
adapter.setItemTouchHelper(touchHelper);
@@ -249,6 +250,7 @@ public class SpeedDialFragment extends Fragment {
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == ActivityRequestCodes.SPEED_DIAL_ADD_FAVORITE) {
if (resultCode == AppCompatActivity.RESULT_OK && data.getData() != null) {
+ Logger.get(getContext()).logImpression(DialerImpression.Type.FAVORITE_ADD_FAVORITE);
updateSpeedDialItemsOnResume = false;
speedDialLoaderListener.listen(
getContext(),
@@ -335,7 +337,8 @@ public class SpeedDialFragment extends Fragment {
}
}
- private static final class SpeedDialFavoritesListener implements FavoriteContactsListener {
+ @VisibleForTesting
+ static final class SpeedDialFavoritesListener implements FavoriteContactsListener {
private final FragmentActivity activity;
private final FragmentManager childFragmentManager;
@@ -369,6 +372,7 @@ public class SpeedDialFragment extends Fragment {
return;
}
+ Logger.get(activity).logImpression(DialerImpression.Type.FAVORITE_OPEN_DISAMBIG_DIALOG);
DisambigDialog.show(speedDialUiItem, childFragmentManager);
}
@@ -389,6 +393,7 @@ public class SpeedDialFragment extends Fragment {
@Override
public void showContextMenu(View view, SpeedDialUiItem speedDialUiItem) {
+ Logger.get(activity).logImpression(DialerImpression.Type.FAVORITE_OPEN_FAVORITE_MENU);
layoutManager.setScrollEnabled(false);
contextMenu =
ContextMenu.show(activity, view, speedDialContextMenuItemListener, speedDialUiItem);
@@ -406,6 +411,8 @@ public class SpeedDialFragment extends Fragment {
@Override
public void onRequestRemove(SpeedDialUiItem speedDialUiItem) {
+ Logger.get(activity)
+ .logImpression(DialerImpression.Type.FAVORITE_REMOVE_FAVORITE_BY_DRAG_AND_DROP);
speedDialContextMenuItemListener.removeFavoriteContact(speedDialUiItem);
}
@@ -439,11 +446,13 @@ public class SpeedDialFragment extends Fragment {
@Override
public void openSmsConversation(String number) {
+ Logger.get(activity).logImpression(DialerImpression.Type.FAVORITE_SEND_MESSAGE);
activity.startActivity(IntentUtil.getSendSmsIntent(number));
}
@Override
public void removeFavoriteContact(SpeedDialUiItem speedDialUiItem) {
+ Logger.get(activity).logImpression(DialerImpression.Type.FAVORITE_REMOVE_FAVORITE);
speedDialLoaderListener.listen(
activity,
UiItemLoaderComponent.get(activity)
@@ -457,6 +466,7 @@ public class SpeedDialFragment extends Fragment {
@Override
public void openContactInfo(SpeedDialUiItem speedDialUiItem) {
+ Logger.get(activity).logImpression(DialerImpression.Type.FAVORITE_OPEN_CONTACT_CARD);
activity.startActivity(
new Intent(
Intent.ACTION_VIEW,
diff --git a/java/com/android/dialer/speeddial/draghelper/SpeedDialItemTouchHelperCallback.java b/java/com/android/dialer/speeddial/draghelper/SpeedDialItemTouchHelperCallback.java
index fc963a1a3..2f5d87c76 100644
--- a/java/com/android/dialer/speeddial/draghelper/SpeedDialItemTouchHelperCallback.java
+++ b/java/com/android/dialer/speeddial/draghelper/SpeedDialItemTouchHelperCallback.java
@@ -16,17 +16,21 @@
package com.android.dialer.speeddial.draghelper;
+import android.content.Context;
import android.graphics.Canvas;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.support.v7.widget.helper.ItemTouchHelper;
+import com.android.dialer.logging.DialerImpression;
+import com.android.dialer.logging.Logger;
/** {@link ItemTouchHelper} for Speed Dial favorite contacts. */
public class SpeedDialItemTouchHelperCallback extends ItemTouchHelper.Callback {
private final ItemTouchHelperAdapter adapter;
+ private final Context context;
// When dragged item is in removeView, onMove() and onChildDraw() are called in turn. This
// behavior changes when dragged item entering/leaving removeView. The boolean field
@@ -34,7 +38,8 @@ public class SpeedDialItemTouchHelperCallback extends ItemTouchHelper.Callback {
private boolean movedOverRemoveView;
private boolean inRemoveView;
- public SpeedDialItemTouchHelperCallback(ItemTouchHelperAdapter adapter) {
+ public SpeedDialItemTouchHelperCallback(Context context, ItemTouchHelperAdapter adapter) {
+ this.context = context;
this.adapter = adapter;
}
@@ -91,6 +96,20 @@ public class SpeedDialItemTouchHelperCallback extends ItemTouchHelper.Callback {
}
@Override
+ public void onMoved(
+ @NonNull RecyclerView recyclerView,
+ @NonNull ViewHolder viewHolder,
+ int fromPos,
+ @NonNull ViewHolder viewHolder1,
+ int toPos,
+ int x,
+ int y) {
+ Logger.get(context)
+ .logImpression(DialerImpression.Type.FAVORITE_MOVE_FAVORITE_BY_DRAG_AND_DROP);
+ super.onMoved(recyclerView, viewHolder, fromPos, viewHolder1, toPos, x, y);
+ }
+
+ @Override
public void onChildDraw(
@NonNull Canvas canvas,
@NonNull RecyclerView recyclerView,