From 9b3019d004f2e551e4fd69001a95883522caf523 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Tue, 6 Oct 2015 13:05:17 -0700 Subject: Handle child number changes after the call starts. The child number display functionality assumed that the child number for a call would only bet set at the start of the call. This change removes that assumption and supports changes to the child number at any point during the call by adding a new listener to the InCall Call List. It appears there are some instances in reality where the child number can come in after the start of a call (delayed only slightly, but enough to prevent the number from showing up). Bug: 24585039 Change-Id: I23148e8c4265f1bc16ce563f2919e9b3eb71784f --- .../src/com/android/incallui/AnswerPresenter.java | 5 +++++ InCallUI/src/com/android/incallui/Call.java | 5 +++-- .../src/com/android/incallui/CallCardPresenter.java | 13 +++++++++++++ InCallUI/src/com/android/incallui/CallList.java | 20 ++++++++++++++++++++ .../src/com/android/incallui/StatusBarNotifier.java | 5 +++++ 5 files changed, 46 insertions(+), 2 deletions(-) (limited to 'InCallUI') diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java index fc75bf030..97f60c05f 100644 --- a/InCallUI/src/com/android/incallui/AnswerPresenter.java +++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java @@ -113,6 +113,11 @@ public class AnswerPresenter extends Presenter // no-op } + @Override + public void onChildNumberChange() { + // no-op + } + private boolean isVideoUpgradePending(Call call) { return call.getSessionModificationState() == Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST; diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java index 01205ff1e..16a53b298 100644 --- a/InCallUI/src/com/android/incallui/Call.java +++ b/InCallUI/src/com/android/incallui/Call.java @@ -334,12 +334,13 @@ public class Call { Bundle callExtras = mTelecommCall.getDetails().getExtras(); if (callExtras != null) { - // Child address arrives when the call is first set up, so we do not need to notify the - // UI of this. + // Check for a change in the child address and notify any listeners. if (callExtras.containsKey(Connection.EXTRA_CHILD_ADDRESS)) { String childNumber = callExtras.getString(Connection.EXTRA_CHILD_ADDRESS); + if (!Objects.equals(childNumber, mChildNumber)) { mChildNumber = childNumber; + CallList.getInstance().onChildNumberChange(this); } } diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index 0cc5da1ca..f0193c4ed 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -347,6 +347,19 @@ public class CallCardPresenter extends Presenter updatePrimaryDisplayInfo(); } + /** + * Handles a change to the child number by refreshing the primary call info. + */ + @Override + public void onChildNumberChange() { + Log.v(this, "onChildNumberChange"); + + if (mPrimary == null) { + return; + } + updatePrimaryDisplayInfo(); + } + private String getSubscriptionNumber() { // If it's an emergency call, and they're not populating the callback number, // then try to fall back to the phone sub info (to hopefully get the SIM's diff --git a/InCallUI/src/com/android/incallui/CallList.java b/InCallUI/src/com/android/incallui/CallList.java index 666ba9529..11b5914f7 100644 --- a/InCallUI/src/com/android/incallui/CallList.java +++ b/InCallUI/src/com/android/incallui/CallList.java @@ -176,6 +176,21 @@ public class CallList { } } + /** + * Called when the child number changes for a call. The child number can be received after a + * call is initially set up, so we need to be able to inform listeners of the change. + * + * @param call The call. + */ + public void onChildNumberChange(Call call) { + final List listeners = mCallUpdateListenerMap.get(call.getId()); + if (listeners != null) { + for (CallUpdateListener listener : listeners) { + listener.onChildNumberChange(); + } + } + } + public void notifyCallUpdateListeners(Call call) { final List listeners = mCallUpdateListenerMap.get(call.getId()); if (listeners != null) { @@ -632,5 +647,10 @@ public class CallList { * Notifies of a change to the last forwarded number for a call. */ public void onLastForwardedNumberChange(); + + /** + * Notifies of a change to the child number for a call. + */ + public void onChildNumberChange(); } } diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java index 3f862a243..a9b6cccbe 100644 --- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java +++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java @@ -654,4 +654,9 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, public void onLastForwardedNumberChange() { // no-op } + + @Override + public void onChildNumberChange() { + // no-op + } } -- cgit v1.2.3