Search in sources :

Example 6 with CallList

use of com.android.incallui.call.CallList in project android_packages_apps_Dialer by LineageOS.

the class ConferenceManagerFragment method onResume.

@Override
public void onResume() {
    super.onResume();
    final CallList calls = CallList.getInstance();
    getPresenter().init(calls);
    // Request focus on the list of participants for accessibility purposes.  This ensures
    // that once the list of participants is shown, the first participant is announced.
    mConferenceParticipantList.requestFocus();
}
Also used : CallList(com.android.incallui.call.CallList)

Example 7 with CallList

use of com.android.incallui.call.CallList in project android_packages_apps_Dialer by LineageOS.

the class InCallPresenter method handleCallKey.

/**
 * Handles the green CALL key while in-call.
 *
 * @return true if we consumed the event.
 */
public boolean handleCallKey() {
    LogUtil.v("InCallPresenter.handleCallKey", null);
    // The green CALL button means either "Answer", "Unhold", or
    // "Swap calls", or can be a no-op, depending on the current state
    // of the Phone.
    /**
     * INCOMING CALL
     */
    final CallList calls = mCallList;
    final DialerCall incomingCall = calls.getIncomingCall();
    LogUtil.v("InCallPresenter.handleCallKey", "incomingCall: " + incomingCall);
    // (1) Attempt to answer a call
    if (incomingCall != null) {
        incomingCall.answer(VideoProfile.STATE_AUDIO_ONLY);
        return true;
    }
    /**
     * STATE_ACTIVE CALL
     */
    final DialerCall activeCall = calls.getActiveCall();
    if (activeCall != null) {
        // TODO: This logic is repeated from CallButtonPresenter.java. We should
        // consolidate this logic.
        final boolean canMerge = activeCall.can(android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE);
        final boolean canSwap = activeCall.can(android.telecom.Call.Details.CAPABILITY_SWAP_CONFERENCE);
        LogUtil.v("InCallPresenter.handleCallKey", "activeCall: " + activeCall + ", canMerge: " + canMerge + ", canSwap: " + canSwap);
        // (2) Attempt actions on conference calls
        if (canMerge) {
            TelecomAdapter.getInstance().merge(activeCall.getId());
            return true;
        } else if (canSwap) {
            TelecomAdapter.getInstance().swap(activeCall.getId());
            return true;
        }
    }
    /**
     * BACKGROUND CALL
     */
    final DialerCall heldCall = calls.getBackgroundCall();
    if (heldCall != null) {
        // We have a hold call so presumeable it will always support HOLD...but
        // there is no harm in double checking.
        final boolean canHold = heldCall.can(android.telecom.Call.Details.CAPABILITY_HOLD);
        LogUtil.v("InCallPresenter.handleCallKey", "heldCall: " + heldCall + ", canHold: " + canHold);
        // (4) unhold call
        if (heldCall.getState() == DialerCall.State.ONHOLD && canHold) {
            heldCall.unhold();
            return true;
        }
    }
    // Always consume hard keys
    return true;
}
Also used : CallList(com.android.incallui.call.CallList) ExternalCallList(com.android.incallui.call.ExternalCallList) DialerCall(com.android.incallui.call.DialerCall)

Aggregations

CallList (com.android.incallui.call.CallList)7 DialerCall (com.android.incallui.call.DialerCall)6 ExternalCallList (com.android.incallui.call.ExternalCallList)1