Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 017d2e5d authored by Suresh Koleti's avatar Suresh Koleti Committed by Lalit Kansara
Browse files

IMS: Refresh glowpad and heads up notiifcation for incoming call

-- Refresh glowpad/heads up notification if incoming call type is
   changed before call is connecting.

Change-Id: I8ca2852a548c8b9df2e48132b01ff9a3b46f2c09
CRs-Fixed: 1040592
parent 31974f84
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.incallui;

import android.content.Context;
import android.provider.Settings;
import android.telecom.VideoProfile;
import android.telephony.SubscriptionManager;

import com.android.dialer.compat.UserManagerCompat;
@@ -52,6 +53,9 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi>
    private Call mCall[] = new Call[InCallServiceImpl.sPhoneCount];
    private final CallList mCalls = CallList.getInstance();
    private boolean mHasTextMessages = false;
    // Currently mVideoState is beeing used only for incoming calls.
    // As there is only one incoming call allowed there is no need of array here.
    private int mVideoState = VideoProfile.STATE_AUDIO_ONLY;

    /* QtiImsExtListenerBaseImpl instance to handle call deflection response */
    private QtiImsExtListenerBaseImpl imsInterfaceListener =
@@ -218,6 +222,7 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi>

        Log.d(TAG, "Showing incoming for call id: " + mCallId[phoneId] + " " + this);
        if (showAnswerUi(true)) {
            mVideoState = call.getVideoState();
            final List<String> textMsgs = mCalls.getTextResponses(call.getId());
            configureAnswerTargetsForSms(call, textMsgs);
        }
@@ -290,13 +295,12 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi>
            }

            mHasTextMessages = false;
        } else if (!mHasTextMessages) {
        } else if (!mHasTextMessages || (mVideoState != call.getVideoState())) {
            final List<String> textMsgs = mCalls.getTextResponses(call.getId());
            if (textMsgs != null) {
            mVideoState = call.getVideoState();
            configureAnswerTargetsForSms(call, textMsgs);
        }
    }
    }

    // get active phoneId, for which call is visible to user
    private int getActivePhoneId() {
+8 −4
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import android.os.SystemClock;
import android.telecom.Call.Details;
import android.telecom.PhoneAccount;
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
import android.telephony.TelephonyManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
@@ -94,6 +95,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
    private final DialerRingtoneManager mDialerRingtoneManager;
    private int mCurrentNotification = NOTIFICATION_NONE;
    private int mCallState = Call.State.INVALID;
    private int mVideoState = VideoProfile.STATE_AUDIO_ONLY;
    private int mSavedIcon = 0;
    private String mSavedContent = null;
    private Bitmap mSavedLargeIcon;
@@ -346,7 +348,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
        }

        if (!checkForChangeAndSaveData(iconResId, content, largeIcon, contentTitle, callState,
                notificationType, contactInfo.contactRingtoneUri)) {
                call.getVideoState(), notificationType, contactInfo.contactRingtoneUri)) {
            return;
        }

@@ -485,7 +487,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
     * we do not issue a new notification for the exact same data.
     */
    private boolean checkForChangeAndSaveData(int icon, String content, Bitmap largeIcon,
            String contentTitle, int state, int notificationType, Uri ringtone) {
            String contentTitle, int state, int videoState, int notificationType, Uri ringtone) {

        // The two are different:
        // if new title is not null, it should be different from saved version OR
@@ -496,8 +498,9 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,

        // any change means we are definitely updating
        boolean retval = (mSavedIcon != icon) || !Objects.equals(mSavedContent, content)
                || (mCallState != state) || (mSavedLargeIcon != largeIcon)
                || contentTitleChanged || !Objects.equals(mRingtone, ringtone);
                || (mCallState != state) || (mVideoState != videoState)
                || (mSavedLargeIcon != largeIcon) || contentTitleChanged
                || !Objects.equals(mRingtone, ringtone);

        // If we aren't showing a notification right now or the notification type is changing,
        // definitely do an update.
@@ -511,6 +514,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener,
        mSavedIcon = icon;
        mSavedContent = content;
        mCallState = state;
        mVideoState = videoState;
        mSavedLargeIcon = largeIcon;
        mSavedContentTitle = contentTitle;
        mRingtone = ringtone;