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

Commit 319c9cc7 authored by Malcolm Chen's avatar Malcolm Chen
Browse files

Allow data switch in emergency call.

Remove the restriction that no data switching can happen in emergency
call at all.
In the scenario of DSDS, if the mergency call is placed on non-dds
subscription, we could setup data conneciton on it if data is allowed.
So we should still re-evaluate data sub even in emergency call. The
only thing we need to make sure is, in older devices where on-demand
ps attach / detach is needed, don't detach the phone in voice call.

Bug: 134073343
Test: sanity
Change-Id: Ie2549f2cd426c902935a07afd90a4771b8498f8f
parent 97a0d4f0
Loading
Loading
Loading
Loading
+20 −24
Original line number Diff line number Diff line
@@ -327,7 +327,13 @@ public class PhoneSwitcher extends Handler {
            }
        }

        return (mPhoneIdInVoiceCall != oldPhoneIdInVoiceCall);
        if (mPhoneIdInVoiceCall != oldPhoneIdInVoiceCall) {
            log("isPhoneInVoiceCallChanged from phoneId " + oldPhoneIdInVoiceCall
                    + " to phoneId " + mPhoneIdInVoiceCall);
            return true;
        } else {
            return false;
        }
    }

    @VisibleForTesting
@@ -606,19 +612,6 @@ public class PhoneSwitcher extends Handler {
        }
    }

    private boolean isEmergency() {
        if (isInEmergencyCallbackMode()) return true;
        for (Phone p : mPhones) {
            if (p == null) continue;
            if (p.isInEmergencyCall()) return true;
            Phone imsPhone = p.getImsPhone();
            if (imsPhone != null && imsPhone.isInEmergencyCall()) {
                return true;
            }
        }
        return false;
    }

    private boolean isInEmergencyCallbackMode() {
        for (Phone p : mPhones) {
            if (p == null) continue;
@@ -734,10 +727,6 @@ public class PhoneSwitcher extends Handler {
     */
    private boolean onEvaluate(boolean requestsChanged, String reason) {
        StringBuilder sb = new StringBuilder(reason);
        if (isEmergency()) {
            log("onEvaluate for reason " + reason + " aborted due to Emergency");
            return false;
        }

        // If we use HAL_COMMAND_PREFERRED_DATA,
        boolean diffDetected = mHalCommandToUse != HAL_COMMAND_PREFERRED_DATA && requestsChanged;
@@ -812,6 +801,12 @@ public class PhoneSwitcher extends Handler {
                        newActivePhones.add(mPhones[i].getPhoneId());
                    }
                } else {
                    // First try to activate phone in voice call.
                    if (mPhoneIdInVoiceCall != SubscriptionManager.INVALID_PHONE_INDEX) {
                        newActivePhones.add(mPhoneIdInVoiceCall);
                    }

                    if (newActivePhones.size() < mMaxActivePhones) {
                        for (DcRequest dcRequest : mPrioritizedDcRequests) {
                            int phoneIdForRequest = phoneIdForRequest(dcRequest.networkRequest);
                            if (phoneIdForRequest == INVALID_PHONE_INDEX) continue;
@@ -819,6 +814,7 @@ public class PhoneSwitcher extends Handler {
                            newActivePhones.add(phoneIdForRequest);
                            if (newActivePhones.size() >= mMaxActivePhones) break;
                        }
                    }

                    if (newActivePhones.size() < mMaxActivePhones
                            && newActivePhones.contains(mPreferredDataPhoneId)