From 96f71f736034d33e4533e2d03321f7e5cd94efa7 Mon Sep 17 00:00:00 2001 From: mdooley Date: Wed, 1 Nov 2017 15:26:50 -0700 Subject: Fixing bug in donation settings in cl/173731907 we added a setting for donating voicemails, but didn't distinguish between when this feature is enabled/disabled by the user or by configuration. this cl fixes that by adding a method to check if the feature is available (ie enabled by config). Bug: 62423454 Test: manual and unit test PiperOrigin-RevId: 174245260 Change-Id: I45a59de7f4a171d759e2fcf86db27a100a84de67 --- .../voicemail/settings/VoicemailSettingsFragment.java | 2 +- java/com/android/voicemail/VoicemailClient.java | 3 +++ java/com/android/voicemail/impl/VoicemailClientImpl.java | 16 ++++++++++++++++ .../impl/transcribe/TranscriptionConfigProvider.java | 4 ++-- java/com/android/voicemail/stub/StubVoicemailClient.java | 5 +++++ 5 files changed, 27 insertions(+), 3 deletions(-) (limited to 'java/com') diff --git a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java index efeed0861..2b496c0ca 100644 --- a/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java +++ b/java/com/android/dialer/voicemail/settings/VoicemailSettingsFragment.java @@ -113,7 +113,7 @@ public class VoicemailSettingsFragment extends PreferenceFragment if (!VoicemailComponent.get(getContext()) .getVoicemailClient() - .isVoicemailDonationEnabled(getContext(), phoneAccountHandle)) { + .isVoicemailDonationAvailable(getContext())) { getPreferenceScreen().removePreference(donateVoicemailSwitchPreference); } diff --git a/java/com/android/voicemail/VoicemailClient.java b/java/com/android/voicemail/VoicemailClient.java index d033369b4..050286a41 100644 --- a/java/com/android/voicemail/VoicemailClient.java +++ b/java/com/android/voicemail/VoicemailClient.java @@ -128,6 +128,9 @@ public interface VoicemailClient { */ boolean isVoicemailTranscriptionAvailable(Context context); + /** @return if the voicemail donation feature is available. */ + boolean isVoicemailDonationAvailable(Context context); + /** @return if the voicemail donation setting has been enabled by the user. */ boolean isVoicemailDonationEnabled(Context context, PhoneAccountHandle account); diff --git a/java/com/android/voicemail/impl/VoicemailClientImpl.java b/java/com/android/voicemail/impl/VoicemailClientImpl.java index 14fa1d80b..2add59ec7 100644 --- a/java/com/android/voicemail/impl/VoicemailClientImpl.java +++ b/java/com/android/voicemail/impl/VoicemailClientImpl.java @@ -135,6 +135,22 @@ public class VoicemailClientImpl implements VoicemailClient { return true; } + @Override + public boolean isVoicemailDonationAvailable(Context context) { + if (!isVoicemailTranscriptionAvailable(context)) { + LogUtil.i("VoicemailClientImpl.isVoicemailDonationAvailable", "transcription not available"); + return false; + } + + TranscriptionConfigProvider provider = new TranscriptionConfigProvider(context); + if (!provider.isVoicemailDonationAvailable()) { + LogUtil.i("VoicemailClientImpl.isVoicemailDonationAvailable", "feature disabled by config"); + return false; + } + + return true; + } + @Override public boolean isVoicemailDonationEnabled(Context context, PhoneAccountHandle account) { return isVoicemailTranscriptionAvailable(context) diff --git a/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java b/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java index 5da450312..f4996a097 100644 --- a/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java +++ b/java/com/android/voicemail/impl/transcribe/TranscriptionConfigProvider.java @@ -75,9 +75,9 @@ public class TranscriptionConfigProvider { .getLong("voicemail_transcription_get_transcript_poll_interval_millis", 1000L); } - public boolean isVoicemailDonationEnabled() { + public boolean isVoicemailDonationAvailable() { return ConfigProviderBindings.get(context) - .getBoolean("voicemail_transcription_donation_enabled", false); + .getBoolean("voicemail_transcription_donation_available", false); } @Override diff --git a/java/com/android/voicemail/stub/StubVoicemailClient.java b/java/com/android/voicemail/stub/StubVoicemailClient.java index 0fe533e62..fe063245f 100644 --- a/java/com/android/voicemail/stub/StubVoicemailClient.java +++ b/java/com/android/voicemail/stub/StubVoicemailClient.java @@ -75,6 +75,11 @@ public final class StubVoicemailClient implements VoicemailClient { return false; } + @Override + public boolean isVoicemailDonationAvailable(Context context) { + return false; + } + @Override public boolean isVoicemailDonationEnabled(Context context, PhoneAccountHandle account) { return false; -- cgit v1.2.3 From 65e19075682f3c0cdaca367138560d80ac4a3106 Mon Sep 17 00:00:00 2001 From: roldenburg Date: Wed, 1 Nov 2017 15:54:00 -0700 Subject: Stop ringtone when user opens "respond via message" option Ringtone should be stopped if user uses the "respond via message" option because user already notices the incoming call and user just feels the ringtone is noisy. Author: Takeshi Tanigawa Bug: 63089671 Test: AnswerFragmentTest PiperOrigin-RevId: 174249368 Change-Id: I2c6353cd662f23c20ac3ce873c38f18e8378b0a9 --- java/com/android/incallui/answer/impl/AnswerFragment.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'java/com') diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java index f0b0c0fde..4362a995d 100644 --- a/java/com/android/incallui/answer/impl/AnswerFragment.java +++ b/java/com/android/incallui/answer/impl/AnswerFragment.java @@ -57,6 +57,7 @@ import com.android.dialer.compat.ActivityCompat; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.multimedia.MultimediaData; +import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.util.ViewUtil; import com.android.incallui.answer.impl.CreateCustomSmsDialogFragment.CreateCustomSmsHolder; import com.android.incallui.answer.impl.SmsBottomSheetFragment.SmsSheetHolder; @@ -985,6 +986,8 @@ public class AnswerFragment extends Fragment secondaryButton.animate().alpha(1); } }); + + TelecomUtil.silenceRinger(getContext()); } @Override -- cgit v1.2.3 From 84ac49babc81c94357706c5073fdb89f27b5fdbd Mon Sep 17 00:00:00 2001 From: yueg Date: Wed, 1 Nov 2017 16:22:28 -0700 Subject: Implement some UI changes. Including: - merge end call button with other buttons - add ripple effect for buttons - adjust elevation according to material design guide - add triangle in expanded view Bug: 67605985 Test: manual PiperOrigin-RevId: 174253861 Change-Id: I7b5315245a322235efb39a9cda26b8686cc7bbf9 --- .../incallui/NewReturnToCallController.java | 7 ++ java/com/android/incallui/res/values/strings.xml | 3 + java/com/android/newbubble/NewBubble.java | 49 ++++----- java/com/android/newbubble/NewBubbleInfo.java | 4 +- java/com/android/newbubble/NewCheckableButton.java | 9 +- .../newbubble/res/drawable/bubble_pill_down.xml | 23 +++++ .../res/drawable/bubble_ripple_circle.xml | 26 ----- .../newbubble/res/drawable/bubble_shape_circle.xml | 25 +++++ .../res/drawable/bubble_shape_circle_small.xml | 23 +++++ .../newbubble/res/layout/new_bubble_base.xml | 112 ++++++++++----------- java/com/android/newbubble/res/values/colors.xml | 7 +- java/com/android/newbubble/res/values/styles.xml | 38 +++++++ java/com/android/newbubble/res/values/values.xml | 14 ++- 13 files changed, 209 insertions(+), 131 deletions(-) create mode 100644 java/com/android/newbubble/res/drawable/bubble_pill_down.xml delete mode 100644 java/com/android/newbubble/res/drawable/bubble_ripple_circle.xml create mode 100644 java/com/android/newbubble/res/drawable/bubble_shape_circle.xml create mode 100644 java/com/android/newbubble/res/drawable/bubble_shape_circle_small.xml create mode 100644 java/com/android/newbubble/res/values/styles.xml (limited to 'java/com') diff --git a/java/com/android/incallui/NewReturnToCallController.java b/java/com/android/incallui/NewReturnToCallController.java index fa7a45de0..97bf7ad50 100644 --- a/java/com/android/incallui/NewReturnToCallController.java +++ b/java/com/android/incallui/NewReturnToCallController.java @@ -277,17 +277,22 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au List actions = new ArrayList<>(); SpeakerButtonInfo speakerButtonInfo = new SpeakerButtonInfo(audioState, IconSize.SIZE_24_DP); + // Return to call actions.add( Action.builder() .setIconDrawable(context.getDrawable(R.drawable.quantum_ic_fullscreen_vd_theme_24)) .setIntent(fullScreen) + .setName(context.getText(R.string.bubble_return_to_call)) .build()); + // Mute/unmute actions.add( Action.builder() .setIconDrawable(context.getDrawable(R.drawable.quantum_ic_mic_off_white_24)) .setChecked(audioState.isMuted()) .setIntent(toggleMute) + .setName(context.getText(R.string.incall_label_mute)) .build()); + // Speaker/audio selector actions.add( Action.builder() .setIconDrawable(context.getDrawable(speakerButtonInfo.icon)) @@ -295,10 +300,12 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au .setChecked(speakerButtonInfo.isChecked) .setIntent(speakerButtonInfo.checkable ? toggleSpeaker : showSpeakerSelect) .build()); + // End call actions.add( Action.builder() .setIconDrawable(context.getDrawable(R.drawable.quantum_ic_call_end_vd_theme_24)) .setIntent(endCall) + .setName(context.getText(R.string.incall_label_end_call)) .build()); return actions; } diff --git a/java/com/android/incallui/res/values/strings.xml b/java/com/android/incallui/res/values/strings.xml index 2f1542a08..af6125366 100644 --- a/java/com/android/incallui/res/values/strings.xml +++ b/java/com/android/incallui/res/values/strings.xml @@ -202,4 +202,7 @@ Do not show this again + + Back to call + diff --git a/java/com/android/newbubble/NewBubble.java b/java/com/android/newbubble/NewBubble.java index 226326f3c..fb6a5e458 100644 --- a/java/com/android/newbubble/NewBubble.java +++ b/java/com/android/newbubble/NewBubble.java @@ -26,17 +26,14 @@ import android.content.Intent; import android.graphics.PixelFormat; import android.graphics.drawable.Animatable; import android.graphics.drawable.Drawable; -import android.graphics.drawable.RippleDrawable; import android.net.Uri; import android.os.Handler; import android.provider.Settings; -import android.support.annotation.ColorInt; import android.support.annotation.IntDef; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; import android.support.v4.graphics.ColorUtils; -import android.support.v4.graphics.drawable.DrawableCompat; import android.support.v4.os.BuildCompat; import android.support.v4.view.animation.FastOutLinearInInterpolator; import android.support.v4.view.animation.LinearOutSlowInInterpolator; @@ -556,26 +553,22 @@ public class NewBubble { private void update() { // Whole primary button background - RippleDrawable backgroundRipple = - (RippleDrawable) - context.getResources().getDrawable(R.drawable.bubble_ripple_circle, context.getTheme()); + Drawable backgroundCirle = + context.getResources().getDrawable(R.drawable.bubble_shape_circle, context.getTheme()); int primaryTint = ColorUtils.compositeColors( context.getColor(R.color.bubble_primary_background_darken), currentInfo.getPrimaryColor()); - backgroundRipple.getDrawable(0).mutate().setTint(primaryTint); - viewHolder.getPrimaryButton().setBackground(backgroundRipple); + backgroundCirle.mutate().setTint(primaryTint); + viewHolder.getPrimaryButton().setBackground(backgroundCirle); // Small icon - RippleDrawable smallIconBackgroundRipple = - (RippleDrawable) - context - .getResources() - .getDrawable(R.drawable.bubble_ripple_circle_small, context.getTheme()); - smallIconBackgroundRipple - .getDrawable(0) - .setTint(context.getColor(R.color.bubble_button_text_color_blue)); - viewHolder.getPrimaryIcon().setBackground(smallIconBackgroundRipple); + Drawable smallIconBackgroundCircle = + context + .getResources() + .getDrawable(R.drawable.bubble_shape_circle_small, context.getTheme()); + smallIconBackgroundCircle.setTint(context.getColor(R.color.bubble_button_color_blue)); + viewHolder.getPrimaryIcon().setBackground(smallIconBackgroundCircle); viewHolder.getPrimaryIcon().setImageIcon(currentInfo.getPrimaryIcon()); viewHolder.getPrimaryAvatar().setImageDrawable(currentInfo.getAvatar()); @@ -595,13 +588,10 @@ public class NewBubble { } private void updateButtonStates() { - int colorBlue = context.getColor(R.color.bubble_button_text_color_blue); - int colorWhite = context.getColor(R.color.bubble_button_text_color_white); - - configureButton(currentInfo.getActions().get(0), viewHolder.getFullScreenButton(), colorBlue); - configureButton(currentInfo.getActions().get(1), viewHolder.getMuteButton(), colorBlue); - configureButton(currentInfo.getActions().get(2), viewHolder.getAudioRouteButton(), colorBlue); - configureButton(currentInfo.getActions().get(3), viewHolder.getEndCallButton(), colorWhite); + configureButton(currentInfo.getActions().get(0), viewHolder.getFullScreenButton()); + configureButton(currentInfo.getActions().get(1), viewHolder.getMuteButton()); + configureButton(currentInfo.getActions().get(2), viewHolder.getAudioRouteButton()); + configureButton(currentInfo.getActions().get(3), viewHolder.getEndCallButton()); } private void doShowText(@NonNull CharSequence text) { @@ -610,16 +600,11 @@ public class NewBubble { viewHolder.getPrimaryButton().setDisplayedChild(ViewHolder.CHILD_INDEX_TEXT); } - private void configureButton(Action action, NewCheckableButton button, @ColorInt int iconColor) { - Drawable iconDrawable = DrawableCompat.wrap(action.getIconDrawable()); - DrawableCompat.setTint(iconDrawable.mutate(), iconColor); - - button.setCompoundDrawablesWithIntrinsicBounds(iconDrawable, null, null, null); + private void configureButton(Action action, NewCheckableButton button) { + button.setCompoundDrawablesWithIntrinsicBounds(action.getIconDrawable(), null, null, null); button.setChecked(action.isChecked()); button.setEnabled(action.isEnabled()); - if (action.getName() != null) { - button.setText(action.getName()); - } + button.setText(action.getName()); button.setOnClickListener(v -> doAction(action)); } diff --git a/java/com/android/newbubble/NewBubbleInfo.java b/java/com/android/newbubble/NewBubbleInfo.java index 44232f39b..126b300ed 100644 --- a/java/com/android/newbubble/NewBubbleInfo.java +++ b/java/com/android/newbubble/NewBubbleInfo.java @@ -79,7 +79,7 @@ public abstract class NewBubbleInfo { public abstract Drawable getIconDrawable(); - @Nullable + @NonNull public abstract CharSequence getName(); @NonNull @@ -108,7 +108,7 @@ public abstract class NewBubbleInfo { public abstract Builder setIconDrawable(Drawable iconDrawable); - public abstract Builder setName(@Nullable CharSequence name); + public abstract Builder setName(@NonNull CharSequence name); public abstract Builder setIntent(@NonNull PendingIntent intent); diff --git a/java/com/android/newbubble/NewCheckableButton.java b/java/com/android/newbubble/NewCheckableButton.java index 63525a4a1..8e43335ca 100644 --- a/java/com/android/newbubble/NewCheckableButton.java +++ b/java/com/android/newbubble/NewCheckableButton.java @@ -17,6 +17,7 @@ package com.android.newbubble; import android.content.Context; +import android.content.res.ColorStateList; import android.support.v4.view.AccessibilityDelegateCompat; import android.support.v4.view.ViewCompat; import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; @@ -68,10 +69,12 @@ public class NewCheckableButton extends AppCompatButton implements Checkable { public void setChecked(boolean checked) { if (mChecked != checked) { mChecked = checked; - setTextColor( + int newColor = checked - ? getContext().getColor(R.color.bubble_button_text_color_blue) - : getContext().getColor(R.color.bubble_button_text_color_black)); + ? getContext().getColor(R.color.bubble_button_color_blue) + : getContext().getColor(R.color.bubble_button_color_grey); + setTextColor(newColor); + setCompoundDrawableTintList(ColorStateList.valueOf(newColor)); } } diff --git a/java/com/android/newbubble/res/drawable/bubble_pill_down.xml b/java/com/android/newbubble/res/drawable/bubble_pill_down.xml new file mode 100644 index 000000000..721e6fc52 --- /dev/null +++ b/java/com/android/newbubble/res/drawable/bubble_pill_down.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/java/com/android/newbubble/res/drawable/bubble_ripple_circle.xml b/java/com/android/newbubble/res/drawable/bubble_ripple_circle.xml deleted file mode 100644 index 8d5cf0bb5..000000000 --- a/java/com/android/newbubble/res/drawable/bubble_ripple_circle.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - diff --git a/java/com/android/newbubble/res/drawable/bubble_shape_circle.xml b/java/com/android/newbubble/res/drawable/bubble_shape_circle.xml new file mode 100644 index 000000000..af9d8589b --- /dev/null +++ b/java/com/android/newbubble/res/drawable/bubble_shape_circle.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/java/com/android/newbubble/res/drawable/bubble_shape_circle_small.xml b/java/com/android/newbubble/res/drawable/bubble_shape_circle_small.xml new file mode 100644 index 000000000..73b9cf338 --- /dev/null +++ b/java/com/android/newbubble/res/drawable/bubble_shape_circle_small.xml @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/java/com/android/newbubble/res/layout/new_bubble_base.xml b/java/com/android/newbubble/res/layout/new_bubble_base.xml index 9174f3fdb..c90cabdf2 100644 --- a/java/com/android/newbubble/res/layout/new_bubble_base.xml +++ b/java/com/android/newbubble/res/layout/new_bubble_base.xml @@ -19,6 +19,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:clipChildren="false" tools:theme="@style/Theme.AppCompat"> + android:clipToPadding="false"> @@ -72,80 +77,67 @@ + + + android:layout_marginTop="@dimen/bubble_radius" + android:textColor="@color/bubble_button_color_grey" + android:background="@color/background_dialer_white" + android:drawableTint="@color/bubble_button_color_grey" + style="@style/CheckableButtonWithSelectableItemBackground"/> + android:layout_marginTop="@dimen/bubble_expanded_separator_height" + android:textColor="@color/bubble_button_color_grey" + android:background="@color/background_dialer_white" + android:drawableTint="@color/bubble_button_color_grey" + style="@style/CheckableButtonWithSelectableItemBackground"/> - - + android:layout_marginTop="@dimen/bubble_expanded_separator_height" + android:textColor="@color/bubble_button_color_grey" + android:background="@color/background_dialer_white" + android:drawableTint="@color/bubble_button_color_grey" + style="@style/CheckableButtonWithSelectableItemBackground"/> + android:layout_below="@id/bubble_button_audio_route" + android:layout_marginTop="@dimen/bubble_expanded_separator_height" + android:textColor="@color/bubble_button_color_white" + android:background="@drawable/bubble_pill_down" + android:backgroundTint="@color/dialer_end_call_button_color" + android:foreground="?attr/selectableItemBackground" + android:drawableTint="@color/bubble_button_color_white" + style="@style/CheckableButton"/> diff --git a/java/com/android/newbubble/res/values/colors.xml b/java/com/android/newbubble/res/values/colors.xml index 556d8bd95..8b1294fc6 100644 --- a/java/com/android/newbubble/res/values/colors.xml +++ b/java/com/android/newbubble/res/values/colors.xml @@ -18,8 +18,7 @@ #33000000 - @color/dialer_primary_text_color - @color/dialer_primary_text_color_white - @color/dialer_theme_color - @color/dialer_end_call_button_color + @color/dialer_secondary_text_color + @color/dialer_primary_text_color_white + @color/dialer_theme_color diff --git a/java/com/android/newbubble/res/values/styles.xml b/java/com/android/newbubble/res/values/styles.xml new file mode 100644 index 000000000..274bd8704 --- /dev/null +++ b/java/com/android/newbubble/res/values/styles.xml @@ -0,0 +1,38 @@ + + + + + + + + + \ No newline at end of file diff --git a/java/com/android/newbubble/res/values/values.xml b/java/com/android/newbubble/res/values/values.xml index 381b0079e..d8cd08f87 100644 --- a/java/com/android/newbubble/res/values/values.xml +++ b/java/com/android/newbubble/res/values/values.xml @@ -18,17 +18,23 @@ 56dp 16dp - 4dp + 6dp + 36dp 16dp - -4dp + 12dp + 16dp + -16dp 64dp 16dp + -16dp 12dp + 24dp - 10dp + 6dp + 8dp 160dp - 20dp + 12dp 4dp 24dp 4dp -- cgit v1.2.3 From 711512175cb047b5ea7c9b15013f3b1fc5c2cae7 Mon Sep 17 00:00:00 2001 From: zachh Date: Wed, 1 Nov 2017 16:57:30 -0700 Subject: Fixed AOSP breakage due to incompatible guava api. Test: none PiperOrigin-RevId: 174258291 Change-Id: Idf4eb0096fef383bd5f3544fdedba03528d14f41 --- .../dialer/phonelookup/composite/CompositePhoneLookup.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'java/com') diff --git a/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java b/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java index a9416266c..10b0e24d2 100644 --- a/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java +++ b/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java @@ -21,6 +21,7 @@ import android.telecom.Call; import com.android.dialer.DialerPhoneNumber; import com.android.dialer.phonelookup.PhoneLookup; import com.android.dialer.phonelookup.PhoneLookupInfo; +import com.google.common.base.Function; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -56,12 +57,15 @@ public final class CompositePhoneLookup implements PhoneLookup { } return Futures.transform( Futures.allAsList(futures), - infos -> { - PhoneLookupInfo.Builder mergedInfo = PhoneLookupInfo.newBuilder(); - for (PhoneLookupInfo info : infos) { - mergedInfo.mergeFrom(info); + new Function, PhoneLookupInfo>() { + @Override + public PhoneLookupInfo apply(List infos) { + PhoneLookupInfo.Builder mergedInfo = PhoneLookupInfo.newBuilder(); + for (PhoneLookupInfo info : infos) { + mergedInfo.mergeFrom(info); + } + return mergedInfo.build(); } - return mergedInfo.build(); }, MoreExecutors.directExecutor()); } -- cgit v1.2.3