am 5acaec6d: (-s ours) am c4868dea: (-s ours) Import translations. DO NOT MERGE
* commit '5acaec6d6e88f303905611fe2c5e56811fe84d83':
diff --git a/res/drawable/action_button_background.xml b/res/drawable/action_button_background.xml
deleted file mode 100644
index ea7434f..0000000
--- a/res/drawable/action_button_background.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:color="?android:attr/colorControlHighlight">
- <!-- Transparent background constrains the touch feedback ripple to the button, but also allows
- touch feedback ripples in the parent to show under the button. -->
- <item>
- <shape android:shape="rectangle" >
- <solid android:color="@android:color/transparent" />
- </shape>
- </item>
-</ripple>
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index 761f352..c77a1f7 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<view xmlns:android="http://schemas.android.com/apk/res/android"
- class="com.android.dialer.calllog.CallLogListItemView"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/call_log_list_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -160,4 +159,4 @@
android:layout="@layout/call_log_list_item_extra"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
-</view>
+</LinearLayout>
diff --git a/res/layout/call_log_list_item_actions.xml b/res/layout/call_log_list_item_actions.xml
index ac83f4a..1280089 100644
--- a/res/layout/call_log_list_item_actions.xml
+++ b/res/layout/call_log_list_item_actions.xml
@@ -30,7 +30,7 @@
>
<TextView
android:id="@+id/call_back_action"
- android:background="@drawable/action_button_background"
+ android:background="?android:attr/selectableItemBackground"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="match_parent"
@@ -46,7 +46,7 @@
android:singleLine="true"/>
<TextView
android:id="@+id/video_call_action"
- android:background="@drawable/action_button_background"
+ android:background="?android:attr/selectableItemBackground"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="match_parent"
@@ -62,7 +62,7 @@
android:singleLine="true"/>
<TextView
android:id="@+id/voicemail_action"
- android:background="@drawable/action_button_background"
+ android:background="?android:attr/selectableItemBackground"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="match_parent"
@@ -78,7 +78,7 @@
android:singleLine="true"/>
<TextView
android:id="@+id/details_action"
- android:background="@drawable/action_button_background"
+ android:background="?android:attr/selectableItemBackground"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="match_parent"
@@ -94,7 +94,7 @@
android:singleLine="true"/>
<TextView
android:id="@+id/report_action"
- android:background="@drawable/action_button_background"
+ android:background="?android:attr/selectableItemBackground"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="match_parent"
diff --git a/res/layout/call_log_list_item_extra.xml b/res/layout/call_log_list_item_extra.xml
index 4335979..87b932b 100644
--- a/res/layout/call_log_list_item_extra.xml
+++ b/res/layout/call_log_list_item_extra.xml
@@ -53,6 +53,7 @@
<ImageView android:id="@+id/dismiss_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:padding="@dimen/icon_padding"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/call_log_icon_margin"
android:src="@drawable/ic_close_dk"
diff --git a/res/layout/tile_interactions_teaser_view.xml b/res/layout/tile_interactions_teaser_view.xml
deleted file mode 100644
index 8204cb1..0000000
--- a/res/layout/tile_interactions_teaser_view.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2013 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License
- -->
-<com.android.dialer.list.TileInteractionTeaserView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/background_dialer_list_items"
- android:paddingBottom="@dimen/favorites_row_bottom_padding"
- android:paddingTop="@dimen/favorites_row_top_padding">
-
- <LinearLayout
- android:id="@+id/swipeable_content"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal" >
-
- <ImageView
- android:id="@+id/arrow"
- android:layout_width="48dp"
- android:layout_height="wrap_content"
- android:layout_marginLeft="16dp"
- android:layout_marginRight="12dp"
- android:duplicateParentState="true"
- android:src="@drawable/ic_arrow"
- android:visibility="invisible" />
-
- <TextView
- android:id="@+id/text"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_marginBottom="12dp"
- android:layout_marginTop="12dp"
- android:layout_weight="1"
- android:duplicateParentState="true"
- android:fontFamily="sans-serif-light"
- android:text="@string/contact_tooltip"
- android:textColor="@color/undo_dialogue_text_color"
- android:textSize="16sp" />
-
- <View
- android:id="@+id/dismiss_separator"
- android:layout_width="1dip"
- android:layout_height="match_parent"
- android:background="@color/undo_dialogue_text_color"
- android:layout_marginTop="16dp"
- android:layout_marginBottom="16dp"
- android:layout_marginStart="16dp"/>
-
- <ImageButton
- android:id="@+id/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:background="?android:attr/selectableItemBackground"
- android:clickable="true"
- android:scaleType="center"
- android:src="@drawable/ic_cancel_holo_light"
- style="@style/DismissButtonStyle"
- android:contentDescription="@string/description_dismiss"/>
-
- </LinearLayout>
-
-</com.android.dialer.list.TileInteractionTeaserView>
diff --git a/res/values/animation_constants.xml b/res/values/animation_constants.xml
index 7863060..b8b2a59 100644
--- a/res/values/animation_constants.xml
+++ b/res/values/animation_constants.xml
@@ -35,7 +35,7 @@
<integer name="call_log_actions_fade_start">150</integer>
<!-- Duration of the fade in of the call log actions. -->
- <integer name="call_log_actions_fade_in_duration">200</integer>
+ <integer name="call_log_actions_fade_in_duration">50</integer>
<!-- Duration of the fade out of the call log actions. -->
<integer name="call_log_actions_fade_out_duration">20</integer>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 383a8fa..7096148 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -131,6 +131,10 @@
<dimen name="call_log_day_group_padding_top">15dp</dimen>
<dimen name="call_log_day_group_padding_bottom">9dp</dimen>
+ <!-- Padding for icons to increase their touch target. Icons are typically 24 dps in size
+ so this extra padding makes the entire touch target 40dp -->
+ <dimen name="icon_padding">8dp</dimen>
+
<!-- Length of dialpad's shadows in dialer. -->
<dimen name="shadow_length">10dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index beb7fe2..7a88b98 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -804,10 +804,15 @@
<!-- Title of settings screen for managing the "Respond via SMS" feature. [CHAR LIMIT=30] -->
<string name="respond_via_sms_setting_title">Quick responses</string>
- <!-- Label for the call settings section [CHAR LIMIT=30]-->
+ <!-- Label for the call settings section [CHAR LIMIT=30] -->
<string name="call_settings_label">Call settings</string>
- <!-- Label for the call settings section description [CHAR LIMIT=80]-->
+ <!-- Label for the call settings section description [CHAR LIMIT=80] -->
<string name="call_settings_description">Voicemail, call waiting, and others</string>
+ <!-- Label for the phone account settings [CHAR LIMIT=30] -->
+ <string name="phone_account_settings_label">Phone account settings</string>
+
+ <!-- Label for the phone account settings description [CHAR LIMIT=80] -->
+ <string name="phone_account_settings_description">Manage SIM and call settings</string>
</resources>
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index e2ab130..2c8d4fc 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -31,6 +31,7 @@
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.VoicemailContract.Voicemails;
import android.telecom.PhoneAccount;
+import android.telecom.PhoneAccountHandle;
import android.telephony.TelephonyManager;
import android.text.BidiFormatter;
import android.text.TextDirectionHeuristics;
@@ -65,7 +66,7 @@
import com.android.dialer.voicemail.VoicemailStatusHelper;
import com.android.dialer.voicemail.VoicemailStatusHelper.StatusMessage;
import com.android.dialer.voicemail.VoicemailStatusHelperImpl;
-import com.android.dialerbind.analytics.AnalyticsActivity;
+import com.android.contacts.commonbind.analytics.AnalyticsActivity;
import java.util.List;
@@ -78,9 +79,6 @@
public class CallDetailActivity extends AnalyticsActivity implements ProximitySensorAware {
private static final String TAG = "CallDetail";
- private static final int LOADER_ID = 0;
- private static final String BUNDLE_CONTACT_URI_EXTRA = "contact_uri_extra";
-
private static final char LEFT_TO_RIGHT_EMBEDDING = '\u202A';
private static final char POP_DIRECTIONAL_FORMATTING = '\u202C';
@@ -238,7 +236,7 @@
mResources = getResources();
mCallTypeHelper = new CallTypeHelper(getResources());
- mPhoneNumberHelper = new PhoneNumberDisplayHelper(mResources);
+ mPhoneNumberHelper = new PhoneNumberDisplayHelper(this, mResources);
mVoicemailStatusHelper = new VoicemailStatusHelperImpl();
mAsyncQueryHandler = new CallDetailActivityQueryHandler(this);
@@ -379,7 +377,7 @@
/**
* Update user interface with details of given call.
*
- * @param callUris URIs into {@link CallLog.Calls} of the calls to be displayed
+ * @param callUris URIs into {@link android.provider.CallLog.Calls} of the calls to be displayed
*/
private void updateData(final Uri... callUris) {
class UpdateContactDetailsTask extends AsyncTask<Void, Void, PhoneCallDetails[]> {
@@ -403,9 +401,11 @@
@Override
public void onPostExecute(PhoneCallDetails[] details) {
+ Context context = CallDetailActivity.this;
+
if (details == null) {
// Somewhere went wrong: we're going to bail out and show error to users.
- Toast.makeText(CallDetailActivity.this, R.string.toast_call_detail_error,
+ Toast.makeText(context, R.string.toast_call_detail_error,
Toast.LENGTH_SHORT).show();
finish();
return;
@@ -418,24 +418,27 @@
final int numberPresentation = firstDetails.numberPresentation;
final Uri contactUri = firstDetails.contactUri;
final Uri photoUri = firstDetails.photoUri;
+ final PhoneAccountHandle accountHandle = firstDetails.accountHandle;
// Cache the details about the phone number.
final boolean canPlaceCallsTo =
PhoneNumberUtilsWrapper.canPlaceCallsTo(mNumber, numberPresentation);
- final PhoneNumberUtilsWrapper phoneUtils = new PhoneNumberUtilsWrapper();
- final boolean isVoicemailNumber = phoneUtils.isVoicemailNumber(mNumber);
- final boolean isSipNumber = phoneUtils.isSipNumber(mNumber);
+ final PhoneNumberUtilsWrapper phoneUtils = new PhoneNumberUtilsWrapper(context);
+ final boolean isVoicemailNumber =
+ phoneUtils.isVoicemailNumber(accountHandle, mNumber);
+ final boolean isSipNumber = PhoneNumberUtilsWrapper.isSipNumber(mNumber);
final CharSequence callLocationOrType = getNumberTypeOrLocation(firstDetails);
- final CharSequence displayNumber = mPhoneNumberHelper.getDisplayNumber(
- firstDetails.number,
- firstDetails.numberPresentation,
- firstDetails.formattedNumber);
+ final CharSequence displayNumber =
+ mPhoneNumberHelper.getDisplayNumber(
+ firstDetails.accountHandle,
+ firstDetails.number,
+ firstDetails.numberPresentation,
+ firstDetails.formattedNumber);
final String displayNumberStr = mBidiFormatter.unicodeWrap(
displayNumber.toString(), TextDirectionHeuristics.LTR);
-
if (!TextUtils.isEmpty(firstDetails.name)) {
mCallerName.setText(firstDetails.name);
mCallerNumber.setText(callLocationOrType + " " + displayNumberStr);
@@ -449,8 +452,9 @@
}
}
- if (!TextUtils.isEmpty(firstDetails.accountLabel)) {
- mAccountLabel.setText(firstDetails.accountLabel);
+ String accountLabel = PhoneAccountUtils.getAccountLabel(context, accountHandle);
+ if (!TextUtils.isEmpty(accountLabel)) {
+ mAccountLabel.setText(accountLabel);
mAccountLabel.setVisibility(View.VISIBLE);
} else {
mAccountLabel.setVisibility(View.GONE);
@@ -464,8 +468,7 @@
ListView historyList = (ListView) findViewById(R.id.history);
historyList.setAdapter(
- new CallDetailHistoryAdapter(CallDetailActivity.this, mInflater,
- mCallTypeHelper, details));
+ new CallDetailHistoryAdapter(context, mInflater, mCallTypeHelper, details));
String lookupKey = contactUri == null ? null
: ContactInfoHelper.getLookupKeyFromUri(contactUri);
@@ -479,7 +482,9 @@
String nameForDefaultImage;
if (TextUtils.isEmpty(firstDetails.name)) {
- nameForDefaultImage = mPhoneNumberHelper.getDisplayNumber(firstDetails.number,
+ nameForDefaultImage = mPhoneNumberHelper.getDisplayNumber(
+ firstDetails.accountHandle,
+ firstDetails.number,
firstDetails.numberPresentation,
firstDetails.formattedNumber).toString();
} else {
@@ -535,10 +540,9 @@
final String geocode = callCursor.getString(GEOCODED_LOCATION_COLUMN_INDEX);
final String transcription = callCursor.getString(TRANSCRIPTION_COLUMN_INDEX);
- final String accountLabel = PhoneAccountUtils.getAccountLabel(this,
- PhoneAccountUtils.getAccount(
+ final PhoneAccountHandle accountHandle = PhoneAccountUtils.getAccount(
callCursor.getString(ACCOUNT_COMPONENT_NAME),
- callCursor.getString(ACCOUNT_ID)));
+ callCursor.getString(ACCOUNT_ID));
if (TextUtils.isEmpty(countryIso)) {
countryIso = mDefaultCountryIso;
@@ -556,11 +560,11 @@
// If this is not a regular number, there is no point in looking it up in the contacts.
ContactInfo info =
PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)
- && !new PhoneNumberUtilsWrapper().isVoicemailNumber(number)
+ && !new PhoneNumberUtilsWrapper(this).isVoicemailNumber(accountHandle, number)
? mContactInfoHelper.lookupNumber(number, countryIso)
: null;
if (info == null) {
- formattedNumber = mPhoneNumberHelper.getDisplayNumber(number,
+ formattedNumber = mPhoneNumberHelper.getDisplayNumber(accountHandle, number,
numberPresentation, null);
nameText = "";
numberType = 0;
@@ -586,7 +590,7 @@
formattedNumber, countryIso, geocode,
new int[]{ callType }, date, duration,
nameText, numberType, numberLabel, lookupUri, photoUri, sourceType,
- accountLabel, null, features, dataUsage, transcription);
+ accountHandle, features, dataUsage, transcription);
} finally {
if (callCursor != null) {
callCursor.close();
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 7071e51..aacf208 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -59,12 +59,12 @@
import android.widget.Toast;
import com.android.contacts.common.CallUtil;
+import com.android.contacts.common.activity.TransactionSafeActivity;
import com.android.contacts.common.dialog.ClearFrequentsDialog;
import com.android.contacts.common.interactions.ImportExportDialogFragment;
import com.android.contacts.common.interactions.TouchPointManager;
import com.android.contacts.common.list.OnPhoneNumberPickerActionListener;
import com.android.contacts.common.widget.FloatingActionButtonController;
-import com.android.dialer.activity.TransactionSafeActivity;
import com.android.dialer.calllog.CallLogActivity;
import com.android.dialer.database.DialerDatabaseHelper;
import com.android.dialer.dialpad.DialpadFragment;
@@ -86,7 +86,6 @@
import com.android.dialer.widget.SearchEditTextLayout;
import com.android.dialer.widget.SearchEditTextLayout.OnBackButtonClickedListener;
import com.android.dialerbind.DatabaseHelperManager;
-import com.android.incallui.CallCardFragment;
import com.android.phone.common.animation.AnimUtils;
import com.android.phone.common.animation.AnimationListenerAdapter;
diff --git a/src/com/android/dialer/PhoneCallDetails.java b/src/com/android/dialer/PhoneCallDetails.java
index ba049a2..ec9657e 100644
--- a/src/com/android/dialer/PhoneCallDetails.java
+++ b/src/com/android/dialer/PhoneCallDetails.java
@@ -22,6 +22,7 @@
import android.net.Uri;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.telecom.PhoneAccountHandle;
/**
* The details of a phone call to be shown in the UI.
@@ -66,14 +67,11 @@
* The source type of the contact associated with this call.
*/
public final int sourceType;
+
/**
* The unique identifier for the account associated with the call.
*/
- public final String accountLabel;
- /**
- * The icon for the account associated with the call.
- */
- public final Drawable accountIcon;
+ public final PhoneAccountHandle accountHandle;
/**
* Features applicable to this call.
*/
@@ -96,26 +94,26 @@
CharSequence formattedNumber, String countryIso, String geocode,
int[] callTypes, long date, long duration) {
this (number, numberPresentation, formattedNumber, countryIso, geocode,
- callTypes, date, duration, "", 0, "", null, null, 0, null, null, 0, null, null);
+ callTypes, date, duration, "", 0, "", null, null, 0, null, 0, null, null);
}
/** Create the details for a call with a number not associated with a contact. */
public PhoneCallDetails(CharSequence number, int numberPresentation,
CharSequence formattedNumber, String countryIso, String geocode,
- int[] callTypes, long date, long duration, String accountLabel, Drawable accountIcon,
- int features, Long dataUsage, String transcription) {
- this(number, numberPresentation, formattedNumber, countryIso, geocode,
- callTypes, date, duration, "", 0, "", null, null, 0, accountLabel, accountIcon,
- features, dataUsage, transcription);
+ int[] callTypes, long date, long duration,
+ PhoneAccountHandle accountHandle, int features, Long dataUsage, String transcription) {
+ this(number, numberPresentation, formattedNumber, countryIso, geocode, callTypes, date,
+ duration, "", 0, "", null, null, 0, accountHandle, features, dataUsage,
+ transcription);
}
/** Create the details for a call with a number associated with a contact. */
public PhoneCallDetails(CharSequence number, int numberPresentation,
CharSequence formattedNumber, String countryIso, String geocode,
int[] callTypes, long date, long duration, CharSequence name,
- int numberType, CharSequence numberLabel, Uri contactUri,
- Uri photoUri, int sourceType, String accountLabel, Drawable accountIcon, int features,
- Long dataUsage, String transcription) {
+ int numberType, CharSequence numberLabel, Uri contactUri, Uri photoUri,
+ int sourceType, PhoneAccountHandle accountHandle, int features, Long dataUsage,
+ String transcription) {
this.number = number;
this.numberPresentation = numberPresentation;
this.formattedNumber = formattedNumber;
@@ -130,8 +128,7 @@
this.contactUri = contactUri;
this.photoUri = photoUri;
this.sourceType = sourceType;
- this.accountLabel = accountLabel;
- this.accountIcon = accountIcon;
+ this.accountHandle = accountHandle;
this.features = features;
this.dataUsage = dataUsage;
this.transcription = transcription;
diff --git a/src/com/android/dialer/PhoneCallDetailsHelper.java b/src/com/android/dialer/PhoneCallDetailsHelper.java
index c5f2fb6..e888431 100644
--- a/src/com/android/dialer/PhoneCallDetailsHelper.java
+++ b/src/com/android/dialer/PhoneCallDetailsHelper.java
@@ -16,7 +16,9 @@
package com.android.dialer;
+import android.content.Context;
import android.content.res.Resources;
+import android.graphics.drawable.Drawable;
import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
@@ -28,8 +30,8 @@
import com.android.contacts.common.CallUtil;
import com.android.contacts.common.testing.NeededForTesting;
import com.android.contacts.common.util.PhoneNumberHelper;
-import com.android.dialer.calllog.CallTypeHelper;
import com.android.dialer.calllog.ContactInfo;
+import com.android.dialer.calllog.PhoneAccountUtils;
import com.android.dialer.calllog.PhoneNumberDisplayHelper;
import com.android.dialer.calllog.PhoneNumberUtilsWrapper;
import com.android.dialer.util.DialerUtils;
@@ -44,6 +46,7 @@
/** The maximum number of icons will be shown to represent the call types in a group. */
private static final int MAX_CALL_TYPE_ICONS = 3;
+ private final Context mContext;
private final Resources mResources;
/** The injected current time in milliseconds since the epoch. Used only by tests. */
private Long mCurrentTimeMillisForTest;
@@ -63,11 +66,12 @@
*
* @param resources used to look up strings
*/
- public PhoneCallDetailsHelper(Resources resources, CallTypeHelper callTypeHelper,
+ public PhoneCallDetailsHelper(Context context, Resources resources,
PhoneNumberUtilsWrapper phoneUtils) {
+ mContext = context;
mResources = resources;
mPhoneNumberUtilsWrapper = phoneUtils;
- mPhoneNumberHelper = new PhoneNumberDisplayHelper(mPhoneNumberUtilsWrapper, resources);
+ mPhoneNumberHelper = new PhoneNumberDisplayHelper(context, resources, phoneUtils);
}
/** Fills the call details views with content. */
@@ -103,16 +107,17 @@
setCallCountAndDate(views, callCount, callLocationAndDate);
// set the account icon if it exists
- if (details.accountIcon != null) {
+ Drawable accountIcon = PhoneAccountUtils.getAccountIcon(mContext, details.accountHandle);
+ if (accountIcon != null) {
views.callAccountIcon.setVisibility(View.VISIBLE);
- views.callAccountIcon.setImageDrawable(details.accountIcon);
+ views.callAccountIcon.setImageDrawable(accountIcon);
} else {
views.callAccountIcon.setVisibility(View.GONE);
}
final CharSequence nameText;
final CharSequence displayNumber =
- mPhoneNumberHelper.getDisplayNumber(details.number,
+ mPhoneNumberHelper.getDisplayNumber(details.accountHandle, details.number,
details.numberPresentation, details.formattedNumber);
if (TextUtils.isEmpty(details.name)) {
nameText = displayNumber;
@@ -169,7 +174,8 @@
// Only show a label if the number is shown and it is not a SIP address.
if (!TextUtils.isEmpty(details.number)
&& !PhoneNumberHelper.isUriNumber(details.number.toString())
- && !mPhoneNumberUtilsWrapper.isVoicemailNumber(details.number)) {
+ && !mPhoneNumberUtilsWrapper.isVoicemailNumber(details.accountHandle,
+ details.number)) {
if (details.numberLabel == ContactInfo.GEOCODE_AS_LABEL) {
numberFormattedLabel = details.geocode;
@@ -180,8 +186,8 @@
}
if (!TextUtils.isEmpty(details.name) && TextUtils.isEmpty(numberFormattedLabel)) {
- numberFormattedLabel = mPhoneNumberHelper.getDisplayNumber(details.number,
- details.numberPresentation, details.formattedNumber);
+ numberFormattedLabel = mPhoneNumberHelper.getDisplayNumber(details.accountHandle,
+ details.number, details.numberPresentation, details.formattedNumber);
}
return numberFormattedLabel;
}
@@ -204,8 +210,9 @@
public void setCallDetailsHeader(TextView nameView, PhoneCallDetails details) {
final CharSequence nameText;
final CharSequence displayNumber =
- mPhoneNumberHelper.getDisplayNumber(details.number, details.numberPresentation,
- mResources.getString(R.string.recentCalls_addToContact));
+ mPhoneNumberHelper.getDisplayNumber(details.accountHandle, details.number,
+ details.numberPresentation,
+ mResources.getString(R.string.recentCalls_addToContact));
if (TextUtils.isEmpty(details.name)) {
nameText = displayNumber;
} else {
diff --git a/src/com/android/dialer/SpecialCharSequenceMgr.java b/src/com/android/dialer/SpecialCharSequenceMgr.java
index 14b26ec..8e56e45 100644
--- a/src/com/android/dialer/SpecialCharSequenceMgr.java
+++ b/src/com/android/dialer/SpecialCharSequenceMgr.java
@@ -39,6 +39,9 @@
import com.android.common.io.MoreCloseables;
import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Helper class to listen for some magic character sequences
* that are handled specially by the dialer.
@@ -80,20 +83,10 @@
}
public static boolean handleChars(Context context, String input, EditText textField) {
- return handleChars(context, input, false, textField);
- }
-
- static boolean handleChars(Context context, String input) {
- return handleChars(context, input, false, null);
- }
-
- static boolean handleChars(Context context, String input, boolean useSystemWindow,
- EditText textField) {
-
//get rid of the separators so that the string gets parsed correctly
String dialString = PhoneNumberUtils.stripSeparators(input);
- if (handleIMEIDisplay(context, dialString, useSystemWindow)
+ if (handleDeviceIdDisplay(context, dialString)
|| handleRegulatoryInfoDisplay(context, dialString)
|| handlePinEntry(context, dialString)
|| handleAdnEntry(context, dialString, textField)
@@ -233,20 +226,30 @@
return false;
}
- static boolean handleIMEIDisplay(Context context, String input, boolean useSystemWindow) {
+
+ // TODO: Use TelephonyCapabilities.getDeviceIdLabel() to get the device id label instead of a
+ // hard-coded string.
+ static boolean handleDeviceIdDisplay(Context context, String input) {
TelephonyManager telephonyManager =
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
- if (telephonyManager != null && input.equals(MMI_IMEI_DISPLAY)) {
- int phoneType = telephonyManager.getPhoneType();
- if (phoneType == TelephonyManager.PHONE_TYPE_GSM) {
- showIMEIPanel(context, useSystemWindow, telephonyManager);
- return true;
- } else if (phoneType == TelephonyManager.PHONE_TYPE_CDMA) {
- showMEIDPanel(context, useSystemWindow, telephonyManager);
- return true;
- }
- }
+ if (telephonyManager != null && input.equals(MMI_IMEI_DISPLAY)) {
+ int labelResId = (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) ?
+ R.string.imei : R.string.meid;
+
+ List<String> deviceIds = new ArrayList<String>();
+ for (int slot = 0; slot < telephonyManager.getPhoneCount(); slot++) {
+ deviceIds.add(telephonyManager.getDeviceId(slot));
+ }
+
+ AlertDialog alert = new AlertDialog.Builder(context)
+ .setTitle(labelResId)
+ .setItems(deviceIds.toArray(new String[deviceIds.size()]), null)
+ .setPositiveButton(R.string.ok, null)
+ .setCancelable(false)
+ .show();
+ return true;
+ }
return false;
}
@@ -264,36 +267,6 @@
return false;
}
- // TODO: Combine showIMEIPanel() and showMEIDPanel() into a single
- // generic "showDeviceIdPanel()" method, like in the apps/Phone
- // version of SpecialCharSequenceMgr.java. (This will require moving
- // the phone app's TelephonyCapabilities.getDeviceIdLabel() method
- // into the telephony framework, though.)
-
- private static void showIMEIPanel(Context context, boolean useSystemWindow,
- TelephonyManager telephonyManager) {
- String imeiStr = telephonyManager.getDeviceId();
-
- AlertDialog alert = new AlertDialog.Builder(context)
- .setTitle(R.string.imei)
- .setMessage(imeiStr)
- .setPositiveButton(android.R.string.ok, null)
- .setCancelable(false)
- .show();
- }
-
- private static void showMEIDPanel(Context context, boolean useSystemWindow,
- TelephonyManager telephonyManager) {
- String meidStr = telephonyManager.getDeviceId();
-
- AlertDialog alert = new AlertDialog.Builder(context)
- .setTitle(R.string.meid)
- .setMessage(meidStr)
- .setPositiveButton(android.R.string.ok, null)
- .setCancelable(false)
- .show();
- }
-
/*******
* This code is used to handle SIM Contact queries
*******/
diff --git a/src/com/android/dialer/activity/TransactionSafeActivity.java b/src/com/android/dialer/activity/TransactionSafeActivity.java
deleted file mode 100644
index d7a2120..0000000
--- a/src/com/android/dialer/activity/TransactionSafeActivity.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dialer.activity;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-import com.android.dialerbind.analytics.AnalyticsActivity;
-
-/**
- * A common superclass that keeps track of whether an {@link Activity} has saved its state yet or
- * not.
- */
-public abstract class TransactionSafeActivity extends AnalyticsActivity {
-
- private boolean mIsSafeToCommitTransactions;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mIsSafeToCommitTransactions = true;
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- mIsSafeToCommitTransactions = true;
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- mIsSafeToCommitTransactions = true;
- }
-
- @Override
- protected void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- mIsSafeToCommitTransactions = false;
- }
-
- /**
- * Returns true if it is safe to commit {@link FragmentTransaction}s at this time, based on
- * whether {@link Activity#onSaveInstanceState} has been called or not.
- *
- * Make sure that the current activity calls into
- * {@link super.onSaveInstanceState(Bundle outState)} (if that method is overridden),
- * so the flag is properly set.
- */
- public boolean isSafeToCommitTransactions() {
- return mIsSafeToCommitTransactions;
- }
-}
diff --git a/src/com/android/dialer/calllog/CallLogActivity.java b/src/com/android/dialer/calllog/CallLogActivity.java
index 036241c..1de3da2 100644
--- a/src/com/android/dialer/calllog/CallLogActivity.java
+++ b/src/com/android/dialer/calllog/CallLogActivity.java
@@ -37,7 +37,7 @@
import com.android.dialer.R;
import com.android.dialer.voicemail.VoicemailStatusHelper;
import com.android.dialer.voicemail.VoicemailStatusHelperImpl;
-import com.android.dialerbind.analytics.AnalyticsActivity;
+import com.android.contacts.commonbind.analytics.AnalyticsActivity;
public class CallLogActivity extends AnalyticsActivity implements CallLogQueryHandler.Listener {
private Handler mHandler;
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index dcd2de3..6afade4 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -74,10 +74,10 @@
/** Interface used to inform a parent UI element that a list item has been expanded. */
public interface CallItemExpandedListener {
/**
- * @param view The {@link CallLogListItemView} that represents the item that was clicked
+ * @param view The {@link View} that represents the item that was clicked
* on.
*/
- public void onItemExpanded(CallLogListItemView view);
+ public void onItemExpanded(View view);
/**
* Retrieves the call log view for the specified call Id. If the view is not currently
@@ -86,7 +86,7 @@
* @param callId The call Id.
* @return The call log view.
*/
- public CallLogListItemView getViewForCallId(long callId);
+ public View getViewForCallId(long callId);
}
/** Interface used to initiate a refresh of the content. */
@@ -248,6 +248,8 @@
private final ContactPhotoManager mContactPhotoManager;
/** Helper to parse and process phone numbers. */
private PhoneNumberDisplayHelper mPhoneNumberHelper;
+ /** Helper to access Telephony phone number utils class */
+ protected final PhoneNumberUtilsWrapper mPhoneNumberUtilsWrapper;
/** Helper to group call log entries. */
private final CallLogGroupBuilder mCallLogGroupBuilder;
@@ -284,7 +286,7 @@
private final View.OnClickListener mExpandCollapseListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
- final CallLogListItemView callLogItem = (CallLogListItemView) v.getParent().getParent();
+ final View callLogItem = (View) v.getParent().getParent();
handleRowExpanded(callLogItem, true /* animate */, false /* forceExpand */);
}
};
@@ -294,7 +296,7 @@
public boolean onRequestSendAccessibilityEvent(ViewGroup host, View child,
AccessibilityEvent event) {
if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED) {
- handleRowExpanded((CallLogListItemView) host, false /* animate */,
+ handleRowExpanded(host, false /* animate */,
true /* forceExpand */);
}
return super.onRequestSendAccessibilityEvent(host, child, event);
@@ -365,9 +367,10 @@
mExpandedTranslationZ = resources.getDimension(R.dimen.call_log_expanded_translation_z);
mContactPhotoManager = ContactPhotoManager.getInstance(mContext);
- mPhoneNumberHelper = new PhoneNumberDisplayHelper(resources);
- PhoneCallDetailsHelper phoneCallDetailsHelper = new PhoneCallDetailsHelper(
- resources, callTypeHelper, new PhoneNumberUtilsWrapper());
+ mPhoneNumberHelper = new PhoneNumberDisplayHelper(mContext, resources);
+ mPhoneNumberUtilsWrapper = new PhoneNumberUtilsWrapper(mContext);
+ PhoneCallDetailsHelper phoneCallDetailsHelper =
+ new PhoneCallDetailsHelper(mContext, resources, mPhoneNumberUtilsWrapper);
mCallLogViewsHelper =
new CallLogListItemHelper(
phoneCallDetailsHelper, mPhoneNumberHelper, resources);
@@ -585,8 +588,7 @@
@Override
protected View newChildView(Context context, ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(context);
- CallLogListItemView view =
- (CallLogListItemView) inflater.inflate(R.layout.call_log_list_item, parent, false);
+ View view = inflater.inflate(R.layout.call_log_list_item, parent, false);
// Get the views to bind to and cache them.
CallLogListItemViews views = CallLogListItemViews.fromView(view);
@@ -621,14 +623,13 @@
/**
* Binds the views in the entry to the data in the call log.
*
- * @param view the view corresponding to this entry
+ * @param callLogItemView the view corresponding to this entry
* @param c the cursor pointing to the entry in the call log
* @param count the number of entries in the current item, greater than 1 if it is a group
*/
- private void bindView(View view, Cursor c, int count) {
- view.setAccessibilityDelegate(mAccessibilityDelegate);
- final CallLogListItemView callLogItemView = (CallLogListItemView) view;
- final CallLogListItemViews views = (CallLogListItemViews) view.getTag();
+ private void bindView(View callLogItemView, Cursor c, int count) {
+ callLogItemView.setAccessibilityDelegate(mAccessibilityDelegate);
+ final CallLogListItemViews views = (CallLogListItemViews) callLogItemView.getTag();
// Default case: an item in the call log.
views.primaryActionView.setVisibility(View.VISIBLE);
@@ -641,8 +642,6 @@
final PhoneAccountHandle accountHandle = PhoneAccountUtils.getAccount(
c.getString(CallLogQuery.ACCOUNT_COMPONENT_NAME),
c.getString(CallLogQuery.ACCOUNT_ID));
- final Drawable accountIcon = PhoneAccountUtils.getAccountIcon(mContext,
- accountHandle);
final String countryIso = c.getString(CallLogQuery.COUNTRY_ISO);
final long rowId = c.getLong(CallLogQuery.ID);
@@ -668,7 +667,6 @@
views.number = number;
views.numberPresentation = numberPresentation;
views.callType = callType;
- // NOTE: This is currently not being used, but can be used in future versions.
views.accountHandle = accountHandle;
views.voicemailUri = c.getString(CallLogQuery.VOICEMAIL_URI);
// Stash away the Ids of the calls so that we can support deleting a row in the call log.
@@ -677,7 +675,7 @@
final ContactInfo cachedContactInfo = getContactInfoFromCallLog(c);
final boolean isVoicemailNumber =
- PhoneNumberUtilsWrapper.INSTANCE.isVoicemailNumber(number);
+ mPhoneNumberUtilsWrapper.isVoicemailNumber(accountHandle, number);
// Where binding and not in the call log, use default behaviour of invoking a call when
// tapping the primary view.
@@ -687,7 +685,13 @@
// Set return call intent, otherwise null.
if (PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)) {
// Sets the primary action to call the number.
- views.primaryActionView.setTag(IntentProvider.getReturnCallIntentProvider(number));
+ if (isVoicemailNumber) {
+ views.primaryActionView.setTag(
+ IntentProvider.getReturnVoicemailCallIntentProvider());
+ } else {
+ views.primaryActionView.setTag(
+ IntentProvider.getReturnCallIntentProvider(number));
+ }
} else {
// Number is not callable, so hide button.
views.primaryActionView.setTag(null);
@@ -769,14 +773,13 @@
expandOrCollapseActions(callLogItemView, isExpanded(rowId));
if (TextUtils.isEmpty(name)) {
- details = new PhoneCallDetails(number, numberPresentation,
- formattedNumber, countryIso, geocode, callTypes, date,
- duration, null, accountIcon, features, dataUsage, transcription);
+ details = new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso,
+ geocode, callTypes, date, duration, accountHandle, features, dataUsage,
+ transcription);
} else {
- details = new PhoneCallDetails(number, numberPresentation,
- formattedNumber, countryIso, geocode, callTypes, date,
- duration, name, ntype, label, lookupUri, photoUri, sourceType,
- null, accountIcon, features, dataUsage, transcription);
+ details = new PhoneCallDetails(number, numberPresentation, formattedNumber, countryIso,
+ geocode, callTypes, date, duration, name, ntype, label, lookupUri, photoUri,
+ sourceType, accountHandle, features, dataUsage, transcription);
}
mCallLogViewsHelper.setPhoneCallDetails(mContext, views, details);
@@ -794,8 +797,8 @@
String nameForDefaultImage = null;
if (TextUtils.isEmpty(name)) {
- nameForDefaultImage = mPhoneNumberHelper.getDisplayNumber(details.number,
- details.numberPresentation, details.formattedNumber).toString();
+ nameForDefaultImage = mPhoneNumberHelper.getDisplayNumber(details.accountHandle,
+ details.number, details.numberPresentation, details.formattedNumber).toString();
} else {
nameForDefaultImage = name;
}
@@ -808,11 +811,11 @@
// Listen for the first draw
if (mViewTreeObserver == null) {
- mViewTreeObserver = view.getViewTreeObserver();
+ mViewTreeObserver = callLogItemView.getViewTreeObserver();
mViewTreeObserver.addOnPreDrawListener(this);
}
- bindBadge(view, info, details, callType);
+ bindBadge(callLogItemView, info, details, callType);
}
/**
@@ -881,12 +884,13 @@
}
/**
- * Expands or collapses the view containing the CALLBACK, VOICEMAIL and DETAILS action buttons.
+ * Expands or collapses the view containing the CALLBACK/REDIAL, VOICEMAIL and DETAILS action
+ * buttons.
*
* @param callLogItem The call log entry parent view.
* @param isExpanded The new expansion state of the view.
*/
- private void expandOrCollapseActions(CallLogListItemView callLogItem, boolean isExpanded) {
+ private void expandOrCollapseActions(View callLogItem, boolean isExpanded) {
final CallLogListItemViews views = (CallLogListItemViews)callLogItem.getTag();
expandVoicemailTranscriptionView(views, isExpanded);
@@ -985,9 +989,18 @@
PhoneNumberUtilsWrapper.canPlaceCallsTo(views.number, views.numberPresentation);
// Set return call intent, otherwise null.
if (canPlaceCallToNumber) {
- // Sets the primary action to call the number.
- views.callBackButtonView.setTag(
- IntentProvider.getReturnCallIntentProvider(views.number));
+ boolean isVoicemailNumber =
+ mPhoneNumberUtilsWrapper.isVoicemailNumber(views.accountHandle, views.number);
+ if (isVoicemailNumber) {
+ // Make a general call to voicemail to ensure that if there are multiple accounts
+ // it does not call the voicemail number of a specific phone account.
+ views.callBackButtonView.setTag(
+ IntentProvider.getReturnVoicemailCallIntentProvider());
+ } else {
+ // Sets the primary action to call the number.
+ views.callBackButtonView.setTag(
+ IntentProvider.getReturnCallIntentProvider(views.number));
+ }
views.callBackButtonView.setVisibility(View.VISIBLE);
views.callBackButtonView.setOnClickListener(mActionListener);
} else {
@@ -1372,7 +1385,7 @@
* @param forceExpand Whether or not to force the call log row into an expanded state regardless
* of its previous state
*/
- private void handleRowExpanded(CallLogListItemView view, boolean animate, boolean forceExpand) {
+ private void handleRowExpanded(View view, boolean animate, boolean forceExpand) {
final CallLogListItemViews views = (CallLogListItemViews) view.getTag();
if (forceExpand && isExpanded(views.rowId)) {
@@ -1393,7 +1406,7 @@
// Animate the collapse of the previous item if it is still visible on screen.
if (mPreviouslyExpanded != NONE_EXPANDED) {
- CallLogListItemView previousItem = mCallItemExpandedListener.getViewForCallId(
+ View previousItem = mCallItemExpandedListener.getViewForCallId(
mPreviouslyExpanded);
if (previousItem != null) {
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index e5c3c58..dfb7749 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -33,7 +33,6 @@
import android.provider.CallLog.Calls;
import android.provider.ContactsContract;
import android.provider.VoicemailContract.Status;
-import android.util.MutableInt;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -53,7 +52,7 @@
import com.android.dialer.voicemail.VoicemailStatusHelper.StatusMessage;
import com.android.dialer.voicemail.VoicemailStatusHelperImpl;
import com.android.dialerbind.ObjectFactory;
-import com.android.dialerbind.analytics.AnalyticsListFragment;
+import com.android.contacts.commonbind.analytics.AnalyticsListFragment;
import java.util.List;
@@ -549,7 +548,7 @@
}
@Override
- public void onItemExpanded(final CallLogListItemView view) {
+ public void onItemExpanded(final View view) {
final int startingHeight = view.getHeight();
final CallLogListItemViews viewHolder = (CallLogListItemViews) view.getTag();
final ViewTreeObserver observer = getListView().getViewTreeObserver();
@@ -662,7 +661,7 @@
* @return The call log view.
*/
@Override
- public CallLogListItemView getViewForCallId(long callId) {
+ public View getViewForCallId(long callId) {
ListView listView = getListView();
int firstPosition = listView.getFirstVisiblePosition();
@@ -674,7 +673,7 @@
if (view != null) {
final CallLogListItemViews viewHolder = (CallLogListItemViews) view.getTag();
if (viewHolder != null && viewHolder.rowId == callId) {
- return (CallLogListItemView)view;
+ return view;
}
}
}
diff --git a/src/com/android/dialer/calllog/CallLogListItemHelper.java b/src/com/android/dialer/calllog/CallLogListItemHelper.java
index 68ca7a8..1eb25fb 100644
--- a/src/com/android/dialer/calllog/CallLogListItemHelper.java
+++ b/src/com/android/dialer/calllog/CallLogListItemHelper.java
@@ -222,7 +222,7 @@
if (!TextUtils.isEmpty(details.name)) {
recipient = details.name;
} else {
- recipient = mPhoneNumberHelper.getDisplayNumber(
+ recipient = mPhoneNumberHelper.getDisplayNumber(details.accountHandle,
details.number, details.numberPresentation, details.formattedNumber);
}
return recipient;
diff --git a/src/com/android/dialer/calllog/CallLogListItemView.java b/src/com/android/dialer/calllog/CallLogListItemView.java
deleted file mode 100644
index b8990f5..0000000
--- a/src/com/android/dialer/calllog/CallLogListItemView.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dialer.calllog;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.widget.LinearLayout;
-
-/**
- * An entry in the call log.
- */
-public class CallLogListItemView extends LinearLayout {
- public CallLogListItemView(Context context) {
- super(context);
- }
-
- public CallLogListItemView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public CallLogListItemView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-}
diff --git a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
index 837cfba..970cad6 100644
--- a/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
+++ b/src/com/android/dialer/calllog/DefaultVoicemailNotifier.java
@@ -28,12 +28,14 @@
import android.net.Uri;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.PhoneLookup;
+import android.telecom.PhoneAccountHandle;
import android.text.TextUtils;
import android.util.Log;
import com.android.common.io.MoreCloseables;
import com.android.dialer.CallDetailActivity;
import com.android.dialer.R;
+import com.android.dialer.calllog.PhoneAccountUtils;
import com.google.common.collect.Maps;
import java.util.Map;
@@ -118,7 +120,10 @@
// Check if we already know the name associated with this number.
String name = names.get(newCall.number);
if (name == null) {
- name = mPhoneNumberHelper.getDisplayName(newCall.number,
+ PhoneAccountHandle accountHandle = PhoneAccountUtils.getAccount(
+ newCall.accountComponentName,
+ newCall.accountId);
+ name = mPhoneNumberHelper.getDisplayName(accountHandle, newCall.number,
newCall.numberPresentation).toString();
// If we cannot lookup the contact, use the number instead.
if (TextUtils.isEmpty(name)) {
@@ -214,13 +219,17 @@
public final Uri voicemailUri;
public final String number;
public final int numberPresentation;
+ public final String accountComponentName;
+ public final String accountId;
public NewCall(Uri callsUri, Uri voicemailUri, String number,
- int numberPresentation) {
+ int numberPresentation, String accountComponentName, String accountId) {
this.callsUri = callsUri;
this.voicemailUri = voicemailUri;
this.number = number;
this.numberPresentation = numberPresentation;
+ this.accountComponentName = accountComponentName;
+ this.accountId = accountId;
}
}
@@ -243,12 +252,15 @@
*/
private static final class DefaultNewCallsQuery implements NewCallsQuery {
private static final String[] PROJECTION = {
- Calls._ID, Calls.NUMBER, Calls.VOICEMAIL_URI, Calls.NUMBER_PRESENTATION
+ Calls._ID, Calls.NUMBER, Calls.VOICEMAIL_URI, Calls.NUMBER_PRESENTATION,
+ Calls.PHONE_ACCOUNT_COMPONENT_NAME, Calls.PHONE_ACCOUNT_ID
};
private static final int ID_COLUMN_INDEX = 0;
private static final int NUMBER_COLUMN_INDEX = 1;
private static final int VOICEMAIL_URI_COLUMN_INDEX = 2;
private static final int NUMBER_PRESENTATION_COLUMN_INDEX = 3;
+ private static final int PHONE_ACCOUNT_COMPONENT_NAME_COLUMN_INDEX = 4;
+ private static final int PHONE_ACCOUNT_ID_COLUMN_INDEX = 5;
private final ContentResolver mContentResolver;
@@ -284,7 +296,9 @@
Calls.CONTENT_URI_WITH_VOICEMAIL, cursor.getLong(ID_COLUMN_INDEX));
Uri voicemailUri = voicemailUriString == null ? null : Uri.parse(voicemailUriString);
return new NewCall(callsUri, voicemailUri, cursor.getString(NUMBER_COLUMN_INDEX),
- cursor.getInt(NUMBER_PRESENTATION_COLUMN_INDEX));
+ cursor.getInt(NUMBER_PRESENTATION_COLUMN_INDEX),
+ cursor.getString(PHONE_ACCOUNT_COMPONENT_NAME_COLUMN_INDEX),
+ cursor.getString(PHONE_ACCOUNT_ID_COLUMN_INDEX));
}
}
@@ -343,6 +357,6 @@
* called from the main thread.
*/
public static PhoneNumberDisplayHelper createPhoneNumberHelper(Context context) {
- return new PhoneNumberDisplayHelper(context.getResources());
+ return new PhoneNumberDisplayHelper(context, context.getResources());
}
}
diff --git a/src/com/android/dialer/calllog/IntentProvider.java b/src/com/android/dialer/calllog/IntentProvider.java
index 874d4ca..3084e24 100644
--- a/src/com/android/dialer/calllog/IntentProvider.java
+++ b/src/com/android/dialer/calllog/IntentProvider.java
@@ -65,6 +65,15 @@
};
}
+ public static IntentProvider getReturnVoicemailCallIntentProvider() {
+ return new IntentProvider() {
+ @Override
+ public Intent getIntent(Context context) {
+ return CallUtil.getVoicemailIntent();
+ }
+ };
+ }
+
public static IntentProvider getPlayVoicemailIntentProvider(final long rowId,
final String voicemailUri) {
return new IntentProvider() {
diff --git a/src/com/android/dialer/calllog/PhoneAccountUtils.java b/src/com/android/dialer/calllog/PhoneAccountUtils.java
index d716aee..20b81d8 100644
--- a/src/com/android/dialer/calllog/PhoneAccountUtils.java
+++ b/src/com/android/dialer/calllog/PhoneAccountUtils.java
@@ -29,10 +29,9 @@
*/
public class PhoneAccountUtils {
/**
- * Generate account info from data in Telecomm database
+ * Compose PhoneAccount object from component name and account id
*/
- public static PhoneAccountHandle getAccount(String componentString,
- String accountId) {
+ public static PhoneAccountHandle getAccount(String componentString, String accountId) {
if (TextUtils.isEmpty(componentString) || TextUtils.isEmpty(accountId)) {
return null;
}
@@ -41,7 +40,7 @@
}
/**
- * Generate account icon from data in Telecomm database
+ * Extract account icon from PhoneAccount object
*/
public static Drawable getAccountIcon(Context context, PhoneAccountHandle phoneAccount) {
final PhoneAccount account = getAccountOrNull(context, phoneAccount);
@@ -52,7 +51,7 @@
}
/**
- * Generate account label from data in Telecomm database
+ * Extract account label from PhoneAccount object
*/
public static String getAccountLabel(Context context, PhoneAccountHandle phoneAccount) {
final PhoneAccount account = getAccountOrNull(context, phoneAccount);
@@ -66,8 +65,7 @@
* Retrieve the account metadata, but if the account does not exist or the device has only a
* single registered and enabled account, return null.
*/
- private static PhoneAccount getAccountOrNull(Context context,
- PhoneAccountHandle phoneAccount) {
+ private static PhoneAccount getAccountOrNull(Context context, PhoneAccountHandle phoneAccount) {
final TelecomManager telecomManager =
(TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
final PhoneAccount account = telecomManager.getPhoneAccount(phoneAccount);
diff --git a/src/com/android/dialer/calllog/PhoneNumberDisplayHelper.java b/src/com/android/dialer/calllog/PhoneNumberDisplayHelper.java
index 5d7ce7e..0dffd86 100644
--- a/src/com/android/dialer/calllog/PhoneNumberDisplayHelper.java
+++ b/src/com/android/dialer/calllog/PhoneNumberDisplayHelper.java
@@ -16,8 +16,10 @@
package com.android.dialer.calllog;
+import android.content.Context;
import android.content.res.Resources;
import android.provider.CallLog.Calls;
+import android.telecom.PhoneAccountHandle;
import android.text.TextUtils;
import android.util.Log;
@@ -27,20 +29,25 @@
* Helper for formatting and managing the display of phone numbers.
*/
public class PhoneNumberDisplayHelper {
- private final PhoneNumberUtilsWrapper mPhoneNumberUtils;
+ private final Context mContext;
private final Resources mResources;
+ private final PhoneNumberUtilsWrapper mPhoneNumberUtilsWrapper;
- public PhoneNumberDisplayHelper(Resources resources) {
+ public PhoneNumberDisplayHelper(Context context, Resources resources) {
+ mContext = context;
mResources = resources;
- mPhoneNumberUtils = new PhoneNumberUtilsWrapper();
+ mPhoneNumberUtilsWrapper = new PhoneNumberUtilsWrapper(context);
}
- public PhoneNumberDisplayHelper(PhoneNumberUtilsWrapper phoneNumberUtils, Resources resources) {
- mPhoneNumberUtils = phoneNumberUtils;
+ public PhoneNumberDisplayHelper(Context context, Resources resources,
+ PhoneNumberUtilsWrapper phoneNumberUtils) {
+ mContext = context;
mResources = resources;
+ mPhoneNumberUtilsWrapper = phoneNumberUtils;
}
- /* package */ CharSequence getDisplayName(CharSequence number, int presentation) {
+ /* package */ CharSequence getDisplayName(PhoneAccountHandle accountHandle, CharSequence number,
+ int presentation) {
if (presentation == Calls.PRESENTATION_UNKNOWN) {
return mResources.getString(R.string.unknown);
}
@@ -50,7 +57,7 @@
if (presentation == Calls.PRESENTATION_PAYPHONE) {
return mResources.getString(R.string.payphone);
}
- if (mPhoneNumberUtils.isVoicemailNumber(number)) {
+ if (mPhoneNumberUtilsWrapper.isVoicemailNumber(accountHandle, number)) {
return mResources.getString(R.string.voicemail);
}
if (PhoneNumberUtilsWrapper.isLegacyUnknownNumbers(number)) {
@@ -62,13 +69,14 @@
/**
* Returns the string to display for the given phone number.
*
+ * @param accountHandle The handle for the account corresponding to the call
* @param number the number to display
* @param formattedNumber the formatted number if available, may be null
*/
- public CharSequence getDisplayNumber(CharSequence number,
+ public CharSequence getDisplayNumber(PhoneAccountHandle accountHandle, CharSequence number,
int presentation, CharSequence formattedNumber) {
- final CharSequence displayName = getDisplayName(number, presentation);
+ final CharSequence displayName = getDisplayName(accountHandle, number, presentation);
if (!TextUtils.isEmpty(displayName)) {
return displayName;
}
diff --git a/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java b/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
index 00a260a..11f4a67 100644
--- a/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
+++ b/src/com/android/dialer/calllog/PhoneNumberUtilsWrapper.java
@@ -16,7 +16,10 @@
package com.android.dialer.calllog;
+import android.content.Context;
import android.provider.CallLog;
+import android.telecom.PhoneAccountHandle;
+import android.telecom.TelecomManager;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
@@ -30,8 +33,12 @@
*
*/
public class PhoneNumberUtilsWrapper {
- public static final PhoneNumberUtilsWrapper INSTANCE = new PhoneNumberUtilsWrapper();
private static final Set<String> LEGACY_UNKNOWN_NUMBERS = Sets.newHashSet("-1", "-2", "-3");
+ private final Context mContext;
+
+ public PhoneNumberUtilsWrapper(Context context) {
+ mContext = context;
+ }
/** Returns true if it is possible to place a call to the given number. */
public static boolean canPlaceCallsTo(CharSequence number, int presentation) {
@@ -40,30 +47,26 @@
}
/**
- * Returns true if it is possible to send an SMS to the given number.
- */
- public boolean canSendSmsTo(CharSequence number, int presentation) {
- return canPlaceCallsTo(number, presentation) && !isVoicemailNumber(number) && !isSipNumber(
- number);
- }
-
- /**
* Returns true if the given number is the number of the configured voicemail. To be able to
* mock-out this, it is not a static method.
*/
- public boolean isVoicemailNumber(CharSequence number) {
- return number!= null && PhoneNumberUtils.isVoiceMailNumber(number.toString());
+ public boolean isVoicemailNumber(PhoneAccountHandle accountHandle,
+ CharSequence number) {
+ final TelecomManager telecomManager =
+ (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
+ return number!= null && telecomManager.isVoiceMailNumber(accountHandle, number.toString());
}
/**
* Returns true if the given number is a SIP address. To be able to mock-out this, it is not a
* static method.
*/
- public boolean isSipNumber(CharSequence number) {
+ public static boolean isSipNumber(CharSequence number) {
return number != null && PhoneNumberHelper.isUriNumber(number.toString());
}
- public static boolean isUnknownNumberThatCanBeLookedUp(CharSequence number, int presentation) {
+ public boolean isUnknownNumberThatCanBeLookedUp(PhoneAccountHandle accountHandle,
+ CharSequence number, int presentation) {
if (presentation == CallLog.Calls.PRESENTATION_UNKNOWN) {
return false;
}
@@ -76,7 +79,7 @@
if (TextUtils.isEmpty(number)) {
return false;
}
- if (INSTANCE.isVoicemailNumber(number)) {
+ if (isVoicemailNumber(accountHandle, number)) {
return false;
}
if (isLegacyUnknownNumbers(number)) {
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index 7faed07..c9ea25a 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -72,12 +72,12 @@
import com.android.contacts.common.util.PhoneNumberFormatter;
import com.android.contacts.common.util.StopWatch;
import com.android.contacts.common.widget.FloatingActionButtonController;
+import com.android.contacts.commonbind.analytics.AnalyticsFragment;
import com.android.dialer.DialtactsActivity;
import com.android.dialer.NeededForReflection;
import com.android.dialer.R;
import com.android.dialer.SpecialCharSequenceMgr;
import com.android.dialer.util.DialerUtils;
-import com.android.dialerbind.analytics.AnalyticsFragment;
import com.android.phone.common.CallLogAsync;
import com.android.phone.common.HapticFeedback;
import com.android.phone.common.animation.AnimUtils;
@@ -255,13 +255,6 @@
private static final String PREF_DIGITS_FILLED_BY_INTENT = "pref_digits_filled_by_intent";
- /**
- * Return an Intent for launching voicemail screen.
- */
- private static Intent getVoicemailIntent() {
- return CallUtil.getCallIntent(Uri.fromParts(PhoneAccount.SCHEME_VOICEMAIL, "", null));
- }
-
private TelephonyManager getTelephonyManager() {
return (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
}
@@ -974,7 +967,7 @@
}
public void callVoicemail() {
- DialerUtils.startActivityWithErrorToast(getActivity(), getVoicemailIntent());
+ DialerUtils.startActivityWithErrorToast(getActivity(), CallUtil.getVoicemailIntent());
hideAndClearDialpad(false);
}
diff --git a/src/com/android/dialer/dialpad/SmartDialCursorLoader.java b/src/com/android/dialer/dialpad/SmartDialCursorLoader.java
index 3690796..d01776c 100644
--- a/src/com/android/dialer/dialpad/SmartDialCursorLoader.java
+++ b/src/com/android/dialer/dialpad/SmartDialCursorLoader.java
@@ -20,8 +20,6 @@
import android.content.Context;
import android.database.Cursor;
import android.database.MatrixCursor;
-import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.telephony.PhoneNumberUtils;
import android.util.Log;
import com.android.contacts.common.list.PhoneNumberListAdapter.PhoneQuery;
diff --git a/src/com/android/dialer/interactions/PhoneNumberInteraction.java b/src/com/android/dialer/interactions/PhoneNumberInteraction.java
index b61a496..de217ce 100644
--- a/src/com/android/dialer/interactions/PhoneNumberInteraction.java
+++ b/src/com/android/dialer/interactions/PhoneNumberInteraction.java
@@ -49,9 +49,9 @@
import com.android.contacts.common.Collapser;
import com.android.contacts.common.Collapser.Collapsible;
import com.android.contacts.common.MoreContactUtils;
+import com.android.contacts.common.activity.TransactionSafeActivity;
import com.android.contacts.common.util.ContactDisplayUtils;
import com.android.dialer.R;
-import com.android.dialer.activity.TransactionSafeActivity;
import com.android.dialer.contact.ContactUpdateService;
import com.android.dialer.util.DialerUtils;
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java
index 024e3d9..de501f4 100644
--- a/src/com/android/dialer/list/ListsFragment.java
+++ b/src/com/android/dialer/list/ListsFragment.java
@@ -20,6 +20,7 @@
import com.android.contacts.common.GeoUtil;
import com.android.contacts.common.list.ViewPagerTabs;
+import com.android.contacts.commonbind.analytics.AnalyticsFragment;
import com.android.dialer.DialtactsActivity;
import com.android.dialer.R;
import com.android.dialer.calllog.CallLogAdapter;
@@ -31,7 +32,6 @@
import com.android.dialer.util.DialerUtils;
import com.android.dialer.widget.OverlappingPaneLayout;
import com.android.dialer.widget.OverlappingPaneLayout.PanelSlideCallbacks;
-import com.android.dialerbind.analytics.AnalyticsFragment;
import com.android.dialerbind.ObjectFactory;
import java.util.ArrayList;
diff --git a/src/com/android/dialer/list/ShortcutCardsAdapter.java b/src/com/android/dialer/list/ShortcutCardsAdapter.java
index 4fe638e..78b774b 100644
--- a/src/com/android/dialer/list/ShortcutCardsAdapter.java
+++ b/src/com/android/dialer/list/ShortcutCardsAdapter.java
@@ -32,7 +32,6 @@
import com.android.dialer.R;
import com.android.dialer.calllog.CallLogAdapter;
-import com.android.dialer.calllog.CallLogListItemView;
import com.android.dialer.calllog.CallLogNotificationsHelper;
import com.android.dialer.calllog.CallLogQueryHandler;
import com.android.dialer.list.SwipeHelper.OnItemGestureListener;
@@ -266,8 +265,7 @@
R.dimen.recent_call_log_item_translation_z);
view.setTranslationZ(mPreviousTranslationZ);
- final CallLogListItemView callLogItem =
- (CallLogListItemView) view.findViewById(R.id.call_log_list_item);
+ final ViewGroup callLogItem = (ViewGroup) view.findViewById(R.id.call_log_list_item);
// Reset the internal call log item view if it is being recycled
callLogItem.setTranslationX(0);
callLogItem.setTranslationY(0);
diff --git a/src/com/android/dialer/list/SpeedDialFragment.java b/src/com/android/dialer/list/SpeedDialFragment.java
index c02c3d7..fd761b7 100644
--- a/src/com/android/dialer/list/SpeedDialFragment.java
+++ b/src/com/android/dialer/list/SpeedDialFragment.java
@@ -46,9 +46,9 @@
import com.android.contacts.common.ContactTileLoaderFactory;
import com.android.contacts.common.list.ContactTileView;
import com.android.contacts.common.list.OnPhoneNumberPickerActionListener;
+import com.android.contacts.commonbind.analytics.AnalyticsFragment;
import com.android.dialer.R;
import com.android.dialer.util.DialerUtils;
-import com.android.dialerbind.analytics.AnalyticsFragment;
import java.util.ArrayList;
import java.util.HashMap;
@@ -150,8 +150,6 @@
private View mContactTileFrame;
- private TileInteractionTeaserView mTileInteractionTeaserView;
-
private final HashMap<Long, Integer> mItemIdTopMap = new HashMap<Long, Integer>();
private final HashMap<Long, Integer> mItemIdLeftMap = new HashMap<Long, Integer>();
@@ -217,9 +215,6 @@
mContactTileFrame = mParentView.findViewById(R.id.contact_tile_frame);
- mTileInteractionTeaserView = (TileInteractionTeaserView) inflater.inflate(
- R.layout.tile_interactions_teaser_view, mListView, false);
-
final LayoutAnimationController controller = new LayoutAnimationController(
AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
controller.setDelay(0);
diff --git a/src/com/android/dialer/list/TileInteractionTeaserView.java b/src/com/android/dialer/list/TileInteractionTeaserView.java
deleted file mode 100644
index fd5ed34..0000000
--- a/src/com/android/dialer/list/TileInteractionTeaserView.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package com.android.dialer.list;
-
-import android.animation.Animator;
-
-import android.animation.ValueAnimator;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.res.Resources;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-import android.view.animation.DecelerateInterpolator;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.android.dialer.DialtactsActivity;
-import com.android.dialer.R;
-
-/**
- * A teaser to introduce people to the contact photo check boxes
- */
-public class TileInteractionTeaserView extends FrameLayout {
- private static int sShrinkAnimationDuration;
-
- private static final String KEY_TILE_INTERACTION_TEASER_SHOWN =
- "key_tile_interaction_teaser_shown";
-
- private boolean mNeedLayout;
- private int mTextTop;
- private int mAnimatedHeight = -1;
-
- private ShortcutCardsAdapter mAdapter;
-
- public TileInteractionTeaserView(final Context context) {
- this(context, null);
- }
-
- public TileInteractionTeaserView(final Context context, final AttributeSet attrs) {
- super(context, attrs);
- final Resources resources = context.getResources();
-
- mNeedLayout = true;
- sShrinkAnimationDuration = resources.getInteger(R.integer.escape_animation_duration);
- }
-
- @Override
- protected void onFinishInflate() {
- findViewById(R.id.dismiss_button).setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- startDestroyAnimation();
- }
- });
- }
-
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- super.onLayout(changed, left, top, right, bottom);
-
- final TextView text = (TextView) findViewById(R.id.text);
- final ImageView arrow = (ImageView) findViewById(R.id.arrow);
-
- // We post to avoid calling layout within layout
- arrow.post(new Runnable() {
- @Override
- public void run() {
-
- // The text top is changed when we move the arrow, so we need to
- // do multiple passes
- int textTop = text.getTop();
- if (mNeedLayout || textTop != mTextTop) {
- mNeedLayout = false;
- mTextTop = textTop;
-
- final int lineHeight = text.getLineHeight();
- final LinearLayout.LayoutParams arrowParams = (LinearLayout.LayoutParams) arrow
- .getLayoutParams();
- arrowParams.topMargin = mTextTop + lineHeight / 2;
- arrow.setLayoutParams(arrowParams);
- }
- arrow.setVisibility(View.VISIBLE);
- }
- });
- }
-
- public boolean getShouldDisplayInList() {
- final SharedPreferences prefs = getContext().getSharedPreferences(
- DialtactsActivity.SHARED_PREFS_NAME, Context.MODE_PRIVATE);
- return prefs.getBoolean(KEY_TILE_INTERACTION_TEASER_SHOWN, true);
- }
-
- public void setAdapter(ShortcutCardsAdapter adapter) {
- mAdapter = adapter;
- }
-
- private void startDestroyAnimation() {
- final int start = getHeight();
- final int end = 0;
- mAnimatedHeight = start;
- Log.v("Interaction", "Start from" + start);
-
- ValueAnimator heightAnimator = ValueAnimator.ofInt(start, end);
- heightAnimator.setDuration(sShrinkAnimationDuration);
- heightAnimator.setInterpolator(new DecelerateInterpolator(2.0f));
- heightAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
- public void onAnimationUpdate(ValueAnimator animation) {
- mAnimatedHeight = (Integer) animation.getAnimatedValue();
- requestLayout();
- }
- });
- heightAnimator.addListener(new Animator.AnimatorListener() {
- @Override
- public void onAnimationStart(Animator animator) {
- }
-
- @Override
- public void onAnimationEnd(Animator animator) {
- setVisibility(GONE);
- setDismissed();
- if (mAdapter != null) {
- mAdapter.notifyDataSetChanged();
- }
- }
-
- @Override
- public void onAnimationCancel(Animator animator) {
- }
-
- @Override
- public void onAnimationRepeat(Animator animator) {
- }
- });
-
- heightAnimator.start();
- }
-
- private void setDismissed() {
- final SharedPreferences prefs = getContext().getSharedPreferences(
- DialtactsActivity.SHARED_PREFS_NAME, Context.MODE_PRIVATE);
- prefs.edit().putBoolean(KEY_TILE_INTERACTION_TEASER_SHOWN, false).apply();
- }
-
- @Override
- protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
- if (mAnimatedHeight == -1) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- } else {
- setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), mAnimatedHeight);
- }
- }
-}
diff --git a/src/com/android/dialer/settings/DialerSettingsActivity.java b/src/com/android/dialer/settings/DialerSettingsActivity.java
index f7a92d7..4318666 100644
--- a/src/com/android/dialer/settings/DialerSettingsActivity.java
+++ b/src/com/android/dialer/settings/DialerSettingsActivity.java
@@ -3,25 +3,28 @@
import com.google.common.collect.Lists;
import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.preference.PreferenceManager;
import android.preference.PreferenceActivity.Header;
+import android.telecom.TelecomManager;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
-import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.TextView;
+import com.android.contacts.commonbind.analytics.AnalyticsPreferenceActivity;
+
import com.android.dialer.DialtactsActivity;
import com.android.dialer.R;
-import com.android.dialerbind.analytics.AnalyticsPreferenceActivity;
import java.util.List;
@@ -46,13 +49,28 @@
generalSettingsHeader.fragment = GeneralSettingsFragment.class.getName();
target.add(generalSettingsHeader);
- // Only add the call settings header if the current user is the primary/owner user.
+ // Only show call setting menus if the current user is the primary/owner user.
if (isPrimaryUser()) {
- final Header callSettingHeader = new Header();
- callSettingHeader.titleRes = R.string.call_settings_label;
- callSettingHeader.summaryRes = R.string.call_settings_description;
- callSettingHeader.intent = DialtactsActivity.getCallSettingsIntent();
- target.add(callSettingHeader);
+ final TelephonyManager telephonyManager =
+ (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
+ // Show "Call Settings" if there is one SIM and "Phone Accounts" if there are more.
+ if (telephonyManager.getPhoneCount() <= 1) {
+ final Header callSettingsHeader = new Header();
+ callSettingsHeader.titleRes = R.string.call_settings_label;
+ callSettingsHeader.summaryRes = R.string.call_settings_description;
+ callSettingsHeader.intent = DialtactsActivity.getCallSettingsIntent();
+ target.add(callSettingsHeader);
+ } else {
+ final Header phoneAccountSettingsHeader = new Header();
+ final Intent phoneAccountSettingsIntent =
+ new Intent(TelecomManager.ACTION_CHANGE_PHONE_ACCOUNTS);
+ phoneAccountSettingsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+
+ phoneAccountSettingsHeader.titleRes = R.string.phone_account_settings_label;
+ phoneAccountSettingsHeader.summaryRes = R.string.phone_account_settings_description;
+ phoneAccountSettingsHeader.intent = phoneAccountSettingsIntent;
+ target.add(phoneAccountSettingsHeader);
+ }
}
}
diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java b/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java
index 133a988..2a76ed3 100644
--- a/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java
+++ b/src/com/android/dialer/voicemail/VoicemailPlaybackFragment.java
@@ -39,15 +39,14 @@
import android.widget.TextView;
import com.android.common.io.MoreCloseables;
+import com.android.contacts.commonbind.analytics.AnalyticsFragment;
import com.android.dialer.ProximitySensorAware;
import com.android.dialer.R;
import com.android.dialer.util.AsyncTaskExecutors;
-import com.android.dialerbind.analytics.AnalyticsFragment;
import com.android.ex.variablespeed.MediaPlayerProxy;
import com.android.ex.variablespeed.VariableSpeed;
import com.google.common.base.Preconditions;
-import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
diff --git a/src/com/android/dialer/widget/SearchEditTextLayout.java b/src/com/android/dialer/widget/SearchEditTextLayout.java
index 919f65c..f22a3be 100644
--- a/src/com/android/dialer/widget/SearchEditTextLayout.java
+++ b/src/com/android/dialer/widget/SearchEditTextLayout.java
@@ -101,6 +101,17 @@
mExpandedSearchBox = findViewById(R.id.search_box_expanded);
mClearButtonView = findViewById(R.id.search_close_button);
+ // Convert a long click into a click to expand the search box, and then long click on the
+ // search view. This accelerates the long-press scenario for copy/paste.
+ mCollapsedSearchBox.setOnLongClickListener(new OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View view) {
+ mCollapsedSearchBox.performClick();
+ mSearchView.performLongClick();
+ return false;
+ }
+ });
+
mSearchView.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
diff --git a/src/com/android/dialer/widget/ViewDragHelper.java b/src/com/android/dialer/widget/ViewDragHelper.java
index a0e1d80..c0bc2ce 100644
--- a/src/com/android/dialer/widget/ViewDragHelper.java
+++ b/src/com/android/dialer/widget/ViewDragHelper.java
@@ -1548,6 +1548,12 @@
* deltas that it consumed.
*/
public void processNestedScroll(View target, int dx, int dy, int[] consumed) {
+ if (mCapturedView == null) {
+ // This is safe because consumed array is null when called from
+ // onNestedScroll, and pre-initialized to {0, 0} when called from
+ // onNestedPreScroll.
+ return;
+ }
final int targetX = mCapturedView.getLeft() + dx;
final int targetY = mCapturedView.getTop() + dy;
dragTo(targetX, targetY, dx, dy);
diff --git a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
index bc7c033..7ae2c22 100644
--- a/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
+++ b/tests/src/com/android/dialer/PhoneCallDetailsHelperTest.java
@@ -25,7 +25,6 @@
import android.view.View;
import android.widget.TextView;
-import com.android.dialer.calllog.CallTypeHelper;
import com.android.dialer.calllog.TestPhoneNumberUtilsWrapper;
import com.android.dialer.util.LocaleTestUtils;
@@ -60,16 +59,17 @@
private PhoneCallDetailsViews mViews;
private TextView mNameView;
private LocaleTestUtils mLocaleTestUtils;
+ private TestPhoneNumberUtilsWrapper mPhoneUtils;
@Override
protected void setUp() throws Exception {
super.setUp();
Context context = getContext();
Resources resources = context.getResources();
- CallTypeHelper callTypeHelper = new CallTypeHelper(resources);
+ mPhoneUtils = new TestPhoneNumberUtilsWrapper(context, TEST_VOICEMAIL_NUMBER);
final TestPhoneNumberUtilsWrapper phoneUtils = new TestPhoneNumberUtilsWrapper(
- TEST_VOICEMAIL_NUMBER);
- mHelper = new PhoneCallDetailsHelper(resources, callTypeHelper, phoneUtils);
+ context, TEST_VOICEMAIL_NUMBER);
+ mHelper = new PhoneCallDetailsHelper(context, resources, phoneUtils);
mHelper.setCurrentTimeForTest(
new GregorianCalendar(2011, 5, 4, 13, 0, 0).getTimeInMillis());
mViews = PhoneCallDetailsViews.createForTest(context);
@@ -311,8 +311,7 @@
mHelper.setPhoneCallDetails(mViews,
new PhoneCallDetails(number, presentation, formattedNumber,
TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION, null, null, 0,
- null, null)
+ new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION)
);
}
@@ -322,8 +321,7 @@
mHelper.setPhoneCallDetails(mViews,
new PhoneCallDetails(number, Calls.PRESENTATION_ALLOWED,
formattedNumber, TEST_COUNTRY_ISO, geocodedLocation,
- new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION, null, null, 0,
- null, null)
+ new int[]{ Calls.VOICEMAIL_TYPE }, TEST_DATE, TEST_DURATION)
);
}
@@ -352,7 +350,7 @@
mHelper.setPhoneCallDetails(mViews,
new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null, null,
+ new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null,
features, null, null)
);
}
@@ -361,8 +359,8 @@
mHelper.setCallDetailsHeader(mNameView,
new PhoneCallDetails(number, presentation,
TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
- new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null, null, 0,
- null, null));
+ new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION, null,
+ 0, null, null));
}
private void setCallDetailsHeader(String name) {
@@ -370,6 +368,6 @@
new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
new int[]{ Calls.INCOMING_TYPE }, TEST_DATE, TEST_DURATION,
- name, 0, "", null, null, 0, null, null, 0, null, null));
+ name, 0, "", null, null, 0, null, 0, null, null));
}
}
diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java
index b7f06d3..9b3e6bc 100644
--- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java
+++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java
@@ -21,6 +21,7 @@
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import android.view.View;
+import android.widget.LinearLayout;
import com.google.common.collect.Lists;
@@ -68,7 +69,7 @@
mCursor = new MatrixCursor(CallLogQuery._PROJECTION);
mCursor.moveToFirst();
// The views into which to store the data.
- mView = new CallLogListItemView(getContext());
+ mView = new LinearLayout(getContext());
mView.setTag(CallLogListItemViews.createForTest(getContext()));
}
diff --git a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
index 85dbf8c..c0347cf 100644
--- a/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
+++ b/tests/src/com/android/dialer/calllog/CallLogListItemHelperTest.java
@@ -60,12 +60,11 @@
super.setUp();
Context context = getContext();
mResources = context.getResources();
- CallTypeHelper callTypeHelper = new CallTypeHelper(mResources);
- final TestPhoneNumberUtilsWrapper phoneUtils = new TestPhoneNumberUtilsWrapper(
- TEST_VOICEMAIL_NUMBER);
- PhoneCallDetailsHelper phoneCallDetailsHelper = new PhoneCallDetailsHelper(
- mResources, callTypeHelper, phoneUtils);
- mPhoneNumberDisplayHelper = new PhoneNumberDisplayHelper(mResources);
+ final TestPhoneNumberUtilsWrapper phoneUtils =
+ new TestPhoneNumberUtilsWrapper(context, TEST_VOICEMAIL_NUMBER);
+ PhoneCallDetailsHelper phoneCallDetailsHelper =
+ new PhoneCallDetailsHelper(context, mResources, phoneUtils);
+ mPhoneNumberDisplayHelper = new PhoneNumberDisplayHelper(context, mResources, phoneUtils);
mHelper = new CallLogListItemHelper(phoneCallDetailsHelper, mPhoneNumberDisplayHelper,
mResources);
mViews = CallLogListItemViews.createForTest(context);
@@ -319,10 +318,9 @@
*/
public void testGetCallDescription_Video() {
PhoneCallDetails details = new PhoneCallDetails(TEST_NUMBER, Calls.PRESENTATION_ALLOWED,
- TEST_FORMATTED_NUMBER,
- TEST_COUNTRY_ISO, TEST_GEOCODE,
+ TEST_FORMATTED_NUMBER, TEST_COUNTRY_ISO, TEST_GEOCODE,
new int[]{Calls.INCOMING_TYPE, Calls.INCOMING_TYPE}, TEST_DATE, TEST_DURATION,
- null, null, Calls.FEATURES_VIDEO, null, null);
+ null, Calls.FEATURES_VIDEO, null, null);
CharSequence description = mHelper.getCallDescription(getContext(), details);
assertTrue(description.toString()
diff --git a/tests/src/com/android/dialer/calllog/TestPhoneNumberUtilsWrapper.java b/tests/src/com/android/dialer/calllog/TestPhoneNumberUtilsWrapper.java
index 7266d88..24916db 100644
--- a/tests/src/com/android/dialer/calllog/TestPhoneNumberUtilsWrapper.java
+++ b/tests/src/com/android/dialer/calllog/TestPhoneNumberUtilsWrapper.java
@@ -16,19 +16,23 @@
package com.android.dialer.calllog;
+import android.content.Context;
+import android.telecom.PhoneAccountHandle;
+
/**
- * Modified version of {@link com.android.dialer.calllog.PhoneNumberDisplayHelper} to be used in tests
- * that allows injecting the voicemail number.
+ * Modified version of {@link com.android.dialer.calllog.PhoneNumberDisplayHelper} to be used in
+ * tests that allows injecting the voicemail number.
*/
public final class TestPhoneNumberUtilsWrapper extends PhoneNumberUtilsWrapper {
private CharSequence mVoicemailNumber;
- public TestPhoneNumberUtilsWrapper(CharSequence voicemailNumber) {
+ public TestPhoneNumberUtilsWrapper(Context context, CharSequence voicemailNumber) {
+ super(context);
mVoicemailNumber = voicemailNumber;
}
@Override
- public boolean isVoicemailNumber(CharSequence number) {
+ public boolean isVoicemailNumber(PhoneAccountHandle accountHandle, CharSequence number) {
return mVoicemailNumber.equals(number);
}
}