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

Commit 08013e4e authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fixed SUPL not working in nDDS when emergency call" am: a8994214

parents ac920866 a8994214
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.os.AsyncResult;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.telecom.TelecomManager;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.AccessNetworkConstants.RadioAccessNetworkType;
@@ -230,6 +231,7 @@ public class DataNetworkController extends Handler {
    private final @NonNull AccessNetworksManager mAccessNetworksManager;
    private final @NonNull DataRetryManager mDataRetryManager;
    private final @NonNull ImsManager mImsManager;
    private final @NonNull TelecomManager mTelecomManager;
    private final @NonNull NetworkPolicyManager mNetworkPolicyManager;
    private final @NonNull SparseArray<DataServiceManager> mDataServiceManagers =
            new SparseArray<>();
@@ -910,6 +912,7 @@ public class DataNetworkController extends Handler {
                });
        mImsManager = mPhone.getContext().getSystemService(ImsManager.class);
        mNetworkPolicyManager = mPhone.getContext().getSystemService(NetworkPolicyManager.class);
        mTelecomManager = mPhone.getContext().getSystemService(TelecomManager.class);

        // Use the raw one from ServiceStateTracker instead of the combined one from
        // mPhone.getServiceState().
@@ -1569,7 +1572,7 @@ public class DataNetworkController extends Handler {
                evaluation.addDataAllowedReason(DataAllowedReason.MMS_REQUEST);
            }
        } else if (!evaluation.containsHardDisallowedReasons()) {
            if ((mPhone.isInEmergencyCall() || mPhone.isInEcm())
            if ((mTelecomManager.isInEmergencyCall() || mPhone.isInEcm())
                    && networkRequest.hasCapability(NetworkCapabilities.NET_CAPABILITY_SUPL)) {
                // Check if it's SUPL during emergency call.
                evaluation.addDataAllowedReason(DataAllowedReason.EMERGENCY_SUPL);
@@ -1827,7 +1830,8 @@ public class DataNetworkController extends Handler {
            // If there are reasons we should tear down the network, check if those are hard reasons
            // or soft reasons. In some scenarios, we can make exceptions if they are soft
            // disallowed reasons.
            if ((mPhone.isInEmergencyCall() || mPhone.isInEcm()) && dataNetwork.isEmergencySupl()) {
            if ((mTelecomManager.isInEmergencyCall() || mPhone.isInEcm())
                    && dataNetwork.isEmergencySupl()) {
                // Check if it's SUPL during emergency call.
                evaluation.addDataAllowedReason(DataAllowedReason.EMERGENCY_SUPL);
            } else if (!dataNetwork.getNetworkCapabilities().hasCapability(
+3 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ import android.provider.BlockedNumberContract;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.provider.Telephony;
import android.telecom.TelecomManager;
import android.telephony.AccessNetworkConstants;
import android.telephony.CarrierConfigManager;
import android.telephony.CellIdentity;
@@ -266,6 +267,7 @@ public abstract class TelephonyTest {
    protected ActivityManager mActivityManager;
    protected ImsCallProfile mImsCallProfile;
    protected TelephonyManager mTelephonyManager;
    protected TelecomManager mTelecomManager;
    protected TelephonyRegistryManager mTelephonyRegistryManager;
    protected SubscriptionManager mSubscriptionManager;
    protected EuiccManager mEuiccManager;
@@ -523,6 +525,7 @@ public abstract class TelephonyTest {
        doReturn(mUiccProfile).when(mUiccPort).getUiccProfile();

        mTelephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
        mTelecomManager = mContext.getSystemService(TelecomManager.class);
        mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
        mTelephonyRegistryManager = (TelephonyRegistryManager) mContext.getSystemService(
            Context.TELEPHONY_REGISTRY_SERVICE);
+2 −2
Original line number Diff line number Diff line
@@ -3356,7 +3356,7 @@ public class DataNetworkControllerTest extends TelephonyTest {
        mDataNetworkControllerUT.getDataSettingsManager().setDataEnabled(
                TelephonyManager.DATA_ENABLED_REASON_USER, false, mContext.getOpPackageName());
        processAllMessages();
        doReturn(true).when(mPhone).isInEmergencyCall();
        doReturn(true).when(mTelecomManager).isInEmergencyCall();
        mDataNetworkControllerUT.addNetworkRequest(
                createNetworkRequest(NetworkCapabilities.NET_CAPABILITY_SUPL));
        processAllMessages();
@@ -3370,7 +3370,7 @@ public class DataNetworkControllerTest extends TelephonyTest {

    @Test
    public void testEmergencyCallDataDisabled() throws Exception {
        doReturn(true).when(mPhone).isInEmergencyCall();
        doReturn(true).when(mTelecomManager).isInEmergencyCall();
        mDataNetworkControllerUT.addNetworkRequest(
                createNetworkRequest(NetworkCapabilities.NET_CAPABILITY_INTERNET));
        processAllMessages();