Loading core/java/android/net/MobileDataStateTracker.java +32 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.util.Slog; import com.android.internal.telephony.DctConstants; import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.msim.ITelephonyMSim; import com.android.internal.telephony.MSimConstants; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.util.AsyncChannel; Loading Loading @@ -253,6 +254,37 @@ public class MobileDataStateTracker extends BaseNetworkStateTracker { log("Broadcast received: " + intent.getAction() + " apnType=" + apnType); } if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { int dds = 0; final int subscription = intent.getIntExtra(MSimConstants.SUBSCRIPTION_KEY, MSimConstants.DEFAULT_SUBSCRIPTION); getPhoneService(false); /* * If the phone process has crashed in the past, we'll get a * RemoteException and need to re-reference the service. */ for (int retry = 0; retry < 2; retry++) { if (mMSimPhoneService == null) { loge("Ignoring get dds request because " + "MSim Phone Service is not available"); break; } try { dds = mMSimPhoneService.getPreferredDataSubscription(); } catch (RemoteException e) { if (retry == 0) getPhoneService(true); } } log(String.format("subscription=%s, dds=%s", subscription, dds)); if (subscription != dds) { log("ignore data connection state as sub:" + subscription + " is not current dds: " + dds); return; } } int oldSubtype = mNetworkInfo.getSubtype(); int newSubType = TelephonyManager.getDefault().getNetworkType(); String subTypeName = TelephonyManager.getDefault().getNetworkTypeName(); Loading services/java/com/android/server/MSimTelephonyRegistry.java +19 −9 Original line number Diff line number Diff line Loading @@ -317,8 +317,10 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub { } if ((events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) { try { if (r.subscription == subscription) { r.callback.onDataConnectionStateChanged(mDataConnectionState, mDataConnectionNetworkType); } } catch (RemoteException ex) { remove(r.binder); } Loading Loading @@ -532,7 +534,8 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub { public void notifyDataConnection(int state, boolean isDataConnectivityPossible, String reason, String apn, String apnType, LinkProperties linkProperties, LinkCapabilities linkCapabilities, int networkType, boolean roaming) { LinkCapabilities linkCapabilities, int networkType, boolean roaming, int subscription) { if (!checkNotifyPermission("notifyDataConnection()" )) { return; } Loading Loading @@ -578,8 +581,11 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub { + ", " + mDataConnectionNetworkType + ")"); } for (Record r : mRecords) { if ((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) { if (((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) && (r.subscription == subscription)) { try { Slog.d(TAG,"Notify data connection state changed on sub: " + subscription); r.callback.onDataConnectionStateChanged(mDataConnectionState, mDataConnectionNetworkType); } catch (RemoteException ex) { Loading @@ -591,10 +597,11 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub { } } broadcastDataConnectionStateChanged(state, isDataConnectivityPossible, reason, apn, apnType, linkProperties, linkCapabilities, roaming); apnType, linkProperties, linkCapabilities, roaming, subscription); } public void notifyDataConnectionFailed(String reason, String apnType) { public void notifyDataConnectionFailed(String reason, String apnType, int subscription) { if (!checkNotifyPermission("notifyDataConnectionFailed()")) { return; } Loading @@ -612,7 +619,7 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub { } } */ broadcastDataConnectionFailed(reason, apnType); broadcastDataConnectionFailed(reason, apnType, subscription); } public void notifyCellLocation(Bundle cellLocation, int subscription) { Loading Loading @@ -755,7 +762,7 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub { private void broadcastDataConnectionStateChanged(int state, boolean isDataConnectivityPossible, String reason, String apn, String apnType, LinkProperties linkProperties, LinkCapabilities linkCapabilities, boolean roaming) { LinkCapabilities linkCapabilities, boolean roaming, int subscription) { // Note: not reporting to the battery stats service here, because the // status bar takes care of that after taking into account all of the // required info. Loading @@ -782,15 +789,18 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub { intent.putExtra(PhoneConstants.DATA_APN_KEY, apn); intent.putExtra(PhoneConstants.DATA_APN_TYPE_KEY, apnType); intent.putExtra(MSimConstants.SUBSCRIPTION_KEY, subscription); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } private void broadcastDataConnectionFailed(String reason, String apnType) { private void broadcastDataConnectionFailed(String reason, String apnType, int subscription) { Intent intent = new Intent(TelephonyIntents.ACTION_DATA_CONNECTION_FAILED); intent.putExtra(PhoneConstants.FAILURE_REASON_KEY, reason); intent.putExtra(PhoneConstants.DATA_APN_TYPE_KEY, apnType); intent.putExtra(MSimConstants.SUBSCRIPTION_KEY, MSimTelephonyManager.getDefault().getPreferredDataSubscription()); intent.putExtra(MSimConstants.SUBSCRIPTION_KEY, subscription); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } Loading telephony/java/com/android/internal/telephony/ITelephonyRegistryMSim.aidl +3 −2 Original line number Diff line number Diff line Loading @@ -39,8 +39,9 @@ interface ITelephonyRegistryMSim { void notifyDataActivity(int state); void notifyDataConnection(int state, boolean isDataConnectivityPossible, String reason, String apn, String apnType, in LinkProperties linkProperties, in LinkCapabilities linkCapabilities, int networkType, boolean roaming); void notifyDataConnectionFailed(String reason, String apnType); in LinkCapabilities linkCapabilities, int networkType, boolean roaming, int subscription); void notifyDataConnectionFailed(String reason, String apnType, int subscription); void notifyCellLocation(in Bundle cellLocation, in int subscription); void notifyOtaspChanged(in int otaspMode); void notifyCellInfo(in List<CellInfo> cellInfo, in int subscription); Loading Loading
core/java/android/net/MobileDataStateTracker.java +32 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.util.Slog; import com.android.internal.telephony.DctConstants; import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.msim.ITelephonyMSim; import com.android.internal.telephony.MSimConstants; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.util.AsyncChannel; Loading Loading @@ -253,6 +254,37 @@ public class MobileDataStateTracker extends BaseNetworkStateTracker { log("Broadcast received: " + intent.getAction() + " apnType=" + apnType); } if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { int dds = 0; final int subscription = intent.getIntExtra(MSimConstants.SUBSCRIPTION_KEY, MSimConstants.DEFAULT_SUBSCRIPTION); getPhoneService(false); /* * If the phone process has crashed in the past, we'll get a * RemoteException and need to re-reference the service. */ for (int retry = 0; retry < 2; retry++) { if (mMSimPhoneService == null) { loge("Ignoring get dds request because " + "MSim Phone Service is not available"); break; } try { dds = mMSimPhoneService.getPreferredDataSubscription(); } catch (RemoteException e) { if (retry == 0) getPhoneService(true); } } log(String.format("subscription=%s, dds=%s", subscription, dds)); if (subscription != dds) { log("ignore data connection state as sub:" + subscription + " is not current dds: " + dds); return; } } int oldSubtype = mNetworkInfo.getSubtype(); int newSubType = TelephonyManager.getDefault().getNetworkType(); String subTypeName = TelephonyManager.getDefault().getNetworkTypeName(); Loading
services/java/com/android/server/MSimTelephonyRegistry.java +19 −9 Original line number Diff line number Diff line Loading @@ -317,8 +317,10 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub { } if ((events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) { try { if (r.subscription == subscription) { r.callback.onDataConnectionStateChanged(mDataConnectionState, mDataConnectionNetworkType); } } catch (RemoteException ex) { remove(r.binder); } Loading Loading @@ -532,7 +534,8 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub { public void notifyDataConnection(int state, boolean isDataConnectivityPossible, String reason, String apn, String apnType, LinkProperties linkProperties, LinkCapabilities linkCapabilities, int networkType, boolean roaming) { LinkCapabilities linkCapabilities, int networkType, boolean roaming, int subscription) { if (!checkNotifyPermission("notifyDataConnection()" )) { return; } Loading Loading @@ -578,8 +581,11 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub { + ", " + mDataConnectionNetworkType + ")"); } for (Record r : mRecords) { if ((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) { if (((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) && (r.subscription == subscription)) { try { Slog.d(TAG,"Notify data connection state changed on sub: " + subscription); r.callback.onDataConnectionStateChanged(mDataConnectionState, mDataConnectionNetworkType); } catch (RemoteException ex) { Loading @@ -591,10 +597,11 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub { } } broadcastDataConnectionStateChanged(state, isDataConnectivityPossible, reason, apn, apnType, linkProperties, linkCapabilities, roaming); apnType, linkProperties, linkCapabilities, roaming, subscription); } public void notifyDataConnectionFailed(String reason, String apnType) { public void notifyDataConnectionFailed(String reason, String apnType, int subscription) { if (!checkNotifyPermission("notifyDataConnectionFailed()")) { return; } Loading @@ -612,7 +619,7 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub { } } */ broadcastDataConnectionFailed(reason, apnType); broadcastDataConnectionFailed(reason, apnType, subscription); } public void notifyCellLocation(Bundle cellLocation, int subscription) { Loading Loading @@ -755,7 +762,7 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub { private void broadcastDataConnectionStateChanged(int state, boolean isDataConnectivityPossible, String reason, String apn, String apnType, LinkProperties linkProperties, LinkCapabilities linkCapabilities, boolean roaming) { LinkCapabilities linkCapabilities, boolean roaming, int subscription) { // Note: not reporting to the battery stats service here, because the // status bar takes care of that after taking into account all of the // required info. Loading @@ -782,15 +789,18 @@ class MSimTelephonyRegistry extends ITelephonyRegistryMSim.Stub { intent.putExtra(PhoneConstants.DATA_APN_KEY, apn); intent.putExtra(PhoneConstants.DATA_APN_TYPE_KEY, apnType); intent.putExtra(MSimConstants.SUBSCRIPTION_KEY, subscription); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } private void broadcastDataConnectionFailed(String reason, String apnType) { private void broadcastDataConnectionFailed(String reason, String apnType, int subscription) { Intent intent = new Intent(TelephonyIntents.ACTION_DATA_CONNECTION_FAILED); intent.putExtra(PhoneConstants.FAILURE_REASON_KEY, reason); intent.putExtra(PhoneConstants.DATA_APN_TYPE_KEY, apnType); intent.putExtra(MSimConstants.SUBSCRIPTION_KEY, MSimTelephonyManager.getDefault().getPreferredDataSubscription()); intent.putExtra(MSimConstants.SUBSCRIPTION_KEY, subscription); mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL); } Loading
telephony/java/com/android/internal/telephony/ITelephonyRegistryMSim.aidl +3 −2 Original line number Diff line number Diff line Loading @@ -39,8 +39,9 @@ interface ITelephonyRegistryMSim { void notifyDataActivity(int state); void notifyDataConnection(int state, boolean isDataConnectivityPossible, String reason, String apn, String apnType, in LinkProperties linkProperties, in LinkCapabilities linkCapabilities, int networkType, boolean roaming); void notifyDataConnectionFailed(String reason, String apnType); in LinkCapabilities linkCapabilities, int networkType, boolean roaming, int subscription); void notifyDataConnectionFailed(String reason, String apnType, int subscription); void notifyCellLocation(in Bundle cellLocation, in int subscription); void notifyOtaspChanged(in int otaspMode); void notifyCellInfo(in List<CellInfo> cellInfo, in int subscription); Loading