diff options
Diffstat (limited to 'InCallUI/src/com/android/incallui/InCallPresenter.java')
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallPresenter.java | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 0109d7ee6..38507eef9 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -41,6 +41,7 @@ import android.view.Window; import android.view.WindowManager; import com.android.contacts.common.GeoUtil; +import com.android.contacts.common.compat.CallSdkCompat; import com.android.contacts.common.compat.CompatUtils; import com.android.contacts.common.compat.telecom.TelecomManagerCompat; import com.android.contacts.common.interactions.TouchPointManager; @@ -109,9 +110,11 @@ public class InCallPresenter implements CallList.Listener, private AudioModeProvider mAudioModeProvider; private StatusBarNotifier mStatusBarNotifier; + private ExternalCallNotifier mExternalCallNotifier; private ContactInfoCache mContactInfoCache; private Context mContext; private CallList mCallList; + private ExternalCallList mExternalCallList; private InCallActivity mInCallActivity; private InCallState mInCallState = InCallState.NO_CALLS; private ProximitySensor mProximitySensor; @@ -299,8 +302,10 @@ public class InCallPresenter implements CallList.Listener, public void setUp(Context context, CallList callList, + ExternalCallList externalCallList, AudioModeProvider audioModeProvider, StatusBarNotifier statusBarNotifier, + ExternalCallNotifier externalCallNotifier, ContactInfoCache contactInfoCache, ProximitySensor proximitySensor) { if (mServiceConnected) { @@ -318,6 +323,7 @@ public class InCallPresenter implements CallList.Listener, mContactInfoCache = contactInfoCache; mStatusBarNotifier = statusBarNotifier; + mExternalCallNotifier = externalCallNotifier; addListener(mStatusBarNotifier); mAudioModeProvider = audioModeProvider; @@ -329,6 +335,8 @@ public class InCallPresenter implements CallList.Listener, addInCallUiListener(mAnswerPresenter); mCallList = callList; + mExternalCallList = externalCallList; + externalCallList.addExternalCallListener(mExternalCallNotifier); // This only gets called by the service so this is okay. mServiceConnected = true; @@ -501,7 +509,12 @@ public class InCallPresenter implements CallList.Listener, if (shouldAttemptBlocking(call)) { maybeBlockCall(call); } else { - mCallList.onCallAdded(call); + if (call.getDetails() + .hasProperty(CallSdkCompat.Details.PROPERTY_IS_EXTERNAL_CALL)) { + mExternalCallList.onCallAdded(call); + } else { + mCallList.onCallAdded(call); + } } // Since a call has been added we are no longer waiting for Telecom to send us a call. @@ -590,8 +603,13 @@ public class InCallPresenter implements CallList.Listener, } public void onCallRemoved(android.telecom.Call call) { - mCallList.onCallRemoved(call); - call.unregisterCallback(mCallCallback); + if (call.getDetails() + .hasProperty(CallSdkCompat.Details.PROPERTY_IS_EXTERNAL_CALL)) { + mExternalCallList.onCallRemoved(call); + } else { + mCallList.onCallRemoved(call); + call.unregisterCallback(mCallCallback); + } } public void onCanAddCallChanged(boolean canAddCall) { @@ -1506,6 +1524,9 @@ public class InCallPresenter implements CallList.Listener, if (mStatusBarNotifier != null) { removeListener(mStatusBarNotifier); } + if (mExternalCallNotifier != null && mExternalCallList != null) { + mExternalCallList.removeExternalCallListener(mExternalCallNotifier); + } mStatusBarNotifier = null; if (mCallList != null) { @@ -1808,6 +1829,10 @@ public class InCallPresenter implements CallList.Listener, return mAnswerPresenter; } + ExternalCallNotifier getExternalCallNotifier() { + return mExternalCallNotifier; + } + /** * Private constructor. Must use getInstance() to get this singleton. */ |