diff options
author | yueg <yueg@google.com> | 2017-06-26 15:57:30 -0700 |
---|---|---|
committer | Brandon Maxwell <maxwelb@google.com> | 2017-06-30 14:34:02 -0700 |
commit | 2fc6b457f20cc91566097ef33ea067c068cb18ba (patch) | |
tree | 9d8b276e2da86e43b844cad00555891b8575677c | |
parent | a60579e8f6abff88814d940f9da51e22788d6007 (diff) |
Move video call logging from IntentProvider to CallLogListItemViewHolder.
This prevents accidental logging.
Test: GoogleCallLogAdapterTest, CallLogListItemViewHolderTest
PiperOrigin-RevId: 160207870
Change-Id: Ib0582613979114c24bb0bd38df41ad7d7dadb63a
3 files changed, 13 insertions, 7 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index d0ba31f40..213fde8cd 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -35,6 +35,8 @@ import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; +import android.telecom.TelecomManager; +import android.telecom.VideoProfile; import android.telephony.PhoneNumberUtils; import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; @@ -894,12 +896,20 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder // intents need to be started using startActivityForResult instead of the usual startActivity String packageName = intent.getPackage(); if (packageName != null && packageName.equals(getLightbringer().getPackageName())) { + Logger.get(mContext) + .logImpression(DialerImpression.Type.LIGHTBRINGER_VIDEO_REQUESTED_FROM_CALL_LOG); startLightbringerActivity(intent); } else if (CallDetailsActivity.isLaunchIntent(intent)) { PerformanceReport.recordClick(UiAction.Type.OPEN_CALL_DETAIL); ((Activity) mContext) .startActivityForResult(intent, DialtactsActivity.ACTIVITY_REQUEST_CODE_CALL_DETAILS); } else { + if (Intent.ACTION_CALL.equals(intent.getAction()) + && intent.getIntExtra(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, -1) + == VideoProfile.STATE_BIDIRECTIONAL) { + Logger.get(mContext) + .logImpression(DialerImpression.Type.IMS_VIDEO_REQUESTED_FROM_CALL_LOG); + } DialerUtils.startActivityWithErrorToast(mContext, intent); } } diff --git a/java/com/android/dialer/app/calllog/IntentProvider.java b/java/com/android/dialer/app/calllog/IntentProvider.java index e1ec9f509..55fdbbace 100644 --- a/java/com/android/dialer/app/calllog/IntentProvider.java +++ b/java/com/android/dialer/app/calllog/IntentProvider.java @@ -30,8 +30,6 @@ import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.dialercontact.DialerContact; import com.android.dialer.lightbringer.LightbringerComponent; -import com.android.dialer.logging.DialerImpression; -import com.android.dialer.logging.Logger; import com.android.dialer.util.CallUtil; import com.android.dialer.util.IntentUtil; import java.util.ArrayList; @@ -70,7 +68,6 @@ public abstract class IntentProvider { return new IntentProvider() { @Override public Intent getIntent(Context context) { - Logger.get(context).logImpression(DialerImpression.Type.IMS_VIDEO_REQUESTED_FROM_CALL_LOG); return new CallIntentBuilder(number, CallInitiationType.Type.CALL_LOG) .setPhoneAccountHandle(accountHandle) .setIsVideoCall(true) @@ -83,8 +80,6 @@ public abstract class IntentProvider { return new IntentProvider() { @Override public Intent getIntent(Context context) { - Logger.get(context) - .logImpression(DialerImpression.Type.LIGHTBRINGER_VIDEO_REQUESTED_FROM_CALL_LOG); return LightbringerComponent.get(context).getLightbringer().getIntent(context, number); } }; diff --git a/java/com/android/dialer/logging/dialer_impression.proto b/java/com/android/dialer/logging/dialer_impression.proto index bc35900af..19beca35c 100644 --- a/java/com/android/dialer/logging/dialer_impression.proto +++ b/java/com/android/dialer/logging/dialer_impression.proto @@ -423,9 +423,10 @@ message DialerImpression { BUBBLE_END_CALL = 1195; LIGHTBRINGER_VIDEO_REQUESTED_FROM_SEARCH = 1196; - LIGHTBRINGER_VIDEO_REQUESTED_FROM_CALL_LOG = 1197; + LIGHTBRINGER_VIDEO_REQUESTED_FROM_CALL_LOG = + 1197; // Including call history IMS_VIDEO_REQUESTED_FROM_SEARCH = 1198; - IMS_VIDEO_REQUESTED_FROM_CALL_LOG = 1199; + IMS_VIDEO_REQUESTED_FROM_CALL_LOG = 1199; // Including call history // Multi select impressions MULTISELECT_LONG_PRESS_ENTER_MULTI_SELECT_MODE = 1200; |