diff options
author | yueg <yueg@google.com> | 2018-04-27 14:00:12 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-28 22:26:26 -0700 |
commit | b493c3f93c3560cca8cb91525f043538d3721cd2 (patch) | |
tree | e57e695fa1de3f6b7b1296e15b61d78db757a0e2 | |
parent | 9bd6277786305f98dd85c4256f228b3ae191e05d (diff) |
Logging for background calling and HFP device support.
Bug: 74022483,74238896
Test: InCallPresenterTest, AudioRouteSelectorDialogFragmentTest
PiperOrigin-RevId: 194589147
Change-Id: If8c6e79838d27b1ca33ed677c19f6555cbdb4494
3 files changed, 54 insertions, 8 deletions
diff --git a/java/com/android/dialer/logging/dialer_impression.proto b/java/com/android/dialer/logging/dialer_impression.proto index 7cd22079c..55cef9a38 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: 1392 + // Next Tag: 1397 enum Type { UNKNOWN_AOSP_EVENT_TYPE = 1000; @@ -770,5 +770,14 @@ message DialerImpression { // Send button clicked in RTT call, this includes send button on keyboard. RTT_SEND_BUTTON_CLICKED = 1387; RTT_KEYBOARD_SEND_BUTTON_CLICKED = 1388; + + // For background calling + START_CALL_IN_BUBBLE_MODE = 1392; + + // Switch audio route + IN_CALL_SWITCH_AUDIO_ROUTE_SPEAKER = 1393; + IN_CALL_SWITCH_AUDIO_ROUTE_WIRED_HEADSET = 1394; + IN_CALL_SWITCH_AUDIO_ROUTE_EARPIECE = 1395; + IN_CALL_SWITCH_AUDIO_ROUTE_BLUETOOTH = 1396; } } diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index 6e7daf551..6386c56be 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -52,6 +52,7 @@ import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.enrichedcall.EnrichedCallComponent; import com.android.dialer.location.GeoUtil; +import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.InteractionEvent; import com.android.dialer.logging.Logger; import com.android.dialer.postcall.PostCall; @@ -429,7 +430,15 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud } Bundle extras = dialerCall.getIntentExtras(); - return shouldStartInBubbleModeWithExtras(extras); + boolean result = shouldStartInBubbleModeWithExtras(extras); + if (result) { + Logger.get(context) + .logCallImpression( + DialerImpression.Type.START_CALL_IN_BUBBLE_MODE, + dialerCall.getUniqueCallId(), + dialerCall.getTimeAddedMs()); + } + return result; } private boolean shouldStartInBubbleModeWithExtras(Bundle outgoingExtras) { diff --git a/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java b/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java index 316dd128b..cd17c25da 100644 --- a/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java +++ b/java/com/android/incallui/audioroute/AudioRouteSelectorDialogFragment.java @@ -35,7 +35,11 @@ import android.widget.LinearLayout; import android.widget.TextView; import com.android.dialer.common.FragmentUtils; import com.android.dialer.common.LogUtil; +import com.android.dialer.logging.DialerImpression; +import com.android.dialer.logging.Logger; import com.android.incallui.audiomode.BluetoothDeviceProviderComponent; +import com.android.incallui.call.CallList; +import com.android.incallui.call.DialerCall; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Set; @@ -101,15 +105,18 @@ public class AudioRouteSelectorDialogFragment extends BottomSheetDialogFragment initItem( (TextView) view.findViewById(R.id.audioroute_speaker), CallAudioState.ROUTE_SPEAKER, - audioState); + audioState, + DialerImpression.Type.IN_CALL_SWITCH_AUDIO_ROUTE_SPEAKER); initItem( (TextView) view.findViewById(R.id.audioroute_headset), CallAudioState.ROUTE_WIRED_HEADSET, - audioState); + audioState, + DialerImpression.Type.IN_CALL_SWITCH_AUDIO_ROUTE_WIRED_HEADSET); initItem( (TextView) view.findViewById(R.id.audioroute_earpiece), CallAudioState.ROUTE_EARPIECE, - audioState); + audioState, + DialerImpression.Type.IN_CALL_SWITCH_AUDIO_ROUTE_EARPIECE); // TODO(a bug): set peak height correctly to fully expand it in landscape mode. return view; @@ -123,7 +130,11 @@ public class AudioRouteSelectorDialogFragment extends BottomSheetDialogFragment .onAudioRouteSelectorDismiss(); } - private void initItem(TextView item, final int itemRoute, CallAudioState audioState) { + private void initItem( + TextView item, + final int itemRoute, + CallAudioState audioState, + DialerImpression.Type impressionType) { int selectedColor = getResources().getColor(R.color.dialer_theme_color); if ((audioState.getSupportedRouteMask() & itemRoute) == 0) { item.setVisibility(View.GONE); @@ -134,10 +145,11 @@ public class AudioRouteSelectorDialogFragment extends BottomSheetDialogFragment } item.setOnClickListener( (v) -> { - dismiss(); + logCallAudioRouteImpression(impressionType); FragmentUtils.getParentUnsafe( AudioRouteSelectorDialogFragment.this, AudioRouteSelectorPresenter.class) .onAudioRouteSelected(itemRoute); + dismiss(); }); } @@ -153,7 +165,7 @@ public class AudioRouteSelectorDialogFragment extends BottomSheetDialogFragment } textView.setOnClickListener( (v) -> { - dismiss(); + logCallAudioRouteImpression(DialerImpression.Type.IN_CALL_SWITCH_AUDIO_ROUTE_BLUETOOTH); // Set Bluetooth audio route FragmentUtils.getParentUnsafe( AudioRouteSelectorDialogFragment.this, AudioRouteSelectorPresenter.class) @@ -162,6 +174,7 @@ public class AudioRouteSelectorDialogFragment extends BottomSheetDialogFragment BluetoothDeviceProviderComponent.get(getContext()) .bluetoothDeviceProvider() .setActiveBluetoothDevice(bluetoothDevice); + dismiss(); }); return textView; @@ -178,4 +191,19 @@ public class AudioRouteSelectorDialogFragment extends BottomSheetDialogFragment return bluetoothDevice.getName(); } } + + private void logCallAudioRouteImpression(DialerImpression.Type impressionType) { + DialerCall dialerCall = CallList.getInstance().getOutgoingCall(); + if (dialerCall == null) { + dialerCall = CallList.getInstance().getActiveOrBackgroundCall(); + } + + if (dialerCall != null) { + Logger.get(getContext()) + .logCallImpression( + impressionType, dialerCall.getUniqueCallId(), dialerCall.getTimeAddedMs()); + } else { + Logger.get(getContext()).logImpression(impressionType); + } + } } |