From dde01c59422e1316fc51e53337e1a21dd2ffa480 Mon Sep 17 00:00:00 2001 From: twyen Date: Fri, 22 Sep 2017 10:07:31 -0700 Subject: Log non-contact lightbringer actions video call upgrade and calling from call log is logged Bug: 66222115 Test: DialerCallTest, GoogleCallLogAdapterTest PiperOrigin-RevId: 169703001 Change-Id: Ib4dc3507dec09f49d41cec09d32cc9800477ee8b --- .../app/calllog/CallLogListItemViewHolder.java | 13 ++++++++++++ .../android/dialer/logging/dialer_impression.proto | 4 ++++ java/com/android/incallui/call/DialerCall.java | 23 ++++++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index 301d89576..60acb55fc 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -80,6 +80,7 @@ import com.android.dialer.lettertile.LetterTileDrawable.ContactType; import com.android.dialer.lightbringer.Lightbringer; import com.android.dialer.lightbringer.LightbringerComponent; import com.android.dialer.logging.ContactSource; +import com.android.dialer.logging.ContactSource.Type; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.InteractionEvent; import com.android.dialer.logging.Logger; @@ -925,6 +926,11 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder if (packageName != null && packageName.equals(getLightbringer().getPackageName())) { Logger.get(mContext) .logImpression(DialerImpression.Type.LIGHTBRINGER_VIDEO_REQUESTED_FROM_CALL_LOG); + if (isNonContactEntry(info)) { + Logger.get(mContext) + .logImpression( + DialerImpression.Type.LIGHTBRINGER_NON_CONTACT_VIDEO_REQUESTED_FROM_CALL_LOG); + } startLightbringerActivity(intent); } else if (CallDetailsActivity.isLaunchIntent(intent)) { PerformanceReport.recordClick(UiAction.Type.OPEN_CALL_DETAIL); @@ -942,6 +948,13 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder } } + private static boolean isNonContactEntry(ContactInfo info) { + if (info == null || info.sourceType != Type.SOURCE_TYPE_DIRECTORY) { + return true; + } + return false; + } + private void startLightbringerActivity(Intent intent) { try { Activity activity = (Activity) mContext; diff --git a/java/com/android/dialer/logging/dialer_impression.proto b/java/com/android/dialer/logging/dialer_impression.proto index ed3866a92..d5f1963d2 100644 --- a/java/com/android/dialer/logging/dialer_impression.proto +++ b/java/com/android/dialer/logging/dialer_impression.proto @@ -547,5 +547,9 @@ message DialerImpression { SWITCH_TAB_TO_CALL_LOG_BY_CLICK = 1278; SWITCH_TAB_TO_CONTACTS_BY_CLICK = 1279; SWITCH_TAB_TO_VOICEMAIL_BY_CLICK = 1280; + + LIGHTBRINGER_NON_CONTACT_UPGRADE_REQUESTED = 1281; + LIGHTBRINGER_NON_CONTACT_VIDEO_REQUESTED_FROM_CALL_LOG = + 1282; // Including call history } } diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index ee9a92609..a9bad5b58 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -26,6 +26,7 @@ import android.os.Trace; import android.support.annotation.IntDef; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.annotation.VisibleForTesting; import android.telecom.Call; import android.telecom.Call.Details; import android.telecom.CallAudioState; @@ -57,6 +58,7 @@ import com.android.dialer.enrichedcall.EnrichedCallManager.StateChangedListener; import com.android.dialer.enrichedcall.Session; import com.android.dialer.lightbringer.LightbringerComponent; import com.android.dialer.logging.ContactLookupResult; +import com.android.dialer.logging.ContactLookupResult.Type; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.theme.R; @@ -320,6 +322,18 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa updateEnrichedCallSession(); } + /** Test only constructor to avoid initializing dependencies. */ + @VisibleForTesting + DialerCall(Context context) { + mContext = context; + mTelecomCall = null; + mLatencyReport = null; + mId = null; + mHiddenId = 0; + mDialerCallDelegate = null; + mVideoTechManager = null; + } + private static int translateState(int state) { switch (state) { case Call.STATE_NEW: @@ -1250,6 +1264,15 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa @Override public void onImpressionLoggingNeeded(DialerImpression.Type impressionType) { Logger.get(mContext).logCallImpression(impressionType, getUniqueCallId(), getTimeAddedMs()); + if (impressionType == DialerImpression.Type.LIGHTBRINGER_UPGRADE_REQUESTED) { + if (getLogState().contactLookupResult == Type.NOT_FOUND) { + Logger.get(mContext) + .logCallImpression( + DialerImpression.Type.LIGHTBRINGER_NON_CONTACT_UPGRADE_REQUESTED, + getUniqueCallId(), + getTimeAddedMs()); + } + } } private void updateEnrichedCallSession() { -- cgit v1.2.3