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

Commit 6db0df1f authored by Meng Wang's avatar Meng Wang Committed by Android (Google) Code Review
Browse files

Merge "notifyDataConnectionForSubscriber with apn type bitmask."

parents 259f977f 22940da5
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyRegistryManager;
import android.telephony.data.ApnSetting;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.ImsReasonInfo;

@@ -135,9 +136,10 @@ public class DefaultPhoneNotifier implements PhoneNotifier {

        int subId = sender.getSubId();
        int phoneId = sender.getPhoneId();
        int apnTypeBitmask = ApnSetting.getApnTypesBitmaskFromString(apnType);

        mTelephonyRegistryMgr.notifyDataConnectionForSubscriber(
                phoneId, subId, apnType, preciseState);
                phoneId, subId, apnTypeBitmask, preciseState);
    }

    @Override
@@ -178,8 +180,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
    /** Notify the TelephonyRegistry that a data connection has failed with a specified cause */
    public void notifyDataConnectionFailed(Phone sender, String apnType,
        String apn, @DataFailureCause int failCause) {
        mTelephonyRegistryMgr.notifyPreciseDataConnectionFailed(sender.getSubId(),
            sender.getPhoneId(), apnType, apn, failCause);
        mTelephonyRegistryMgr.notifyPreciseDataConnectionFailed(
                sender.getSubId(), sender.getPhoneId(),
                ApnSetting.getApnTypesBitmaskFromString(apnType), apn, failCause);
    }

    @Override
+7 −3
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.telephony.PreciseCallState;
import android.telephony.PreciseDisconnectCause;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting;
import android.test.suitebuilder.annotation.SmallTest;

import com.android.internal.telephony.PhoneInternalInterface.DataActivityState;
@@ -168,18 +169,21 @@ public class DefaultPhoneNotifierTest extends TelephonyTest {
        mDefaultPhoneNotifierUT.notifyDataConnectionFailed(mPhone, "default", "APN_0",
                DataFailCause.INSUFFICIENT_RESOURCES);
        verify(mTelephonyRegistryManager).notifyPreciseDataConnectionFailed(
                eq(0), eq(0), eq("default"), eq("APN_0"), eq(DataFailCause.INSUFFICIENT_RESOURCES));
                eq(0), eq(0), eq(ApnSetting.TYPE_DEFAULT), eq("APN_0"),
                eq(DataFailCause.INSUFFICIENT_RESOURCES));

        mDefaultPhoneNotifierUT.notifyDataConnectionFailed(mPhone, "default", "APN_1",
                DataFailCause.INSUFFICIENT_RESOURCES);
        verify(mTelephonyRegistryManager).notifyPreciseDataConnectionFailed(
                eq(0), eq(0), eq("default"), eq("APN_1"), eq(DataFailCause.INSUFFICIENT_RESOURCES));
                eq(0), eq(0), eq(ApnSetting.TYPE_DEFAULT), eq("APN_1"),
                eq(DataFailCause.INSUFFICIENT_RESOURCES));

        doReturn(1).when(mPhone).getSubId();
        mDefaultPhoneNotifierUT.notifyDataConnectionFailed(mPhone, "default", "APN_1",
                DataFailCause.INSUFFICIENT_RESOURCES);
        verify(mTelephonyRegistryManager).notifyPreciseDataConnectionFailed(
                eq(1), eq(0), eq("default"), eq("APN_1"), eq(DataFailCause.INSUFFICIENT_RESOURCES));
                eq(1), eq(0), eq(ApnSetting.TYPE_DEFAULT), eq("APN_1"),
                eq(DataFailCause.INSUFFICIENT_RESOURCES));
    }

    @Test @SmallTest
+4 −3
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.telephony.PhoneStateListener;
import android.telephony.PreciseDataConnectionState;
import android.telephony.SubscriptionInfo;
import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting;
import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
@@ -250,7 +251,7 @@ public class TelephonyRegistryTest extends TelephonyTest {
        doReturn(0/*slotIndex*/).when(mMockSubInfo).getSimSlotIndex();
        // Initialize the PSL with a PreciseDataConnection
        mTelephonyRegistry.notifyDataConnectionForSubscriber(
                /*phoneId*/ 0, subId, "default",
                /*phoneId*/ 0, subId, ApnSetting.TYPE_DEFAULT,
                new PreciseDataConnectionState(
                    0, 0, 0, "default", new LinkProperties(), 0, null));
        mTelephonyRegistry.listenForSubscriber(subId, mContext.getOpPackageName(),
@@ -262,7 +263,7 @@ public class TelephonyRegistryTest extends TelephonyTest {

        // Add IMS APN and verify that the listener is invoked for the IMS APN
        mTelephonyRegistry.notifyDataConnectionForSubscriber(
                /*phoneId*/ 0, subId, "ims",
                /*phoneId*/ 0, subId, ApnSetting.TYPE_IMS,
                new PreciseDataConnectionState(
                    0, 0, 0, "ims", new LinkProperties(), 0, null));
        processAllMessages();
@@ -285,7 +286,7 @@ public class TelephonyRegistryTest extends TelephonyTest {
        // Send a duplicate event to the TelephonyRegistry and verify that the listener isn't
        // invoked.
        mTelephonyRegistry.notifyDataConnectionForSubscriber(
                /*phoneId*/ 0, subId, "ims",
                /*phoneId*/ 0, subId, ApnSetting.TYPE_IMS,
                new PreciseDataConnectionState(
                    0, 0, 0, "ims", new LinkProperties(), 0, null));
        processAllMessages();