From c14610de72a300f05b3a2674f0a459a9fc9204a9 Mon Sep 17 00:00:00 2001 From: roldenburg Date: Tue, 31 Oct 2017 12:51:06 -0700 Subject: Update heads up notification based on video state Refresh heads up notification to show only accept and reject options when incoming Video call is handed over to CS. Author: Suresh Koleti Bug: 63157046 Test: StatusBarNotifierTest PiperOrigin-RevId: 174077146 Change-Id: Ic74d5a201392c6764ee33f1512bf528f86b80f69 --- java/com/android/incallui/StatusBarNotifier.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java index db416d861..0a0aa5e61 100644 --- a/java/com/android/incallui/StatusBarNotifier.java +++ b/java/com/android/incallui/StatusBarNotifier.java @@ -53,6 +53,7 @@ import android.telecom.Call.Details; import android.telecom.CallAudioState; import android.telecom.PhoneAccount; import android.telecom.TelecomManager; +import android.telecom.VideoProfile; import android.text.BidiFormatter; import android.text.Spannable; import android.text.SpannableString; @@ -117,6 +118,7 @@ public class StatusBarNotifier @Nullable private ContactsPreferences mContactsPreferences; private int mCurrentNotification = NOTIFICATION_NONE; private int mCallState = DialerCall.State.INVALID; + private int mVideoState = VideoProfile.STATE_AUDIO_ONLY; private int mSavedIcon = 0; private String mSavedContent = null; private Bitmap mSavedLargeIcon; @@ -312,6 +314,7 @@ public class StatusBarNotifier largeIcon, contentTitle, callState, + call.getVideoState(), notificationType, contactInfo.contactRingtoneUri, callAudioState)) { @@ -474,6 +477,7 @@ public class StatusBarNotifier Bitmap largeIcon, String contentTitle, int state, + int videoState, int notificationType, Uri ringtone, CallAudioState callAudioState) { @@ -485,14 +489,19 @@ public class StatusBarNotifier (contentTitle != null && !contentTitle.equals(mSavedContentTitle)) || (contentTitle == null && mSavedContentTitle != null); - boolean largeIconChanged = - mSavedLargeIcon == null ? largeIcon != null : !mSavedLargeIcon.sameAs(largeIcon); + boolean largeIconChanged; + if (mSavedLargeIcon == null) { + largeIconChanged = largeIcon != null; + } else { + largeIconChanged = largeIcon == null || !mSavedLargeIcon.sameAs(largeIcon); + } // any change means we are definitely updating boolean retval = (mSavedIcon != icon) || !Objects.equals(mSavedContent, content) || (mCallState != state) + || (mVideoState != videoState) || largeIconChanged || contentTitleChanged || !Objects.equals(mRingtone, ringtone) @@ -500,11 +509,12 @@ public class StatusBarNotifier LogUtil.d( "StatusBarNotifier.checkForChangeAndSaveData", - "data changed: icon: %b, content: %b, state: %b, largeIcon: %b, title: %b, ringtone: %b, " - + "audioState: %b, type: %b", + "data changed: icon: %b, content: %b, state: %b, videoState: %b, largeIcon: %b, title: %b," + + "ringtone: %b, audioState: %b, type: %b", (mSavedIcon != icon), !Objects.equals(mSavedContent, content), (mCallState != state), + (mVideoState != videoState), largeIconChanged, contentTitleChanged, !Objects.equals(mRingtone, ringtone), @@ -523,6 +533,7 @@ public class StatusBarNotifier mSavedIcon = icon; mSavedContent = content; mCallState = state; + mVideoState = videoState; mSavedLargeIcon = largeIcon; mSavedContentTitle = contentTitle; mRingtone = ringtone; -- cgit v1.2.3