@Override public void onBackPressed() { Log.i(this, "onBackPressed"); // BACK is also used to exit out of any "special modes" of the // in-call UI: if (!mConferenceManagerFragment.isVisible() && !mCallCardFragment.isVisible()) { return; } if (mDialpadFragment != null && mDialpadFragment.isVisible()) { mCallButtonFragment.displayDialpad(false /* show */, true /* animate */); return; } else if (mConferenceManagerFragment.isVisible()) { showConferenceCallManager(false); return; } // Always disable the Back key while an incoming call is ringing final Call call = CallList.getInstance().getIncomingCall(); if (call != null) { Log.d(this, "Consume Back press for an incoming call"); return; } // Nothing special to do. Fall back to the default behavior. super.onBackPressed(); }
@Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { if (mCallCardFragment != null) { mCallCardFragment.dispatchPopulateAccessibilityEvent(event); } return super.dispatchPopulateAccessibilityEvent(event); }
/** * Hides or shows the conference manager fragment. * * @param show {@code true} if the conference manager should be shown, {@code false} if it should * be hidden. */ public void showConferenceCallManager(boolean show) { mConferenceManagerFragment.setVisible(show); // Need to hide the call card fragment to ensure that accessibility service does not try to // give focus to the call card when the conference manager is visible. mCallCardFragment.getView().setVisibility(show ? View.GONE : View.VISIBLE); }
private void initializeInCall() { if (mCallCardFragment == null) { mCallCardFragment = (CallCardFragment) getFragmentManager().findFragmentById(R.id.callCardFragment); } mChildFragmentManager = mCallCardFragment.getChildFragmentManager(); if (mCallButtonFragment == null) { mCallButtonFragment = (CallButtonFragment) mChildFragmentManager.findFragmentById(R.id.callButtonFragment); mCallButtonFragment.getView().setVisibility(View.INVISIBLE); } if (mAnswerFragment == null) { mAnswerFragment = (AnswerFragment) mChildFragmentManager.findFragmentById(R.id.answerFragment); } if (mConferenceManagerFragment == null) { mConferenceManagerFragment = (ConferenceManagerFragment) getFragmentManager().findFragmentById(R.id.conferenceManagerFragment); mConferenceManagerFragment.getView().setVisibility(View.INVISIBLE); } }
public void displayDialpad(boolean showDialpad, boolean animate) { // If the dialpad is already visible, don't animate in. If it's gone, don't animate out. if ((showDialpad && isDialpadVisible()) || (!showDialpad && !isDialpadVisible())) { return; } // We don't do a FragmentTransaction on the hide case because it will be dealt with when // the listener is fired after an animation finishes. if (!animate) { showDialpad(showDialpad); } else { if (showDialpad) { showDialpad(true); mDialpadFragment.animateShowDialpad(); } mCallCardFragment.onDialpadVisiblityChange(showDialpad); mDialpadFragment.getView().startAnimation(showDialpad ? mSlideIn : mSlideOut); } InCallPresenter.getInstance().getProximitySensor().onDialpadVisible(showDialpad); }
private void internalResolveIntent(Intent intent) { final String action = intent.getAction(); if (action.equals(intent.ACTION_MAIN)) { // This action is the normal way to bring up the in-call UI. // // But we do check here for one extra that can come along with the // ACTION_MAIN intent: if (intent.hasExtra(SHOW_DIALPAD_EXTRA)) { // 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. final boolean showDialpad = intent.getBooleanExtra(SHOW_DIALPAD_EXTRA, false); Log.d(this, "- internalResolveIntent: SHOW_DIALPAD_EXTRA: " + showDialpad); relaunchedFromDialer(showDialpad); } if (intent.getBooleanExtra(NEW_OUTGOING_CALL_EXTRA, false)) { intent.removeExtra(NEW_OUTGOING_CALL_EXTRA); Call call = CallList.getInstance().getOutgoingCall(); if (call == null) { call = CallList.getInstance().getPendingOutgoingCall(); } Bundle extras = null; if (call != null) { extras = call.getTelecommCall().getDetails().getExtras(); } if (extras == null) { // Initialize the extras bundle to avoid NPE extras = new Bundle(); } Point touchPoint = null; if (TouchPointManager.getInstance().hasValidPoint()) { // Use the most immediate touch point in the InCallUi if available touchPoint = TouchPointManager.getInstance().getPoint(); } else { // Otherwise retrieve the touch point from the call intent if (call != null) { touchPoint = (Point) extras.getParcelable(TouchPointManager.TOUCH_POINT); } } // This is only true in the case where an outgoing call is initiated by tapping // on the "Select account dialog", in which case we skip the initial animation. In // most other cases the circular reveal is done by OutgoingCallAnimationActivity. final boolean showCircularReveal = intent.getBooleanExtra(SHOW_CIRCULAR_REVEAL_EXTRA, false); mCallCardFragment.animateForNewOutgoingCall(touchPoint, showCircularReveal); // InCallActivity is responsible for disconnecting a new outgoing call if there // is no way of making it (i.e. no valid call capable accounts) if (InCallPresenter.isCallWithNoValidAccounts(call)) { TelecomAdapter.getInstance().disconnectCall(call.getId()); } dismissKeyguard(true); } Call pendingAccountSelectionCall = CallList.getInstance().getWaitingForAccountCall(); if (pendingAccountSelectionCall != null) { mCallCardFragment.setVisible(false); Bundle extras = pendingAccountSelectionCall.getTelecommCall().getDetails().getExtras(); final List<PhoneAccountHandle> phoneAccountHandles; if (extras != null) { phoneAccountHandles = extras.getParcelableArrayList(android.telecom.Call.AVAILABLE_PHONE_ACCOUNTS); } else { phoneAccountHandles = new ArrayList<>(); } SelectPhoneAccountListener listener = new SelectPhoneAccountListener() { @Override public void onPhoneAccountSelected( PhoneAccountHandle selectedAccountHandle, boolean setDefault) { InCallPresenter.getInstance() .handleAccountSelection(selectedAccountHandle, setDefault); } @Override public void onDialogDismissed() { InCallPresenter.getInstance().cancelAccountSelection(); } }; SelectPhoneAccountDialogFragment.showAccountDialog( getFragmentManager(), R.string.select_phone_account_for_calls, true, phoneAccountHandles, listener); } else { mCallCardFragment.setVisible(true); } return; } }