diff options
9 files changed, 86 insertions, 65 deletions
diff --git a/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java b/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java index 9fd5bd970..3062710d4 100644 --- a/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java +++ b/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java @@ -38,26 +38,26 @@ class AnnotatedCallLogDatabaseHelper extends SQLiteOpenHelper { + " (" + (AnnotatedCallLog._ID + " integer primary key, ") + (AnnotatedCallLog.TIMESTAMP + " integer, ") - + (AnnotatedCallLog.NAME + " string, ") + + (AnnotatedCallLog.NAME + " text, ") + (AnnotatedCallLog.NUMBER + " blob, ") - + (AnnotatedCallLog.FORMATTED_NUMBER + " string, ") - + (AnnotatedCallLog.PHOTO_URI + " string, ") + + (AnnotatedCallLog.FORMATTED_NUMBER + " text, ") + + (AnnotatedCallLog.PHOTO_URI + " text, ") + (AnnotatedCallLog.PHOTO_ID + " integer, ") - + (AnnotatedCallLog.LOOKUP_URI + " string, ") + + (AnnotatedCallLog.LOOKUP_URI + " text, ") + (AnnotatedCallLog.DURATION + " integer, ") - + (AnnotatedCallLog.NUMBER_TYPE_LABEL + " string, ") + + (AnnotatedCallLog.NUMBER_TYPE_LABEL + " text, ") + (AnnotatedCallLog.IS_READ + " integer, ") + (AnnotatedCallLog.NEW + " integer, ") - + (AnnotatedCallLog.GEOCODED_LOCATION + " string, ") - + (AnnotatedCallLog.PHONE_ACCOUNT_COMPONENT_NAME + " string, ") - + (AnnotatedCallLog.PHONE_ACCOUNT_ID + " string, ") - + (AnnotatedCallLog.PHONE_ACCOUNT_LABEL + " string, ") + + (AnnotatedCallLog.GEOCODED_LOCATION + " text, ") + + (AnnotatedCallLog.PHONE_ACCOUNT_COMPONENT_NAME + " text, ") + + (AnnotatedCallLog.PHONE_ACCOUNT_ID + " text, ") + + (AnnotatedCallLog.PHONE_ACCOUNT_LABEL + " text, ") + (AnnotatedCallLog.PHONE_ACCOUNT_COLOR + " integer, ") + (AnnotatedCallLog.FEATURES + " integer, ") + (AnnotatedCallLog.IS_BUSINESS + " integer, ") + (AnnotatedCallLog.IS_VOICEMAIL + " integer, ") + (AnnotatedCallLog.TRANSCRIPTION + " integer, ") - + (AnnotatedCallLog.VOICEMAIL_URI + " string, ") + + (AnnotatedCallLog.VOICEMAIL_URI + " text, ") + (AnnotatedCallLog.CALL_TYPE + " integer") + ");"; diff --git a/java/com/android/dialer/calllogutils/CallTypeIconsView.java b/java/com/android/dialer/calllogutils/CallTypeIconsView.java index bf33faa33..0c28a9728 100644 --- a/java/com/android/dialer/calllogutils/CallTypeIconsView.java +++ b/java/com/android/dialer/calllogutils/CallTypeIconsView.java @@ -268,7 +268,7 @@ public class CallTypeIconsView extends View { iconId = R.drawable.quantum_ic_voicemail_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); voicemail = drawable.mutate(); - voicemail.setColorFilter(r.getColor(R.color.call_type_icon_color), PorterDuff.Mode.MULTIPLY); + voicemail.setColorFilter(r.getColor(R.color.icon_color_grey), PorterDuff.Mode.MULTIPLY); iconId = R.drawable.quantum_ic_block_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); @@ -278,17 +278,17 @@ public class CallTypeIconsView extends View { iconId = R.drawable.quantum_ic_videocam_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); videoCall = drawable.mutate(); - videoCall.setColorFilter(r.getColor(R.color.call_type_icon_color), PorterDuff.Mode.MULTIPLY); + videoCall.setColorFilter(r.getColor(R.color.icon_color_grey), PorterDuff.Mode.MULTIPLY); iconId = R.drawable.quantum_ic_hd_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); hdCall = drawable.mutate(); - hdCall.setColorFilter(r.getColor(R.color.call_type_icon_color), PorterDuff.Mode.MULTIPLY); + hdCall.setColorFilter(r.getColor(R.color.icon_color_grey), PorterDuff.Mode.MULTIPLY); iconId = R.drawable.quantum_ic_signal_wifi_4_bar_white_24; drawable = largeIcons ? r.getDrawable(iconId) : getScaledBitmap(context, iconId); wifiCall = drawable.mutate(); - wifiCall.setColorFilter(r.getColor(R.color.call_type_icon_color), PorterDuff.Mode.MULTIPLY); + wifiCall.setColorFilter(r.getColor(R.color.icon_color_grey), PorterDuff.Mode.MULTIPLY); iconMargin = largeIcons ? 0 : r.getDimensionPixelSize(R.dimen.call_log_icon_margin); } diff --git a/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java b/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java index df67b762f..166902b2b 100644 --- a/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java +++ b/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java @@ -132,8 +132,8 @@ final class ContactFilterCursor implements Cursor { } private static List<Cp2Contact> coalesceContacts(List<Cp2Contact> contactsWithSameContactId) { - String companyName = null; - String nickName = null; + StringBuilder companyName = new StringBuilder(); + StringBuilder nickName = new StringBuilder(); List<Cp2Contact> phoneContacts = new ArrayList<>(); for (Cp2Contact contact : contactsWithSameContactId) { if (contact.mimeType().equals(Phone.CONTENT_ITEM_TYPE)) { @@ -141,11 +141,11 @@ final class ContactFilterCursor implements Cursor { } else if (contact.mimeType().equals(Organization.CONTENT_ITEM_TYPE)) { // Since a contact can have more than one company name but they aren't visible to the user // in our search UI, we can lazily concatenate them together to make them all searchable. - companyName += " " + contact.companyName(); + companyName.append(" ").append(contact.companyName()); } else if (contact.mimeType().equals(Nickname.CONTENT_ITEM_TYPE)) { // Since a contact can have more than one nickname but they aren't visible to the user // in our search UI, we can lazily concatenate them together to make them all searchable. - nickName += " " + contact.nickName(); + nickName.append(" ").append(contact.nickName()); } } @@ -154,7 +154,11 @@ final class ContactFilterCursor implements Cursor { List<Cp2Contact> coalescedContacts = new ArrayList<>(); for (Cp2Contact phoneContact : phoneContacts) { coalescedContacts.add( - phoneContact.toBuilder().setCompanyName(companyName).setNickName(nickName).build()); + phoneContact + .toBuilder() + .setCompanyName(companyName.length() == 0 ? null : companyName.toString()) + .setNickName(nickName.length() == 0 ? null : nickName.toString()) + .build()); } return coalescedContacts; } diff --git a/java/com/android/dialer/searchfragment/cp2/SearchContactsCursorLoader.java b/java/com/android/dialer/searchfragment/cp2/SearchContactsCursorLoader.java index 35518019e..2b7af1131 100644 --- a/java/com/android/dialer/searchfragment/cp2/SearchContactsCursorLoader.java +++ b/java/com/android/dialer/searchfragment/cp2/SearchContactsCursorLoader.java @@ -43,9 +43,20 @@ public final class SearchContactsCursorLoader extends CursorLoader { this.query = query; } + /** + * Note: ContactsProvider can make no guarantee that any given field is non-null, and display name + * has been observed to be null in the wild, though it is unclear when that might happen (possibly + * a third-party is inserting such data). See a bug. + * + * <p>We skip showing contacts without a display name because there is no UI treatment for showing + * such results. (Note that even contacts with only a number still have a display name set to the + * number.) + */ private static String whereStatement() { return (Phone.NUMBER + " IS NOT NULL") + " AND " + + (Data.DISPLAY_NAME_PRIMARY + " IS NOT NULL") + + " AND " + Data.MIMETYPE + " IN (\'" + Phone.CONTENT_ITEM_TYPE diff --git a/java/com/android/dialer/theme/res/values/colors.xml b/java/com/android/dialer/theme/res/values/colors.xml index f44a7ccc6..a59fa6704 100644 --- a/java/com/android/dialer/theme/res/values/colors.xml +++ b/java/com/android/dialer/theme/res/values/colors.xml @@ -68,8 +68,8 @@ <color name="blue_grey_100">#CFD8DC</color> - <!-- Color of call type icons in call log, e.g. voicemail, video, WiFi, HD etc. --> - <color name="call_type_icon_color">#89000000</color> + <!-- 54% opacity --> + <color name="icon_color_grey">#89000000</color> <!-- Color for bubble --> <color name="dialer_end_call_button_color">#FFDF0000</color> diff --git a/java/com/android/incallui/ConferenceParticipantListAdapter.java b/java/com/android/incallui/ConferenceParticipantListAdapter.java index d0f488501..66b6a97c1 100644 --- a/java/com/android/incallui/ConferenceParticipantListAdapter.java +++ b/java/com/android/incallui/ConferenceParticipantListAdapter.java @@ -242,7 +242,6 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { contactCache.namePrimary, call.updateNameIfRestricted(name), contactCache.number, - contactCache.label, contactCache.lookupKey, contactCache.displayPhotoUri, thisRowCanSeparate, @@ -277,7 +276,6 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { * @param view The view to set the details on. * @param callerName The participant's name. * @param callerNumber The participant's phone number. - * @param callerNumberType The participant's phone number typ.e * @param lookupKey The lookup key for the participant (for photo lookup). * @param photoUri The URI of the contact photo. * @param thisRowCanSeparate {@code True} if this participant can separate from the conference. @@ -288,7 +286,6 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { String callerName, String preferredName, String callerNumber, - String callerNumberType, String lookupKey, Uri photoUri, boolean thisRowCanSeparate, @@ -299,16 +296,13 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { final TextView statusTextView = (TextView) view.findViewById(R.id.conferenceCallerStatus); final TextView nameTextView = (TextView) view.findViewById(R.id.conferenceCallerName); final TextView numberTextView = (TextView) view.findViewById(R.id.conferenceCallerNumber); - final TextView numberTypeTextView = - (TextView) view.findViewById(R.id.conferenceCallerNumberType); final View endButton = view.findViewById(R.id.conferenceCallerDisconnect); final View separateButton = view.findViewById(R.id.conferenceCallerSeparate); if (callState == DialerCall.State.ONHOLD) { - setViewsOnHold(photoView, statusTextView, nameTextView, numberTextView, numberTypeTextView); + setViewsOnHold(photoView, statusTextView, nameTextView, numberTextView); } else { - setViewsNotOnHold( - photoView, statusTextView, nameTextView, numberTextView, numberTypeTextView); + setViewsNotOnHold(photoView, statusTextView, nameTextView, numberTextView); } endButton.setVisibility(thisRowCanDisconnect ? View.VISIBLE : View.GONE); @@ -325,27 +319,30 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { separateButton.setOnClickListener(null); } + String displayNameForImage = TextUtils.isEmpty(callerName) ? callerNumber : callerName; DefaultImageRequest imageRequest = (photoUri != null) ? null - : new DefaultImageRequest(callerName, lookupKey, true /* isCircularPhoto */); + : new DefaultImageRequest(displayNameForImage, lookupKey, true /* isCircularPhoto */); mContactPhotoManager.loadDirectoryPhoto(photoView, photoUri, false, true, imageRequest); // set the caller name - nameTextView.setText(preferredName); + if (TextUtils.isEmpty(preferredName)) { + nameTextView.setVisibility(View.GONE); + } else { + nameTextView.setVisibility(View.VISIBLE); + nameTextView.setText(preferredName); + } // set the caller number in subscript, or make the field disappear. if (TextUtils.isEmpty(callerNumber)) { numberTextView.setVisibility(View.GONE); - numberTypeTextView.setVisibility(View.GONE); } else { numberTextView.setVisibility(View.VISIBLE); numberTextView.setText( PhoneNumberUtilsCompat.createTtsSpannable( BidiFormatter.getInstance().unicodeWrap(callerNumber, TextDirectionHeuristics.LTR))); - numberTypeTextView.setVisibility(View.VISIBLE); - numberTypeTextView.setText(callerNumberType); } } @@ -353,8 +350,7 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { ImageView photoView, TextView statusTextView, TextView nameTextView, - TextView numberTextView, - TextView numberTypeTextView) { + TextView numberTextView) { CharSequence onHoldText = TextUtils.concat(getContext().getText(R.string.notification_on_hold).toString(), " • "); statusTextView.setText(onHoldText); @@ -363,7 +359,6 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { int onHoldColor = getContext().getColor(R.color.dialer_secondary_text_color_hiden); nameTextView.setTextColor(onHoldColor); numberTextView.setTextColor(onHoldColor); - numberTypeTextView.setTextColor(onHoldColor); TypedValue alpha = new TypedValue(); getContext().getResources().getValue(R.dimen.alpha_hiden, alpha, true); @@ -374,16 +369,13 @@ public class ConferenceParticipantListAdapter extends BaseAdapter { ImageView photoView, TextView statusTextView, TextView nameTextView, - TextView numberTextView, - TextView numberTypeTextView) { + TextView numberTextView) { statusTextView.setVisibility(View.GONE); nameTextView.setTextColor( getContext().getColor(R.color.conference_call_manager_caller_name_text_color)); numberTextView.setTextColor( getContext().getColor(R.color.conference_call_manager_secondary_text_color)); - numberTypeTextView.setTextColor( - getContext().getColor(R.color.conference_call_manager_secondary_text_color)); TypedValue alpha = new TypedValue(); getContext().getResources().getValue(R.dimen.alpha_enabled, alpha, true); diff --git a/java/com/android/incallui/InCallActivityCommon.java b/java/com/android/incallui/InCallActivityCommon.java index a9702b447..5a5d770d0 100644 --- a/java/com/android/incallui/InCallActivityCommon.java +++ b/java/com/android/incallui/InCallActivityCommon.java @@ -33,10 +33,12 @@ import android.os.Trace; import android.support.annotation.IntDef; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.annotation.VisibleForTesting; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v4.content.res.ResourcesCompat; +import android.telecom.CallAudioState; import android.telecom.PhoneAccountHandle; import android.view.KeyEvent; import android.view.View; @@ -65,6 +67,7 @@ import com.android.incallui.disconnectdialog.DisconnectMessage; import com.android.incallui.incalluilock.InCallUiLock; import com.android.incallui.telecomeventui.InternationalCallOnWifiDialogFragment; import com.android.incallui.telecomeventui.InternationalCallOnWifiDialogFragment.Callback; +import com.google.common.base.Optional; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; @@ -96,6 +99,8 @@ public class InCallActivityCommon { private static final int DIALPAD_REQUEST_SHOW = 2; private static final int DIALPAD_REQUEST_HIDE = 3; + private static Optional<Integer> audioRouteForTesting = Optional.absent(); + private final InCallActivity inCallActivity; private boolean dismissKeyguard; private boolean showPostCharWaitDialogOnResume; @@ -171,14 +176,7 @@ public class InCallActivityCommon { } public void onCreate(Bundle icicle) { - // set this flag so this activity will stay in front of the keyguard - // Have the WindowManager filter out touch events that are "too fat". - int flags = - WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED - | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON - | WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES; - - inCallActivity.getWindow().addFlags(flags); + setWindowFlags(); inCallActivity.setContentView(R.layout.incall_screen); @@ -483,6 +481,36 @@ public class InCallActivityCommon { return event.getRepeatCount() == 0 && handleDialerKeyDown(keyCode, event); } + private void setWindowFlags() { + // Allow the activity to be shown when the screen is locked and filter out touch events that are + // "too fat". + int flags = + WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED + | WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES; + + // When the audio stream is not directed through Bluetooth, turn the screen on once the + // activity is shown. + final int audioRoute = getAudioRoute(); + if (audioRoute != CallAudioState.ROUTE_BLUETOOTH) { + flags |= WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON; + } + + inCallActivity.getWindow().addFlags(flags); + } + + private static int getAudioRoute() { + if (audioRouteForTesting.isPresent()) { + return audioRouteForTesting.get(); + } + + return AudioModeProvider.getInstance().getAudioState().getRoute(); + } + + @VisibleForTesting(otherwise = VisibleForTesting.NONE) + public static void setAudioRouteForTesting(int audioRoute) { + audioRouteForTesting = Optional.of(audioRoute); + } + private boolean handleDialerKeyDown(int keyCode, KeyEvent event) { LogUtil.v("InCallActivityCommon.handleDialerKeyDown", "keyCode %d, event: %s", keyCode, event); diff --git a/java/com/android/incallui/res/layout/caller_in_conference.xml b/java/com/android/incallui/res/layout/caller_in_conference.xml index 37918188f..be4eca5f6 100644 --- a/java/com/android/incallui/res/layout/caller_in_conference.xml +++ b/java/com/android/incallui/res/layout/caller_in_conference.xml @@ -82,18 +82,6 @@ android:textColor="@color/conference_call_manager_secondary_text_color" android:textSize="14sp"/> - <!-- Number type --> - <TextView - android:id="@+id/conferenceCallerNumberType" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="marquee" - android:gravity="start" - android:singleLine="true" - android:textAllCaps="true" - android:textColor="@color/conference_call_manager_secondary_text_color" - android:textSize="12sp"/> - </LinearLayout> <!-- End of caller number --> </LinearLayout> <!-- End of caller information --> @@ -110,7 +98,7 @@ android:contentDescription="@string/goPrivate" android:scaleType="center" android:src="@drawable/ic_call_split_white_24dp" - android:tint="@color/conference_call_manager_icon_color"/> + android:tint="@color/icon_color_grey"/> <!-- "Disconnect" button which terminates the connection with this caller. --> <ImageButton @@ -123,6 +111,6 @@ android:contentDescription="@string/conference_caller_disconnect_content_description" android:scaleType="center" android:src="@drawable/quantum_ic_call_end_white_24" - android:tint="@color/conference_call_manager_icon_color"/> + android:tint="@color/icon_color_grey"/> </LinearLayout> <!-- End of single list element --> diff --git a/java/com/android/incallui/res/values/colors.xml b/java/com/android/incallui/res/values/colors.xml index 4bded7855..32da57b84 100644 --- a/java/com/android/incallui/res/values/colors.xml +++ b/java/com/android/incallui/res/values/colors.xml @@ -17,7 +17,6 @@ <resources> <color name="conference_call_manager_caller_name_text_color">#4d4d4d</color> - <color name="conference_call_manager_icon_color">#999999</color> <!-- Used with some smaller texts in manage conference screen. --> <color name="conference_call_manager_secondary_text_color">#999999</color> @@ -34,7 +33,6 @@ These colors are also used by InCallUIMaterialColorMapUtils to generate primary activity colors. - --> <array name="background_colors"> <item>#00796B</item> |