Loading src/java/com/android/internal/telephony/dataconnection/DcTracker.java +14 −3 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ import android.telephony.CellLocation; import android.telephony.DataFailCause; import android.telephony.NetworkRegistrationInfo; import android.telephony.PcoData; import android.telephony.PreciseDataConnectionState; import android.telephony.ServiceState; import android.telephony.ServiceState.RilRadioTechnology; import android.telephony.SubscriptionManager; Loading Loading @@ -1080,11 +1081,21 @@ public class DcTracker extends Handler { for (ApnConfigType apnConfigType : types) { ApnContext apnContext = new ApnContext(mPhone, apnConfigType.getType(), mLogTag, this, apnConfigType.getPriority()); int bitmask = ApnSetting.getApnTypesBitmaskFromString(apnContext.getApnType()); mPrioritySortedApnContexts.add(apnContext); mApnContexts.put(apnContext.getApnType(), apnContext); mApnContextsByType.put(ApnSetting.getApnTypesBitmaskFromString(apnContext.getApnType()), apnContext); mApnContextsByType.put(bitmask, apnContext); // Notify listeners that all data is disconnected when DCT is initialized. // Once connections are established, DC will then notify that data is connected. // This is to prevent the case where the phone process crashed but we don't notify // listeners that data was disconnected, so they may be stuck in a connected state. mPhone.notifyDataConnection(new PreciseDataConnectionState.Builder() .setTransportType(mTransportType) .setState(TelephonyManager.DATA_DISCONNECTED) .setApnSetting(new ApnSetting.Builder() .setApnTypeBitmask(bitmask).buildWithoutCheck()) .setNetworkType(getDataRat()) .build()); log("initApnContexts: apnContext=" + ApnSetting.getApnTypeString( apnConfigType.getType())); } Loading tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcTrackerTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ import android.telephony.AccessNetworkConstants; import android.telephony.AccessNetworkConstants.AccessNetworkType; import android.telephony.CarrierConfigManager; import android.telephony.NetworkRegistrationInfo; import android.telephony.PreciseDataConnectionState; import android.telephony.ServiceState; import android.telephony.SignalStrength; import android.telephony.SubscriptionInfo; Loading Loading @@ -2851,4 +2852,15 @@ public class DcTrackerTest extends TelephonyTest { anyInt(), any(DataProfile.class), anyBoolean(), anyBoolean(), anyInt(), any(), anyInt(), any(), any(), anyBoolean(), any(Message.class)); } @Test public void testNotifyDataDisconnected() { // Verify notify data disconnected on DCT constructor, initialized in setUp() ArgumentCaptor<PreciseDataConnectionState> captor = ArgumentCaptor.forClass(PreciseDataConnectionState.class); verify(mPhone, times(13)).notifyDataConnection(captor.capture()); for (PreciseDataConnectionState state : captor.getAllValues()) { assertEquals(TelephonyManager.DATA_DISCONNECTED, state.getState()); } } } Loading
src/java/com/android/internal/telephony/dataconnection/DcTracker.java +14 −3 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ import android.telephony.CellLocation; import android.telephony.DataFailCause; import android.telephony.NetworkRegistrationInfo; import android.telephony.PcoData; import android.telephony.PreciseDataConnectionState; import android.telephony.ServiceState; import android.telephony.ServiceState.RilRadioTechnology; import android.telephony.SubscriptionManager; Loading Loading @@ -1080,11 +1081,21 @@ public class DcTracker extends Handler { for (ApnConfigType apnConfigType : types) { ApnContext apnContext = new ApnContext(mPhone, apnConfigType.getType(), mLogTag, this, apnConfigType.getPriority()); int bitmask = ApnSetting.getApnTypesBitmaskFromString(apnContext.getApnType()); mPrioritySortedApnContexts.add(apnContext); mApnContexts.put(apnContext.getApnType(), apnContext); mApnContextsByType.put(ApnSetting.getApnTypesBitmaskFromString(apnContext.getApnType()), apnContext); mApnContextsByType.put(bitmask, apnContext); // Notify listeners that all data is disconnected when DCT is initialized. // Once connections are established, DC will then notify that data is connected. // This is to prevent the case where the phone process crashed but we don't notify // listeners that data was disconnected, so they may be stuck in a connected state. mPhone.notifyDataConnection(new PreciseDataConnectionState.Builder() .setTransportType(mTransportType) .setState(TelephonyManager.DATA_DISCONNECTED) .setApnSetting(new ApnSetting.Builder() .setApnTypeBitmask(bitmask).buildWithoutCheck()) .setNetworkType(getDataRat()) .build()); log("initApnContexts: apnContext=" + ApnSetting.getApnTypeString( apnConfigType.getType())); } Loading
tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcTrackerTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ import android.telephony.AccessNetworkConstants; import android.telephony.AccessNetworkConstants.AccessNetworkType; import android.telephony.CarrierConfigManager; import android.telephony.NetworkRegistrationInfo; import android.telephony.PreciseDataConnectionState; import android.telephony.ServiceState; import android.telephony.SignalStrength; import android.telephony.SubscriptionInfo; Loading Loading @@ -2851,4 +2852,15 @@ public class DcTrackerTest extends TelephonyTest { anyInt(), any(DataProfile.class), anyBoolean(), anyBoolean(), anyInt(), any(), anyInt(), any(), any(), anyBoolean(), any(Message.class)); } @Test public void testNotifyDataDisconnected() { // Verify notify data disconnected on DCT constructor, initialized in setUp() ArgumentCaptor<PreciseDataConnectionState> captor = ArgumentCaptor.forClass(PreciseDataConnectionState.class); verify(mPhone, times(13)).notifyDataConnection(captor.capture()); for (PreciseDataConnectionState state : captor.getAllValues()) { assertEquals(TelephonyManager.DATA_DISCONNECTED, state.getState()); } } }