From 8c47d75d9a128db66faf1e824f628ed5a1a87723 Mon Sep 17 00:00:00 2001 From: yueg Date: Thu, 9 Nov 2017 11:39:10 -0800 Subject: Conferece call management screen UI adjustment. Including: - change action icon color - hide TextView for name if name is empty - if name is empty, use number to generate avatar - don't show number type Bug: 67053842 Test: manual PiperOrigin-RevId: 175188810 Change-Id: I4ba40e5332d7b8567932360d36c8dc6ec3d604a5 --- .../dialer/calllogutils/CallTypeIconsView.java | 8 +++--- .../com/android/dialer/theme/res/values/colors.xml | 4 +-- .../incallui/ConferenceParticipantListAdapter.java | 32 ++++++++-------------- .../incallui/res/layout/caller_in_conference.xml | 16 ++--------- java/com/android/incallui/res/values/colors.xml | 2 -- 5 files changed, 20 insertions(+), 42 deletions(-) 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/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 @@ #CFD8DC - - #89000000 + + #89000000 #FFDF0000 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/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"/> - - - @@ -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"/> + android:tint="@color/icon_color_grey"/> 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 @@ #4d4d4d - #999999 #999999 @@ -34,7 +33,6 @@ These colors are also used by InCallUIMaterialColorMapUtils to generate primary activity colors. - --> #00796B -- cgit v1.2.3 From 3af5c6b002968a44b964d91cdca26056c3aaf8c3 Mon Sep 17 00:00:00 2001 From: zachh Date: Thu, 9 Nov 2017 11:52:13 -0800 Subject: Filter out contacts with null primary display names in search. Bug: 68848807 Test: unit PiperOrigin-RevId: 175190786 Change-Id: I15b525951cb87afb8b48f3bdb2174605c94c99cf --- .../dialer/searchfragment/cp2/ContactFilterCursor.java | 14 +++++++++----- .../searchfragment/cp2/SearchContactsCursorLoader.java | 11 +++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) 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 coalesceContacts(List contactsWithSameContactId) { - String companyName = null; - String nickName = null; + StringBuilder companyName = new StringBuilder(); + StringBuilder nickName = new StringBuilder(); List 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 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,8 +43,19 @@ 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. + * + *

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 (\'" -- cgit v1.2.3 From 9a915fc8a2fdc9e4d4511171b562c4d4e52fafb6 Mon Sep 17 00:00:00 2001 From: linyuh Date: Thu, 9 Nov 2017 16:27:13 -0800 Subject: Stop turning on the screen when the incoming/outgoing call is via Bluetooth. Bug: 38453773 Test: InCallActivityTest PiperOrigin-RevId: 175230358 Change-Id: I2460308e1af554e2198c256fb1f4c62d2b8124b2 --- .../com/android/incallui/InCallActivityCommon.java | 44 ++++++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) 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 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); -- cgit v1.2.3 From 80c8b526a035c7903cf2d2d8fc5196040078c834 Mon Sep 17 00:00:00 2001 From: zachh Date: Thu, 9 Nov 2017 17:33:21 -0800 Subject: Use type TEXT instead of STRING for annotated call log columns. The declared type of "STRING" has an affinity of NUMERIC, not TEXT per: https://sqlite.org/datatype3.html Bug: 34672501 Test: existing PiperOrigin-RevId: 175237916 Change-Id: I220a35f3060eb60870f6e930c821bdb2f6d2c7ed --- .../database/AnnotatedCallLogDatabaseHelper.java | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 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") + ");"; -- cgit v1.2.3