summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-11-21 03:22:56 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-11-21 03:22:56 +0000
commita3990fc2f6450cbd8c2376d0533a4120c239b38b (patch)
tree97d069219555b8ea5b4f0deaa067231be678cdbb
parent861bb9d4402c1b9ee68e9382570f0fca3783478e (diff)
parent236d6dbb0f6a7d352345b0a59fa21499ad55c2d5 (diff)
Merge changes I73982924,Ic0747302,I8202a760,Icd66f8eb,I17091560, ...
* changes: Quick fix recursively importing. Add impression to track when users explicitly disable assisted dialing. Initialize executors before updating change PIN state Remove assert on StubVoicemailClient.addActivationStateListener() Implement SIM selection dialog Clear pendingAction when pausing PreCallCoordinator Add fast database populating button for benefit of testing.
-rw-r--r--java/com/android/contacts/common/res/layout/default_account_checkbox.xml42
-rw-r--r--java/com/android/contacts/common/res/layout/select_account_list_item.xml70
-rw-r--r--java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java57
-rw-r--r--java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java17
-rw-r--r--java/com/android/dialer/databasepopulator/CallLogPopulator.java17
-rw-r--r--java/com/android/dialer/databasepopulator/ContactsPopulator.java16
-rw-r--r--java/com/android/dialer/databasepopulator/VoicemailPopulator.java21
-rw-r--r--java/com/android/dialer/logging/dialer_impression.proto3
-rw-r--r--java/com/android/dialer/precall/impl/CallingAccountSelector.java45
-rw-r--r--java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java1
-rw-r--r--java/com/android/dialer/precall/impl/res/values/strings.xml12
-rw-r--r--java/com/android/dialer/simulator/impl/SimulatorMainMenu.java31
-rw-r--r--java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java14
-rw-r--r--java/com/android/incallui/InCallActivityCommon.java4
-rw-r--r--java/com/android/voicemail/stub/StubVoicemailClient.java4
15 files changed, 273 insertions, 81 deletions
diff --git a/java/com/android/contacts/common/res/layout/default_account_checkbox.xml b/java/com/android/contacts/common/res/layout/default_account_checkbox.xml
index b7c0cf644..1e76b74f5 100644
--- a/java/com/android/contacts/common/res/layout/default_account_checkbox.xml
+++ b/java/com/android/contacts/common/res/layout/default_account_checkbox.xml
@@ -15,22 +15,36 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/default_account_checkbox_layout"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:padding="4dp"
- android:orientation="vertical">
- <CheckBox
- android:id="@+id/default_account_checkbox_view"
+ android:id="@+id/default_account_checkbox_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="20dip"
- android:layout_marginLeft="13dip"
- android:paddingStart="15dip"
+ android:padding="4dp"
+ android:paddingStart="0dp"
+ android:paddingEnd="24dp"
android:gravity="center"
- android:text="@string/set_default_account"
- android:textAlignment="viewStart"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="@color/dialer_secondary_text_color"
+ android:minHeight="56dp"
+ android:orientation="horizontal"
+ android:focusable="true">
+ <FrameLayout
+ android:layout_width="72dp"
+ android:layout_height="wrap_content">
+ <CheckBox
+ android:id="@+id/default_account_checkbox_view"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:checked="false"/>
/>
+ </FrameLayout>
+ <TextView
+ android:id="@+id/default_account_checkbox_text"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/set_default_account"
+ android:textAlignment="viewStart"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="@color/dialer_secondary_text_color"
+ />
+
</LinearLayout>
diff --git a/java/com/android/contacts/common/res/layout/select_account_list_item.xml b/java/com/android/contacts/common/res/layout/select_account_list_item.xml
index fbd31e573..8f7cc7017 100644
--- a/java/com/android/contacts/common/res/layout/select_account_list_item.xml
+++ b/java/com/android/contacts/common/res/layout/select_account_list_item.xml
@@ -16,41 +16,53 @@
<!-- Layout of a single item in the InCallUI Account Chooser Dialog. -->
<com.android.contacts.common.widget.ActivityTouchLinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:padding="8dp"
- android:orientation="horizontal">
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="64dp"
+ android:padding="8dp"
+ android:paddingStart="24dp"
+ android:paddingEnd="24dp"
+ android:orientation="horizontal"
+ android:gravity="center">
<ImageView
- android:id="@+id/icon"
- android:layout_width="48dp"
- android:layout_height="48dp"
- android:scaleType="center"/>
+ android:id="@+id/icon"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:scaleType="center"/>
<LinearLayout
- android:id="@+id/text"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_marginStart="8dp"
- android:gravity="start|center_vertical"
- android:orientation="vertical">
- <TextView
- android:id="@+id/label"
- android:layout_width="match_parent"
+ android:id="@+id/text"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
- android:includeFontPadding="false"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="@color/dialer_primary_text_color"/>
+ android:layout_weight="1"
+ android:paddingStart="24dp"
+ android:gravity="start|center_vertical"
+ android:orientation="vertical">
<TextView
- android:id="@+id/number"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:includeFontPadding="false"
- android:maxLines="1"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:visibility="gone"/>
+ android:id="@+id/label"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:includeFontPadding="false"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="@color/dialer_primary_text_color"/>
+ <TextView
+ android:id="@+id/number"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:includeFontPadding="false"
+ android:maxLines="1"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:visibility="gone"/>
+ <TextView
+ android:id="@+id/hint"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:includeFontPadding="false"
+ android:maxLines="1"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:visibility="gone"/>
</LinearLayout>
</com.android.contacts.common.widget.ActivityTouchLinearLayout>
diff --git a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java
index e21fded97..3c9d9268f 100644
--- a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java
+++ b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java
@@ -55,12 +55,15 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
private static final String ARG_TITLE_RES_ID = "title_res_id";
private static final String ARG_CAN_SET_DEFAULT = "can_set_default";
+ private static final String ARG_SET_DEFAULT_RES_ID = "set_default_res_id";
private static final String ARG_ACCOUNT_HANDLES = "account_handles";
private static final String ARG_IS_DEFAULT_CHECKED = "is_default_checked";
private static final String ARG_LISTENER = "listener";
private static final String ARG_CALL_ID = "call_id";
+ private static final String ARG_HINTS = "hints";
private List<PhoneAccountHandle> mAccountHandles;
+ private List<String> mHints;
private boolean mIsSelected;
private boolean mIsDefaultChecked;
private SelectPhoneAccountListener mListener;
@@ -78,7 +81,7 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
SelectPhoneAccountListener listener,
@Nullable String callId) {
return newInstance(
- R.string.select_account_dialog_title, false, accountHandles, listener, callId);
+ R.string.select_account_dialog_title, false, 0, accountHandles, listener, callId, null);
}
/**
@@ -88,15 +91,22 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
* @param titleResId The resource ID for the string to use in the title of the dialog.
* @param canSetDefault {@code true} if the dialog should include an option to set the selection
* as the default. False otherwise.
+ * @param setDefaultResId The resource ID for the string to use in the "set as default" checkbox
* @param accountHandles The {@code PhoneAccountHandle}s available to select from.
* @param listener The listener for the results of the account selection.
+ * @param callId The callId to be passed back to the listener in {@link
+ * SelectPhoneAccountListener#EXTRA_CALL_ID}
+ * @param hints Additional information to be shown underneath the phone account to help user
+ * choose. Index must match {@code accountHandles}
*/
public static SelectPhoneAccountDialogFragment newInstance(
int titleResId,
boolean canSetDefault,
+ int setDefaultResId,
List<PhoneAccountHandle> accountHandles,
SelectPhoneAccountListener listener,
- @Nullable String callId) {
+ @Nullable String callId,
+ @Nullable List<String> hints) {
ArrayList<PhoneAccountHandle> accountHandlesCopy = new ArrayList<>();
if (accountHandles != null) {
accountHandlesCopy.addAll(accountHandles);
@@ -105,9 +115,13 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
final Bundle args = new Bundle();
args.putInt(ARG_TITLE_RES_ID, titleResId);
args.putBoolean(ARG_CAN_SET_DEFAULT, canSetDefault);
+ args.putInt(ARG_SET_DEFAULT_RES_ID, setDefaultResId);
args.putParcelableArrayList(ARG_ACCOUNT_HANDLES, accountHandlesCopy);
args.putParcelable(ARG_LISTENER, listener);
args.putString(ARG_CALL_ID, callId);
+ if (hints != null) {
+ args.putStringArrayList(ARG_HINTS, new ArrayList<>(hints));
+ }
fragment.setArguments(args);
fragment.setListener(listener);
return fragment;
@@ -140,6 +154,7 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
boolean canSetDefault = getArguments().getBoolean(ARG_CAN_SET_DEFAULT);
mAccountHandles = getArguments().getParcelableArrayList(ARG_ACCOUNT_HANDLES);
mListener = getArguments().getParcelable(ARG_LISTENER);
+ mHints = getArguments().getStringArrayList(ARG_HINTS);
if (savedInstanceState != null) {
mIsDefaultChecked = savedInstanceState.getBoolean(ARG_IS_DEFAULT_CHECKED);
}
@@ -173,7 +188,7 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
ListAdapter selectAccountListAdapter =
new SelectAccountListAdapter(
- builder.getContext(), R.layout.select_account_list_item, mAccountHandles);
+ builder.getContext(), R.layout.select_account_list_item, mAccountHandles, mHints);
AlertDialog dialog =
builder
@@ -189,10 +204,17 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
LayoutInflater.from(builder.getContext())
.inflate(R.layout.default_account_checkbox, null);
- CheckBox cb = (CheckBox) checkboxLayout.findViewById(R.id.default_account_checkbox_view);
- cb.setOnCheckedChangeListener(checkListener);
- cb.setChecked(mIsDefaultChecked);
-
+ CheckBox checkBox = checkboxLayout.findViewById(R.id.default_account_checkbox_view);
+ checkBox.setOnCheckedChangeListener(checkListener);
+ checkBox.setChecked(mIsDefaultChecked);
+
+ TextView textView = checkboxLayout.findViewById(R.id.default_account_checkbox_text);
+ int setDefaultResId =
+ getArguments().getInt(ARG_SET_DEFAULT_RES_ID, R.string.set_default_account);
+ textView.setText(setDefaultResId);
+ textView.setOnClickListener((view) -> checkBox.performClick());
+ checkboxLayout.setOnClickListener((view) -> checkBox.performClick());
+ checkboxLayout.setContentDescription(getString(setDefaultResId));
dialog.getListView().addFooterView(checkboxLayout);
}
@@ -248,10 +270,15 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
private static class SelectAccountListAdapter extends ArrayAdapter<PhoneAccountHandle> {
private int mResId;
+ private final List<String> mHints;
SelectAccountListAdapter(
- Context context, int resource, List<PhoneAccountHandle> accountHandles) {
+ Context context,
+ int resource,
+ List<PhoneAccountHandle> accountHandles,
+ @Nullable List<String> hints) {
super(context, resource, accountHandles);
+ mHints = hints;
mResId = resource;
}
@@ -269,6 +296,7 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
holder = new ViewHolder();
holder.labelTextView = (TextView) rowView.findViewById(R.id.label);
holder.numberTextView = (TextView) rowView.findViewById(R.id.number);
+ holder.hintTextView = rowView.findViewById(R.id.hint);
holder.imageView = (ImageView) rowView.findViewById(R.id.icon);
rowView.setTag(holder);
} else {
@@ -294,6 +322,18 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
}
holder.imageView.setImageDrawable(
PhoneAccountCompat.createIconDrawable(account, getContext()));
+ if (mHints != null && position < mHints.size()) {
+ String hint = mHints.get(position);
+ if (TextUtils.isEmpty(hint)) {
+ holder.hintTextView.setVisibility(View.GONE);
+ } else {
+ holder.hintTextView.setVisibility(View.VISIBLE);
+ holder.hintTextView.setText(hint);
+ }
+ } else {
+ holder.hintTextView.setVisibility(View.GONE);
+ }
+
return rowView;
}
@@ -301,6 +341,7 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment {
TextView labelTextView;
TextView numberTextView;
+ TextView hintTextView;
ImageView imageView;
}
}
diff --git a/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java b/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java
index a70844fbd..05ca6d912 100644
--- a/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java
+++ b/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java
@@ -19,7 +19,10 @@ import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceFragment;
+import android.preference.SwitchPreference;
import android.text.TextUtils;
+import com.android.dialer.logging.DialerImpression;
+import com.android.dialer.logging.Logger;
/** The setting for Assisted Dialing */
public class AssistedDialingSettingFragment extends PreferenceFragment {
@@ -30,6 +33,10 @@ public class AssistedDialingSettingFragment extends PreferenceFragment {
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.assisted_dialing_setting);
+ SwitchPreference switchPref =
+ (SwitchPreference)
+ findPreference(getContext().getString(R.string.assisted_dialing_setting_toggle_key));
+
ListPreference countryChooserPref =
(ListPreference)
findPreference(getContext().getString(R.string.assisted_dialing_setting_cc_key));
@@ -38,6 +45,7 @@ public class AssistedDialingSettingFragment extends PreferenceFragment {
countryChooserPref.setSummary(countryChooserPref.getEntry());
}
countryChooserPref.setOnPreferenceChangeListener(this::updateListSummary);
+ switchPref.setOnPreferenceChangeListener(this::logIfUserDisabledFeature);
}
boolean updateListSummary(Preference pref, Object newValue) {
@@ -46,4 +54,13 @@ public class AssistedDialingSettingFragment extends PreferenceFragment {
listPref.setSummary(entries[listPref.findIndexOfValue(newValue.toString())]);
return true;
}
+
+ boolean logIfUserDisabledFeature(Preference pref, Object newValue) {
+ if (!((boolean) newValue)) {
+ Logger.get(getActivity().getApplicationContext())
+ .logImpression(DialerImpression.Type.ASSISTED_DIALING_FEATURE_DISABLED_BY_USER);
+ }
+
+ return true;
+ }
}
diff --git a/java/com/android/dialer/databasepopulator/CallLogPopulator.java b/java/com/android/dialer/databasepopulator/CallLogPopulator.java
index 7c387ecd1..dd6dc6420 100644
--- a/java/com/android/dialer/databasepopulator/CallLogPopulator.java
+++ b/java/com/android/dialer/databasepopulator/CallLogPopulator.java
@@ -29,6 +29,7 @@ import com.android.dialer.common.Assert;
import com.google.auto.value.AutoValue;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import java.util.concurrent.TimeUnit;
/** Populates the device database with call log entries. */
@@ -84,13 +85,20 @@ public final class CallLogPopulator {
}
@WorkerThread
- public static void populateCallLog(@NonNull Context context, boolean isWithoutMissedCalls) {
+ public static void populateCallLog(
+ @NonNull Context context, boolean isWithoutMissedCalls, boolean fastMode) {
Assert.isWorkerThread();
ArrayList<ContentProviderOperation> operations = new ArrayList<>();
// Do this 4 times to make the call log 4 times bigger.
long timeMillis = System.currentTimeMillis();
+ List<CallEntry.Builder> callLogs = new ArrayList<>();
+ if (fastMode) {
+ callLogs.add(SIMPLE_CALL_LOG[0]);
+ } else {
+ callLogs = Arrays.asList(SIMPLE_CALL_LOG);
+ }
for (int i = 0; i < 4; i++) {
- for (CallEntry.Builder builder : SIMPLE_CALL_LOG) {
+ for (CallEntry.Builder builder : callLogs) {
CallEntry callEntry = builder.setTimeMillis(timeMillis).build();
if (isWithoutMissedCalls && builder.build().getType() == Calls.MISSED_TYPE) {
continue;
@@ -111,6 +119,11 @@ public final class CallLogPopulator {
}
@WorkerThread
+ public static void populateCallLog(@NonNull Context context, boolean isWithoutMissedCalls) {
+ populateCallLog(context, isWithoutMissedCalls, false);
+ }
+
+ @WorkerThread
public static void deleteAllCallLog(@NonNull Context context) {
Assert.isWorkerThread();
try {
diff --git a/java/com/android/dialer/databasepopulator/ContactsPopulator.java b/java/com/android/dialer/databasepopulator/ContactsPopulator.java
index e93c5697a..79492e9d3 100644
--- a/java/com/android/dialer/databasepopulator/ContactsPopulator.java
+++ b/java/com/android/dialer/databasepopulator/ContactsPopulator.java
@@ -127,12 +127,19 @@ public final class ContactsPopulator {
};
@WorkerThread
- public static void populateContacts(@NonNull Context context) {
+ public static void populateContacts(@NonNull Context context, boolean fastMode) {
Assert.isWorkerThread();
ArrayList<ContentProviderOperation> operations = new ArrayList<>();
- for (Contact contact : SIMPLE_CONTACTS) {
+ List<Contact> contacts = new ArrayList<>();
+ if (fastMode) {
+ contacts.add(SIMPLE_CONTACTS[0]);
+ } else {
+ contacts = Arrays.asList(SIMPLE_CONTACTS);
+ }
+ for (Contact contact : contacts) {
addContact(contact, operations);
}
+
try {
context.getContentResolver().applyBatch(ContactsContract.AUTHORITY, operations);
} catch (RemoteException | OperationApplicationException e) {
@@ -141,6 +148,11 @@ public final class ContactsPopulator {
}
@WorkerThread
+ public static void populateContacts(@NonNull Context context) {
+ populateContacts(context, false);
+ }
+
+ @WorkerThread
public static void deleteAllContacts(@NonNull Context context) {
Assert.isWorkerThread();
try {
diff --git a/java/com/android/dialer/databasepopulator/VoicemailPopulator.java b/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
index 9e0f45345..b1f8d1fe4 100644
--- a/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
+++ b/java/com/android/dialer/databasepopulator/VoicemailPopulator.java
@@ -30,6 +30,9 @@ import android.telecom.PhoneAccountHandle;
import android.telephony.TelephonyManager;
import com.android.dialer.common.Assert;
import com.google.auto.value.AutoValue;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
import java.util.concurrent.TimeUnit;
/** Populates the device database with voicemail entries. */
@@ -74,14 +77,19 @@ public final class VoicemailPopulator {
};
@WorkerThread
- public static void populateVoicemail(@NonNull Context context) {
+ public static void populateVoicemail(@NonNull Context context, boolean fastMode) {
Assert.isWorkerThread();
enableVoicemail(context);
-
+ List<Voicemail.Builder> voicemails = new ArrayList<>();
+ if (fastMode) {
+ voicemails.add(SIMPLE_VOICEMAILS[0]);
+ } else {
+ voicemails = Arrays.asList(SIMPLE_VOICEMAILS);
+ }
// Do this 4 times to make the voicemail database 4 times bigger.
long timeMillis = System.currentTimeMillis();
for (int i = 0; i < 4; i++) {
- for (Voicemail.Builder builder : SIMPLE_VOICEMAILS) {
+ for (Voicemail.Builder builder : voicemails) {
Voicemail voicemail = builder.setTimeMillis(timeMillis).build();
context
.getContentResolver()
@@ -94,11 +102,16 @@ public final class VoicemailPopulator {
}
@WorkerThread
+ public static void populateVoicemail(@NonNull Context context) {
+ populateVoicemail(context, false);
+ }
+
+ @WorkerThread
public static void deleteAllVoicemail(@NonNull Context context) {
Assert.isWorkerThread();
context
.getContentResolver()
- .delete(Voicemails.buildSourceUri(context.getPackageName()), "", new String[] {});
+ .delete(Voicemails.buildSourceUri(context.getPackageName()), null, null);
}
@VisibleForTesting
diff --git a/java/com/android/dialer/logging/dialer_impression.proto b/java/com/android/dialer/logging/dialer_impression.proto
index 3dd645e65..c2456d8ac 100644
--- a/java/com/android/dialer/logging/dialer_impression.proto
+++ b/java/com/android/dialer/logging/dialer_impression.proto
@@ -12,6 +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
enum Type {
UNKNOWN_AOSP_EVENT_TYPE = 1000;
@@ -589,6 +590,8 @@ message DialerImpression {
// Indicates that the number attempting to be assisted dialed had an
// extension.
ASSISTED_DIALING_CONSTRAINT_NUMBER_HAS_EXTENSION = 1289;
+ // Indicates that the user disabled the feature.
+ ASSISTED_DIALING_FEATURE_DISABLED_BY_USER = 1292;
// User reports a same prefix call as spam from call history
REPORT_SAME_PREFIX_CALL_AS_SPAM_VIA_CALL_HISTORY =
diff --git a/java/com/android/dialer/precall/impl/CallingAccountSelector.java b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
index d46e31711..fe3a5b631 100644
--- a/java/com/android/dialer/precall/impl/CallingAccountSelector.java
+++ b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
@@ -48,6 +48,7 @@ import com.android.dialer.preferredsim.PreferredSimFallbackContract.PreferredSim
import com.android.dialer.preferredsim.suggestion.SimSuggestionComponent;
import com.android.dialer.preferredsim.suggestion.SuggestionProvider.Suggestion;
import com.google.common.base.Optional;
+import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -158,22 +159,54 @@ public class CallingAccountSelector implements PreCallAction {
PendingAction pendingAction,
@Nullable String dataId,
@Nullable String number,
- @Nullable Suggestion unusedSuggestion) { // TODO(twyen): incoporate suggestion in dialog
+ @Nullable Suggestion suggestion) {
Assert.isMainThread();
+ List<PhoneAccountHandle> phoneAccountHandles =
+ coordinator
+ .getActivity()
+ .getSystemService(TelecomManager.class)
+ .getCallCapablePhoneAccounts();
selectPhoneAccountDialogFragment =
SelectPhoneAccountDialogFragment.newInstance(
R.string.pre_call_select_phone_account,
dataId != null /* canSetDefault */,
- coordinator
- .getActivity()
- .getSystemService(TelecomManager.class)
- .getCallCapablePhoneAccounts(),
+ R.string.pre_call_select_phone_account_remember,
+ phoneAccountHandles,
new SelectedListener(coordinator, pendingAction, dataId, number),
- null /* call ID */);
+ null /* call ID */,
+ buildHint(coordinator.getActivity(), phoneAccountHandles, suggestion));
selectPhoneAccountDialogFragment.show(
coordinator.getActivity().getFragmentManager(), TAG_CALLING_ACCOUNT_SELECTOR);
}
+ @Nullable
+ private static List<String> buildHint(
+ Context context,
+ List<PhoneAccountHandle> phoneAccountHandles,
+ @Nullable Suggestion suggestion) {
+ if (suggestion == null) {
+ return null;
+ }
+ List<String> hints = new ArrayList<>();
+ for (PhoneAccountHandle phoneAccountHandle : phoneAccountHandles) {
+ if (!phoneAccountHandle.equals(suggestion.phoneAccountHandle)) {
+ hints.add(null);
+ continue;
+ }
+ switch (suggestion.reason) {
+ case INTRA_CARRIER:
+ hints.add(context.getString(R.string.pre_call_select_phone_account_hint_intra_carrier));
+ break;
+ case FREQUENT:
+ hints.add(context.getString(R.string.pre_call_select_phone_account_hint_frequent));
+ break;
+ default:
+ throw Assert.createAssertionFailException("unexpected reason " + suggestion.reason);
+ }
+ }
+ return hints;
+ }
+
@MainThread
@Override
public void onDiscard() {
diff --git a/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java b/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java
index 485823e9a..de32cc2ae 100644
--- a/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java
+++ b/java/com/android/dialer/precall/impl/PreCallCoordinatorImpl.java
@@ -76,6 +76,7 @@ public class PreCallCoordinatorImpl implements PreCallCoordinator {
currentAction.onDiscard();
}
currentAction = null;
+ pendingAction = null;
}
void onSaveInstanceState(Bundle outState) {
diff --git a/java/com/android/dialer/precall/impl/res/values/strings.xml b/java/com/android/dialer/precall/impl/res/values/strings.xml
index 894394662..0d30ac9e5 100644
--- a/java/com/android/dialer/precall/impl/res/values/strings.xml
+++ b/java/com/android/dialer/precall/impl/res/values/strings.xml
@@ -19,4 +19,16 @@
multiple SIMs [CHAR LIMIT=40]-->
<string name="pre_call_select_phone_account">Call with</string>
+ <!-- Checkbox label when selecting a SIM when calling a contact, to use the selected SIM for the
+ same contact and never ask again [CHAR LIMIT=40]-->
+ <string name="pre_call_select_phone_account_remember">Remember this choice</string>
+
+ <!-- Hint text under a SIM when selecting SIM to call, indicating the SIM is on the same carrier
+ as the outgoing call.[CHAR LIMIT=40]-->
+ <string name="pre_call_select_phone_account_hint_intra_carrier">Same carrier</string>
+
+ <!-- Hint text under a SIM when selecting SIM to call, indicating user often use the SIM to call
+ the contact.[CHAR LIMIT=40]-->
+ <string name="pre_call_select_phone_account_hint_frequent">You use often</string>
+
</resources> \ No newline at end of file
diff --git a/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java b/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java
index e2082105b..6053a0d52 100644
--- a/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java
+++ b/java/com/android/dialer/simulator/impl/SimulatorMainMenu.java
@@ -40,6 +40,7 @@ final class SimulatorMainMenu {
.addItem("IMS video", SimulatorVideoCall.getActionProvider(context))
.addItem("Notifications", SimulatorNotifications.getActionProvider(context))
.addItem("Populate database", () -> populateDatabase(context))
+ .addItem("Fast populate database", () -> fastPopulateDatabase(context))
.addItem("Clean database", () -> cleanDatabase(context))
.addItem("clear preferred SIM", () -> clearPreferredSim(context))
.addItem("Sync voicemail", () -> syncVoicemail(context))
@@ -54,7 +55,15 @@ final class SimulatorMainMenu {
.dialerExecutorFactory()
.createNonUiTaskBuilder(new PopulateDatabaseWorker())
.build()
- .executeSerial(context);
+ .executeSerial(new PopulateDatabaseWorkerInput(context, false));
+ }
+
+ private static void fastPopulateDatabase(@NonNull Context context) {
+ DialerExecutorComponent.get(context)
+ .dialerExecutorFactory()
+ .createNonUiTaskBuilder(new PopulateDatabaseWorker())
+ .build()
+ .executeSerial(new PopulateDatabaseWorkerInput(context, true));
}
private static void cleanDatabase(@NonNull Context context) {
@@ -97,13 +106,13 @@ final class SimulatorMainMenu {
private SimulatorMainMenu() {}
- private static class PopulateDatabaseWorker implements Worker<Context, Void> {
+ private static class PopulateDatabaseWorker implements Worker<PopulateDatabaseWorkerInput, Void> {
@Nullable
@Override
- public Void doInBackground(Context context) {
- ContactsPopulator.populateContacts(context);
- CallLogPopulator.populateCallLog(context);
- VoicemailPopulator.populateVoicemail(context);
+ public Void doInBackground(PopulateDatabaseWorkerInput input) {
+ ContactsPopulator.populateContacts(input.context, input.fastMode);
+ CallLogPopulator.populateCallLog(input.context, false, input.fastMode);
+ VoicemailPopulator.populateVoicemail(input.context, input.fastMode);
return null;
}
}
@@ -135,4 +144,14 @@ final class SimulatorMainMenu {
return PersistentLogger.dumpLogToString();
}
}
+
+ private static class PopulateDatabaseWorkerInput {
+ Context context;
+ boolean fastMode;
+
+ PopulateDatabaseWorkerInput(Context context, boolean fastMode) {
+ this.context = context;
+ this.fastMode = fastMode;
+ }
+ }
}
diff --git a/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java b/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java
index 4d53d61d2..13ca5b724 100644
--- a/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java
+++ b/java/com/android/dialer/voicemail/settings/VoicemailChangePinActivity.java
@@ -357,13 +357,6 @@ public class VoicemailChangePinActivity extends Activity
mHintText = (TextView) view.findViewById(R.id.hintText);
mErrorText = (TextView) view.findViewById(R.id.errorText);
- if (isPinScrambled(this, mPhoneAccountHandle)) {
- mOldPin = mPinChanger.getScrambledPin();
- updateState(State.VerifyOldPin);
- } else {
- updateState(State.EnterOldPin);
- }
-
mChangePinExecutor =
DialerExecutorComponent.get(this)
.dialerExecutorFactory()
@@ -371,6 +364,13 @@ public class VoicemailChangePinActivity extends Activity
.onSuccess(this::sendResult)
.onFailure((tr) -> sendResult(PinChanger.CHANGE_PIN_SYSTEM_ERROR))
.build();
+
+ if (isPinScrambled(this, mPhoneAccountHandle)) {
+ mOldPin = mPinChanger.getScrambledPin();
+ updateState(State.VerifyOldPin);
+ } else {
+ updateState(State.EnterOldPin);
+ }
}
/** Extracts the pin length requirement sent by the server with a STATUS SMS. */
diff --git a/java/com/android/incallui/InCallActivityCommon.java b/java/com/android/incallui/InCallActivityCommon.java
index e8588a67a..d2aae485d 100644
--- a/java/com/android/incallui/InCallActivityCommon.java
+++ b/java/com/android/incallui/InCallActivityCommon.java
@@ -524,9 +524,11 @@ public class InCallActivityCommon {
SelectPhoneAccountDialogFragment.newInstance(
R.string.select_phone_account_for_calls,
true,
+ 0,
phoneAccountHandles,
selectAccountListener,
- waitingForAccountCall.getId());
+ waitingForAccountCall.getId(),
+ null);
selectPhoneAccountDialogFragment.show(
inCallActivity.getFragmentManager(), TAG_SELECT_ACCOUNT_FRAGMENT);
return true;
diff --git a/java/com/android/voicemail/stub/StubVoicemailClient.java b/java/com/android/voicemail/stub/StubVoicemailClient.java
index 3069ea4ba..2b02261c4 100644
--- a/java/com/android/voicemail/stub/StubVoicemailClient.java
+++ b/java/com/android/voicemail/stub/StubVoicemailClient.java
@@ -111,12 +111,12 @@ public final class StubVoicemailClient implements VoicemailClient {
@Override
public void addActivationStateListener(ActivationStateListener listener) {
- throw Assert.createAssertionFailException("should never be called on stub.");
+ // Do nothing
}
@Override
public void removeActivationStateListener(ActivationStateListener listener) {
- throw Assert.createAssertionFailException("should never be called on stub.");
+ // Do nothing
}
@Override