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 609eceb80..189049c47 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; @@ -502,7 +510,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. @@ -591,8 +604,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) { @@ -1507,6 +1525,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) { @@ -1816,6 +1837,10 @@ public class InCallPresenter implements CallList.Listener, return mAnswerPresenter; } + ExternalCallNotifier getExternalCallNotifier() { + return mExternalCallNotifier; + } + /** * Private constructor. Must use getInstance() to get this singleton. */ |