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

Commit f4025bcd authored by Grant Menke's avatar Grant Menke
Browse files

Add transport type get function in SimultaenousCallingTracker.java

In checking if two phones support simultaneous call via cellular or WLAN, added getTransportType function in SimultaenousCallingTracker.java. This prevents a NPE that was occuring if IMS phone had not been created when IMS feature was not supported.

Change-Id: Ifebee3b55f5821c180659fa34e8bbef029b9380a
Test: build
Flag: EXEMPT bugfix
Fixes: 390043290
parent 8e8a1320
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -407,7 +407,7 @@ public class SimultaneousCallingTracker {
                if (mPhoneConfigurationManager.isVirtualDsdaEnabled() ||
                        phone.isImsServiceSimultaneousCallingSupportCapable(mContext)) {
                    // Check if the transport types of each phone support simultaneous IMS calling:
                    int phone1TransportType = ((ImsPhone) phone.getImsPhone()).getTransportType();
                    int phone1TransportType = getImsTransportType(phone);
                    if (phone1TransportType == AccessNetworkConstants.TRANSPORT_TYPE_WLAN) {
                        // The transport type of this phone is WLAN so all combos are supported:
                        continue;
@@ -461,8 +461,7 @@ public class SimultaneousCallingTracker {
    }

    private boolean phonesSupportSimultaneousCallingViaCellularOrWlan(Phone phone1, Phone phone2) {
        int phone2TransportType =
                ((ImsPhone) phone2.getImsPhone()).getTransportType();
        int phone2TransportType = getImsTransportType(phone2);
        return phone2TransportType == AccessNetworkConstants.TRANSPORT_TYPE_WLAN ||
                phonesSupportCellularSimultaneousCalling(phone1, phone2);
    }
@@ -497,6 +496,16 @@ public class SimultaneousCallingTracker {
        }
    }

    private @AccessNetworkConstants.TransportType int getImsTransportType(Phone phone) {
        ImsPhone imsPhone = (ImsPhone) phone.getImsPhone();
        if (imsPhone != null) {
            return imsPhone.getTransportType();
        }
        Log.d(LOG_TAG, "getImsTransportType: IMS not supported for phone = "
            + phone);
        return AccessNetworkConstants.TRANSPORT_TYPE_INVALID;
    }

    private String getStringFromMap(Map<Integer, Set<Phone>> phoneMap) {
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<Integer, Set<Phone>> entry : phoneMap.entrySet()) {