Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 163f670d authored by Andrew Lee's avatar Andrew Lee Committed by Android (Google) Code Review
Browse files

Merge "Remove ADD_CALL if not only top-level call." into lmp-mr1-dev

parents 790eed91 235a52fa
Loading
Loading
Loading
Loading
+5 −13
Original line number Diff line number Diff line
@@ -829,26 +829,18 @@ public final class CallsManager extends Call.ListenerBase {
    }

    /**
     * Checks to see if the specified call is the only high-level call and if so, enable the
     * "Add-call" button. We allow you to add a second call but not a third or beyond.
     * Checks to see if the specified call is the only top level call. If it is not, we should
     * remove the ADD_CALL capability. We allow you to add a second call but not a third or beyond.
     *
     * @param call The call to test for add-call.
     * @return Whether the add-call feature should be enabled for the call.
     * @param call The call to check to see if it is the only top level call.
     * @return Whether the call is the only top level call.
     */
    protected boolean isAddCallCapable(Call call) {
    protected boolean isOnlyTopLevelCall(Call call) {
        if (call.getParentCall() != null) {
            // Never true for child calls.
            return false;
        }

        // Use canManageConference as a mechanism to check if the call is CDMA.
        // Disable "Add Call" for CDMA calls which are conference calls.
        boolean canManageConference = PhoneCapabilities.MANAGE_CONFERENCE
                == (call.getCallCapabilities() & PhoneCapabilities.MANAGE_CONFERENCE);
        if (call.isConference() && !canManageConference) {
            return false;
        }

        // Loop through all the other calls and there exists a top level (has no parent) call
        // that is not the specified call, return false.
        for (Call otherCall : mCalls) {
+2 −2
Original line number Diff line number Diff line
@@ -431,8 +431,8 @@ public final class InCallController extends CallsManagerListenerBase {
        int state = call.getState();
        int capabilities = call.getCallCapabilities();

        if (CallsManager.getInstance().isAddCallCapable(call) && state != CallState.DIALING) {
            capabilities |= PhoneCapabilities.ADD_CALL;
        if (!CallsManager.getInstance().isOnlyTopLevelCall(call) || state == CallState.DIALING) {
            capabilities = PhoneCapabilities.remove(capabilities, PhoneCapabilities.ADD_CALL);
        }

        if (call.isRespondViaSmsCapable()) {