use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.
the class CallCardPresenter method onStateChange.
@Override
public void onStateChange(InCallState oldState, InCallState newState, CallList callList) {
LogUtil.v("CallCardPresenter.onStateChange", "oldState: %s, newState: %s", oldState, newState);
if (mInCallScreen == null) {
return;
}
DialerCall primary = null;
DialerCall secondary = null;
if (newState == InCallState.INCOMING) {
primary = callList.getIncomingCall();
} else if (newState == InCallState.PENDING_OUTGOING || newState == InCallState.OUTGOING) {
primary = callList.getOutgoingCall();
if (primary == null) {
primary = callList.getPendingOutgoingCall();
}
// getCallToDisplay doesn't go through outgoing or incoming calls. It will return the
// highest priority call to display as the secondary call.
secondary = getCallToDisplay(callList, null, true);
} else if (newState == InCallState.INCALL) {
primary = getCallToDisplay(callList, null, false);
secondary = getCallToDisplay(callList, primary, true);
}
LogUtil.v("CallCardPresenter.onStateChange", "primary call: " + primary);
LogUtil.v("CallCardPresenter.onStateChange", "secondary call: " + secondary);
final boolean primaryChanged = !(DialerCall.areSame(mPrimary, primary) && DialerCall.areSameNumber(mPrimary, primary));
final boolean secondaryChanged = !(DialerCall.areSame(mSecondary, secondary) && DialerCall.areSameNumber(mSecondary, secondary));
mSecondary = secondary;
DialerCall previousPrimary = mPrimary;
mPrimary = primary;
if (mPrimary != null) {
InCallPresenter.getInstance().onForegroundCallChanged(mPrimary);
mInCallScreen.updateInCallScreenColors();
}
if (primaryChanged && shouldShowNoteSentToast(primary)) {
mInCallScreen.showNoteSentToast();
}
// 2. The call's ability to manage conference has changed.
if (shouldRefreshPrimaryInfo(primaryChanged)) {
// primary call has changed
if (previousPrimary != null) {
previousPrimary.removeListener(this);
}
mPrimary.addListener(this);
mPrimaryContactInfo = ContactInfoCache.buildCacheEntryFromCall(mContext, mPrimary, mPrimary.getState() == DialerCall.State.INCOMING);
updatePrimaryDisplayInfo();
maybeStartSearch(mPrimary, true);
}
if (previousPrimary != null && mPrimary == null) {
previousPrimary.removeListener(this);
}
if (mSecondary == null) {
// Secondary call may have ended. Update the ui.
mSecondaryContactInfo = null;
updateSecondaryDisplayInfo();
} else if (secondaryChanged) {
// secondary call has changed
mSecondaryContactInfo = ContactInfoCache.buildCacheEntryFromCall(mContext, mSecondary, mSecondary.getState() == DialerCall.State.INCOMING);
updateSecondaryDisplayInfo();
maybeStartSearch(mSecondary, false);
}
// Set the call state
int callState = DialerCall.State.IDLE;
if (mPrimary != null) {
callState = mPrimary.getState();
updatePrimaryCallState();
} else {
getUi().setCallState(PrimaryCallState.createEmptyPrimaryCallState());
}
maybeShowManageConferenceCallButton();
// Hide the end call button instantly if we're receiving an incoming call.
getUi().setEndCallButtonEnabled(shouldShowEndCallButton(mPrimary, callState), callState != DialerCall.State.INCOMING);
maybeSendAccessibilityEvent(oldState, newState, primaryChanged);
}
use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.
the class ConferenceManagerPresenter method update.
/**
* Updates the conference participant adapter.
*
* @param callList The callList.
*/
private void update(CallList callList) {
// callList is non null, but getActiveOrBackgroundCall() may return null
final DialerCall currentCall = callList.getActiveOrBackgroundCall();
if (currentCall == null) {
return;
}
ArrayList<DialerCall> calls = new ArrayList<>(currentCall.getChildCallIds().size());
for (String callerId : currentCall.getChildCallIds()) {
calls.add(callList.getCallById(callerId));
}
Log.d(this, "Number of calls is " + String.valueOf(calls.size()));
// Users can split out a call from the conference call if either the active call or the
// holding call is empty. If both are filled, users can not split out another call.
final boolean hasActiveCall = (callList.getActiveCall() != null);
final boolean hasHoldingCall = (callList.getBackgroundCall() != null);
boolean canSeparate = !(hasActiveCall && hasHoldingCall);
getUi().update(calls, canSeparate);
}
use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.
the class InCallActivity method getShouldShowAnswerUi.
private ShouldShowUiResult getShouldShowAnswerUi() {
DialerCall call = CallList.getInstance().getIncomingCall();
if (call != null) {
LogUtil.i("InCallActivity.getShouldShowAnswerUi", "found incoming call");
return new ShouldShowUiResult(true, call);
}
call = CallList.getInstance().getVideoUpgradeRequestCall();
if (call != null) {
LogUtil.i("InCallActivity.getShouldShowAnswerUi", "found video upgrade request");
return new ShouldShowUiResult(true, call);
}
// Check if we're showing the answer screen and the call is disconnected. If this condition is
// true then we won't switch from the answer UI to the in call UI. This prevents flicker when
// the user rejects an incoming call.
call = CallList.getInstance().getFirstCall();
if (call == null) {
call = CallList.getInstance().getBackgroundCall();
}
if (didShowAnswerScreen && (call == null || call.getState() == State.DISCONNECTED)) {
LogUtil.i("InCallActivity.getShouldShowAnswerUi", "found disconnecting incoming call");
return new ShouldShowUiResult(true, call);
}
return new ShouldShowUiResult(false, null);
}
use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.
the class InCallActivityCommon method relaunchedFromDialer.
/**
* When relaunching from the dialer app, {@code showDialpad} indicates whether the dialpad should
* be shown on launch.
*
* @param showDialpad {@code true} to indicate the dialpad should be shown on launch, and {@code
* false} to indicate no change should be made to the dialpad visibility.
*/
private void relaunchedFromDialer(boolean showDialpad) {
showDialpadRequest = showDialpad ? DIALPAD_REQUEST_SHOW : DIALPAD_REQUEST_NONE;
animateDialpadOnShow = true;
if (showDialpadRequest == DIALPAD_REQUEST_SHOW) {
// If there's only one line in use, AND it's on hold, then we're sure the user
// wants to use the dialpad toward the exact line, so un-hold the holding line.
DialerCall call = CallList.getInstance().getActiveOrBackgroundCall();
if (call != null && call.getState() == State.ONHOLD) {
call.unhold();
}
}
}
use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.
the class InCallActivityCommon method internalResolveIntent.
private void internalResolveIntent(Intent intent) {
if (!intent.getAction().equals(Intent.ACTION_MAIN)) {
return;
}
if (intent.hasExtra(INTENT_EXTRA_SHOW_DIALPAD)) {
// SHOW_DIALPAD_EXTRA can be used here to specify whether the DTMF
// dialpad should be initially visible. If the extra isn't
// present at all, we just leave the dialpad in its previous state.
boolean showDialpad = intent.getBooleanExtra(INTENT_EXTRA_SHOW_DIALPAD, false);
LogUtil.i("InCallActivityCommon.internalResolveIntent", "SHOW_DIALPAD_EXTRA: " + showDialpad);
relaunchedFromDialer(showDialpad);
}
DialerCall outgoingCall = CallList.getInstance().getOutgoingCall();
if (outgoingCall == null) {
outgoingCall = CallList.getInstance().getPendingOutgoingCall();
}
if (intent.getBooleanExtra(INTENT_EXTRA_NEW_OUTGOING_CALL, false)) {
intent.removeExtra(INTENT_EXTRA_NEW_OUTGOING_CALL);
// If the version is not MSIM compatible, then ignore this code.
if (CompatUtils.isMSIMCompatible() && InCallPresenter.isCallWithNoValidAccounts(outgoingCall)) {
LogUtil.i("InCallActivityCommon.internalResolveIntent", "call with no valid accounts, disconnecting");
outgoingCall.disconnect();
}
dismissKeyguard(true);
}
boolean didShowAccountSelectionDialog = maybeShowAccountSelectionDialog();
if (didShowAccountSelectionDialog) {
inCallActivity.hideMainInCallFragment();
}
}
Aggregations