summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2017-11-27 13:22:48 -0800
committerCopybara-Service <copybara-piper@google.com>2017-11-29 11:40:40 -0800
commitfc1f9cfd47a3685c5a7b1425bc02c01371044cb5 (patch)
tree6adb0553668ce47d046f734fd7f59f0efb62c768 /java
parent9c93611edcb369f4e4ac7cff5c261bd1da65c347 (diff)
Add impressions for dual sim features
Bug: 69618691 Test: CallingAccountSelectorTest PiperOrigin-RevId: 177062349 Change-Id: I4bc9098d06c541b607cca293269cf3489077b6c2
Diffstat (limited to 'java')
-rw-r--r--java/com/android/dialer/logging/dialer_impression.proto19
-rw-r--r--java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java3
-rw-r--r--java/com/android/dialer/precall/impl/CallingAccountSelector.java45
-rw-r--r--java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java3
-rw-r--r--java/com/android/dialer/precall/impl/PreCallImpl.java3
-rw-r--r--java/com/android/incallui/CallButtonPresenter.java2
6 files changed, 72 insertions, 3 deletions
diff --git a/java/com/android/dialer/logging/dialer_impression.proto b/java/com/android/dialer/logging/dialer_impression.proto
index c2456d8ac..2bbce0d25 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: 1293
+ // Next Tag: 1308
enum Type {
UNKNOWN_AOSP_EVENT_TYPE = 1000;
@@ -604,5 +604,22 @@ message DialerImpression {
1291
;
+
+ PRECALL_INITIATED = 1293;
+ PRECALL_INITIATED_EXTERNAL = 1294;
+ PRECALL_CANCELED = 1295;
+
+ DUAL_SIM_CHANGE_SIM_PRESSED = 1296;
+ DUAL_SIM_SELECTION_SHOWN = 1297;
+ DUAL_SIM_SELECTION_VOICEMAIL = 1298;
+ DUAL_SIM_SELECTION_IN_CONTACTS = 1299;
+ DUAL_SIM_SELECTION_SUGGESTION_AVAILABLE = 1300;
+ DUAL_SIM_SELECTION_SUGGESTED_CARRIER = 1301;
+ DUAL_SIM_SELECTION_SUGGESTED_FREQUENCY = 1302;
+ DUAL_SIM_SELECTION_SUGGESTED_SIM_SELECTED = 1303;
+ DUAL_SIM_SELECTION_NON_SUGGESTED_SIM_SELECTED = 1304;
+ DUAL_SIM_SELECTION_PREFERRED_SET = 1305;
+ DUAL_SIM_SELECTION_PREFERRED_USED = 1306;
+ DUAL_SIM_SELECTION_GLOBAL_USED = 1307;
}
}
diff --git a/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java b/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java
index 121e6a6c9..a7811fe6a 100644
--- a/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java
+++ b/java/com/android/dialer/precall/externalreceiver/LaunchPreCallActivity.java
@@ -23,6 +23,8 @@ import android.os.Bundle;
import android.support.annotation.Nullable;
import com.android.dialer.callintent.CallInitiationType.Type;
import com.android.dialer.callintent.CallIntentBuilder;
+import com.android.dialer.logging.DialerImpression;
+import com.android.dialer.logging.Logger;
import com.android.dialer.precall.PreCall;
/**
@@ -47,6 +49,7 @@ public class LaunchPreCallActivity extends Activity {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Logger.get(this).logImpression(DialerImpression.Type.PRECALL_INITIATED_EXTERNAL);
Intent intent = getIntent();
CallIntentBuilder builder = new CallIntentBuilder(intent.getData(), Type.EXTERNAL_INITIATION);
builder
diff --git a/java/com/android/dialer/precall/impl/CallingAccountSelector.java b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
index 5d928b4fb..a61a3b1c6 100644
--- a/java/com/android/dialer/precall/impl/CallingAccountSelector.java
+++ b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
@@ -47,6 +47,9 @@ import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.DialerExecutor.Worker;
import com.android.dialer.common.concurrent.DialerExecutorComponent;
import com.android.dialer.configprovider.ConfigProviderBindings;
+import com.android.dialer.logging.DialerImpression;
+import com.android.dialer.logging.DialerImpression.Type;
+import com.android.dialer.logging.Logger;
import com.android.dialer.precall.PreCallAction;
import com.android.dialer.precall.PreCallCoordinator;
import com.android.dialer.precall.PreCallCoordinator.PendingAction;
@@ -116,6 +119,7 @@ public class CallingAccountSelector implements PreCallAction {
switch (builder.getUri().getScheme()) {
case PhoneAccount.SCHEME_VOICEMAIL:
showDialog(coordinator, coordinator.startPendingAction(), null, null, null);
+ Logger.get(coordinator.getActivity()).logImpression(Type.DUAL_SIM_SELECTION_VOICEMAIL);
break;
case PhoneAccount.SCHEME_TEL:
processPreferredAccount(coordinator);
@@ -146,6 +150,8 @@ public class CallingAccountSelector implements PreCallAction {
return;
}
if (result.phoneAccountHandle.isPresent()) {
+ Logger.get(coordinator.getActivity())
+ .logImpression(DialerImpression.Type.DUAL_SIM_SELECTION_PREFERRED_USED);
coordinator.getBuilder().setPhoneAccountHandle(result.phoneAccountHandle.get());
pendingAction.finish();
return;
@@ -155,6 +161,8 @@ public class CallingAccountSelector implements PreCallAction {
.getSystemService(TelecomManager.class)
.getDefaultOutgoingPhoneAccount(builder.getUri().getScheme());
if (defaultPhoneAccount != null) {
+ Logger.get(coordinator.getActivity())
+ .logImpression(DialerImpression.Type.DUAL_SIM_SELECTION_GLOBAL_USED);
builder.setPhoneAccountHandle(defaultPhoneAccount);
pendingAction.finish();
return;
@@ -183,6 +191,25 @@ public class CallingAccountSelector implements PreCallAction {
@Nullable String number,
@Nullable Suggestion suggestion) {
Assert.isMainThread();
+ Logger.get(coordinator.getActivity()).logImpression(Type.DUAL_SIM_SELECTION_SHOWN);
+ if (dataId != null) {
+ Logger.get(coordinator.getActivity()).logImpression(Type.DUAL_SIM_SELECTION_IN_CONTACTS);
+ }
+ if (suggestion != null) {
+ Logger.get(coordinator.getActivity())
+ .logImpression(Type.DUAL_SIM_SELECTION_SUGGESTION_AVAILABLE);
+ switch (suggestion.reason) {
+ case INTRA_CARRIER:
+ Logger.get(coordinator.getActivity())
+ .logImpression(Type.DUAL_SIM_SELECTION_SUGGESTED_CARRIER);
+ break;
+ case FREQUENT:
+ Logger.get(coordinator.getActivity())
+ .logImpression(Type.DUAL_SIM_SELECTION_SUGGESTED_FREQUENCY);
+ break;
+ default:
+ }
+ }
List<PhoneAccountHandle> phoneAccountHandles =
coordinator
.getActivity()
@@ -194,7 +221,7 @@ public class CallingAccountSelector implements PreCallAction {
dataId != null /* canSetDefault */,
R.string.pre_call_select_phone_account_remember,
phoneAccountHandles,
- new SelectedListener(coordinator, pendingAction, dataId, number),
+ new SelectedListener(coordinator, pendingAction, dataId, number, suggestion),
null /* call ID */,
buildHint(coordinator.getActivity(), phoneAccountHandles, suggestion));
selectPhoneAccountDialogFragment.show(
@@ -351,25 +378,39 @@ public class CallingAccountSelector implements PreCallAction {
private final PreCallCoordinator.PendingAction listener;
private final String dataId;
private final String number;
+ private final Suggestion suggestion;
public SelectedListener(
@NonNull PreCallCoordinator builder,
@NonNull PreCallCoordinator.PendingAction listener,
@Nullable String dataId,
- @Nullable String number) {
+ @Nullable String number,
+ @Nullable Suggestion suggestion) {
this.coordinator = Assert.isNotNull(builder);
this.listener = Assert.isNotNull(listener);
this.dataId = dataId;
this.number = number;
+ this.suggestion = suggestion;
}
@MainThread
@Override
public void onPhoneAccountSelected(
PhoneAccountHandle selectedAccountHandle, boolean setDefault, @Nullable String callId) {
+ if (suggestion != null) {
+ if (suggestion.phoneAccountHandle.equals(selectedAccountHandle)) {
+ Logger.get(coordinator.getActivity())
+ .logImpression(DialerImpression.Type.DUAL_SIM_SELECTION_SUGGESTED_SIM_SELECTED);
+ } else {
+ Logger.get(coordinator.getActivity())
+ .logImpression(DialerImpression.Type.DUAL_SIM_SELECTION_NON_SUGGESTED_SIM_SELECTED);
+ }
+ }
coordinator.getBuilder().setPhoneAccountHandle(selectedAccountHandle);
if (dataId != null && setDefault) {
+ Logger.get(coordinator.getActivity())
+ .logImpression(DialerImpression.Type.DUAL_SIM_SELECTION_PREFERRED_SET);
DialerExecutorComponent.get(coordinator.getActivity())
.dialerExecutorFactory()
.createNonUiTaskBuilder(new WritePreferredAccountWorker())
diff --git a/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java b/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java
index 94ba90d75..36af62245 100644
--- a/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java
+++ b/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java
@@ -24,6 +24,8 @@ import android.support.annotation.Nullable;
import com.android.dialer.callintent.CallIntentBuilder;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
+import com.android.dialer.logging.DialerImpression.Type;
+import com.android.dialer.logging.Logger;
import com.android.dialer.precall.PreCallAction;
import com.android.dialer.precall.PreCallComponent;
import com.android.dialer.precall.PreCallCoordinator;
@@ -116,6 +118,7 @@ public class PreCallCoordinatorImpl implements PreCallCoordinator {
public void abortCall() {
Assert.checkState(currentAction != null);
aborted = true;
+ Logger.get(getActivity()).logImpression(Type.PRECALL_CANCELED);
}
@NonNull
diff --git a/java/com/android/dialer/precall/impl/PreCallImpl.java b/java/com/android/dialer/precall/impl/PreCallImpl.java
index 1c78bb8b0..b9c9d8873 100644
--- a/java/com/android/dialer/precall/impl/PreCallImpl.java
+++ b/java/com/android/dialer/precall/impl/PreCallImpl.java
@@ -21,6 +21,8 @@ import android.content.Intent;
import android.support.annotation.NonNull;
import com.android.dialer.callintent.CallIntentBuilder;
import com.android.dialer.common.LogUtil;
+import com.android.dialer.logging.DialerImpression;
+import com.android.dialer.logging.Logger;
import com.android.dialer.precall.PreCall;
import com.android.dialer.precall.PreCallAction;
import com.android.dialer.precall.PreCallComponent;
@@ -42,6 +44,7 @@ public class PreCallImpl implements PreCall {
@NonNull
@Override
public Intent buildIntent(Context context, CallIntentBuilder builder) {
+ Logger.get(context).logImpression(DialerImpression.Type.PRECALL_INITIATED);
if (!requiresUi(context, builder)) {
LogUtil.i("PreCallImpl.buildIntent", "No UI requested, running pre-call directly");
for (PreCallAction action : PreCallComponent.get(context).getPreCall().getActions()) {
diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java
index bd3ba6dc6..6b316bef8 100644
--- a/java/com/android/incallui/CallButtonPresenter.java
+++ b/java/com/android/incallui/CallButtonPresenter.java
@@ -28,6 +28,7 @@ import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.DialerExecutorComponent;
import com.android.dialer.logging.DialerImpression;
+import com.android.dialer.logging.DialerImpression.Type;
import com.android.dialer.logging.Logger;
import com.android.dialer.telecom.TelecomUtil;
import com.android.incallui.InCallCameraManager.Listener;
@@ -318,6 +319,7 @@ public class CallButtonPresenter
@Override
public void swapSimClicked() {
LogUtil.enterBlock("CallButtonPresenter.swapSimClicked");
+ Logger.get(getContext()).logImpression(Type.DUAL_SIM_CHANGE_SIM_PRESSED);
SwapSimWorker worker =
new SwapSimWorker(
getContext(),