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

Commit 3fa05ed9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "DSDA: Support "Add call" from 2nd sub" into udc-dev am: 374b1ebd

parents 94c1c618 374b1ebd
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -450,8 +450,6 @@ public class CallsManager extends Call.ListenerBase

    private boolean mCanAddCall = true;

    private int mMaxNumberOfSimultaneouslyActiveSims = -1;

    private Runnable mStopTone;

    private LinkedList<HandlerThread> mGraphHandlerThreads;
@@ -3117,6 +3115,18 @@ public class CallsManager extends Call.ListenerBase
        return constructPossiblePhoneAccounts(handle, user, isVideo, isEmergency, false);
    }

    // Returns whether the device is capable of 2 simultaneous active voice calls on different subs.
    private boolean isDsdaCallingPossible() {
        try {
            return getTelephonyManager().getMaxNumberOfSimultaneouslyActiveSims() > 1
                    || getTelephonyManager().getPhoneCapability()
                           .getMaxActiveVoiceSubscriptions() > 1;
        } catch (Exception e) {
            Log.w(this, "exception in isDsdaCallingPossible(): ", e);
            return false;
        }
    }

    public List<PhoneAccountHandle> constructPossiblePhoneAccounts(Uri handle, UserHandle user,
            boolean isVideo, boolean isEmergency, boolean isConference) {

@@ -3133,13 +3143,9 @@ public class CallsManager extends Call.ListenerBase
                        capabilities,
                        isEmergency ? 0 : PhoneAccount.CAPABILITY_EMERGENCY_CALLS_ONLY,
                        isEmergency);
        if (mMaxNumberOfSimultaneouslyActiveSims < 0) {
            mMaxNumberOfSimultaneouslyActiveSims =
                    getTelephonyManager().getMaxNumberOfSimultaneouslyActiveSims();
        }
        // Only one SIM PhoneAccount can be active at one time for DSDS. Only that SIM PhoneAccount
        // should be available if a call is already active on the SIM account.
        if (mMaxNumberOfSimultaneouslyActiveSims == 1) {
        if (!isDsdaCallingPossible()) {
            List<PhoneAccountHandle> simAccounts =
                    mPhoneAccountRegistrar.getSimPhoneAccountsOfCurrentUser();
            PhoneAccountHandle ongoingCallAccount = null;