Loading proto/src/telephony.proto +7 −0 Original line number Diff line number Diff line Loading @@ -279,6 +279,9 @@ message TelephonyServiceState { // Current data radio technology optional RadioAccessTechnology data_rat = 6 [default = UNKNOWN]; // Current Channel Number optional int32 channel_number = 7; } // Radio access families Loading Loading @@ -1945,6 +1948,10 @@ message TelephonyCallSession { // This field is true for Conference Calls optional bool is_multiparty = 5; // Detailed cause code for CS Call failures // frameworks/base/telephony/java/android/telephony/PreciseDisconnectCause.java optional int32 precise_disconnect_cause = 6; } // Single Radio Voice Call Continuity(SRVCC) progress state Loading src/java/com/android/internal/telephony/CarrierResolver.java +7 −4 Original line number Diff line number Diff line Loading @@ -439,12 +439,15 @@ public class CarrierResolver extends Handler { cv.put(CarrierId.CARRIER_NAME, mCarrierName); mContext.getContentResolver().update( Telephony.CarrierId.getUriForSubscriptionId(mPhone.getSubId()), cv, null, null); } // during esim profile switch, there is no sim absent thus carrier id will persist and // might not trigger an update if switch profiles for the same carrier. thus always update // subscriptioninfo db to make sure we have correct carrier id set. if (SubscriptionManager.isValidSubscriptionId(mPhone.getSubId())) { // only persist carrier id to simInfo db when subId is valid. SubscriptionController.getInstance().setCarrierId(mCarrierId, mPhone.getSubId()); } } } private static CarrierMatchingRule makeCarrierMatchingRule(Cursor cursor) { String certs = cursor.getString( Loading src/java/com/android/internal/telephony/CarrierServicesSmsFilter.java +6 −1 Original line number Diff line number Diff line Loading @@ -238,6 +238,7 @@ public class CarrierServicesSmsFilter { @Override protected void onServiceReady(ICarrierMessagingService carrierMessagingService) { try { log("onServiceReady: calling filterSms"); carrierMessagingService.filterSms( new MessagePdu(Arrays.asList(mPdus)), mSmsFormat, mDestPort, mPhone.getSubId(), mSmsFilterCallback); Loading Loading @@ -270,6 +271,7 @@ public class CarrierServicesSmsFilter { */ @Override public void onFilterComplete(int result) { log("onFilterComplete called with result: " + result); // in the case that timeout has already passed and triggered, but the initial callback // is run afterwards, we should not follow through if (!mIsOnFilterCompleteCalled) { Loading Loading @@ -328,8 +330,10 @@ public class CarrierServicesSmsFilter { } //all onFilterCompletes called before timeout has triggered //remove the pending message log("onFilterComplete called successfully with result = " + result); log("onFilterComplete: called successfully with result = " + result); mCallbackTimeoutHandler.removeMessages(EVENT_ON_FILTER_COMPLETE_NOT_CALLED); } else { log("onFilterComplete: waiting for pending filters " + mNumPendingFilters); } } } Loading Loading @@ -365,6 +369,7 @@ public class CarrierServicesSmsFilter { private void handleFilterCallbacksTimeout() { for (CarrierSmsFilterCallback callback : mFilterAggregator.mCallbacks) { log("handleFilterCallbacksTimeout: calling onFilterComplete"); callback.onFilterComplete(CarrierMessagingService.RECEIVE_OPTIONS_DEFAULT); } } Loading src/java/com/android/internal/telephony/PhoneSwitcher.java +58 −38 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.net.NetworkFactory; import android.net.NetworkRequest; import android.net.NetworkSpecifier; import android.net.StringNetworkSpecifier; import android.os.AsyncResult; import android.os.Handler; import android.os.Looper; import android.os.Message; Loading Loading @@ -82,6 +83,7 @@ public class PhoneSwitcher extends Handler { private static final boolean VDBG = false; private static final int DEFAULT_NETWORK_CHANGE_TIMEOUT_MS = 5000; private static final int MODEM_COMMAND_RETRY_PERIOD_MS = 5000; private final List<DcRequest> mPrioritizedDcRequests = new ArrayList<DcRequest>(); private final RegistrantList mActivePhoneRegistrants; Loading @@ -105,12 +107,12 @@ public class PhoneSwitcher extends Handler { private int mMaxActivePhones; private static PhoneSwitcher sPhoneSwitcher = null; // Which non-opportunistic subscription is set as data subscription among all non-oppt // Which primary (non-opportunistic) subscription is set as data subscription among all primary // subscriptions. This value usually comes from user setting, and it's the subscription used for // Internet data if mOpptDataSubId is not set. private int mNonOpptDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; private int mPrimaryDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; // mOpptDataSubId must be an active subscription. If it's set, it overrides mNonOpptDataSubId // mOpptDataSubId must be an active subscription. If it's set, it overrides mPrimaryDataSubId // to be used for Internet data. private int mOpptDataSubId = SubscriptionManager.DEFAULT_SUBSCRIPTION_ID; Loading @@ -123,7 +125,7 @@ public class PhoneSwitcher extends Handler { // 1. In modem layer, which modem is DDS (preferred to have data traffic on) // 2. In TelephonyNetworkFactory, which subscription will apply default network requests, which // are requests without specifying a subId. // Corresponding phoneId after considering mOpptDataSubId, mNonOpptDataSubId and // Corresponding phoneId after considering mOpptDataSubId, mPrimaryDataSubId and // mPhoneIdInVoiceCall above. protected int mPreferredDataPhoneId = SubscriptionManager.INVALID_PHONE_INDEX; Loading @@ -132,17 +134,19 @@ public class PhoneSwitcher extends Handler { private ISetOpportunisticDataCallback mSetOpptSubCallback; private static final int EVENT_NON_OPPT_SUBSCRIPTION_CHANGED = 101; private static final int EVENT_PRIMARY_DATA_SUB_CHANGED = 101; private static final int EVENT_SUBSCRIPTION_CHANGED = 102; private static final int EVENT_REQUEST_NETWORK = 103; private static final int EVENT_RELEASE_NETWORK = 104; private static final int EVENT_EMERGENCY_TOGGLE = 105; private static final int EVENT_RADIO_CAPABILITY_CHANGED = 106; private static final int EVENT_OPPT_SUBSCRIPTION_CHANGED = 107; private static final int EVENT_OPPT_DATA_SUB_CHANGED = 107; private static final int EVENT_RADIO_AVAILABLE = 108; private static final int EVENT_PHONE_IN_CALL_CHANGED = 109; private static final int EVENT_NETWORK_VALIDATION_DONE = 110; private static final int EVENT_REMOVE_DEFAULT_NETWORK_CHANGE_CALLBACK = 111; private static final int EVENT_MODEM_COMMAND_DONE = 112; private static final int EVENT_MODEM_COMMAND_RETRY = 113; // Depending on version of IRadioConfig, we need to send either RIL_REQUEST_ALLOW_DATA if it's // 1.0, or RIL_REQUEST_SET_PREFERRED_DATA if it's 1.1 or later. So internally mHalCommandToUse Loading Loading @@ -284,7 +288,10 @@ public class PhoneSwitcher extends Handler { mCommandsInterfaces = cis; if (numPhones > 0) { mCommandsInterfaces[0].registerForAvailable(this, EVENT_RADIO_AVAILABLE, null); } try { tr.addOnSubscriptionsChangedListener(context.getOpPackageName(), mSubscriptionsChangedListener); Loading Loading @@ -326,7 +333,7 @@ public class PhoneSwitcher extends Handler { private final BroadcastReceiver mDefaultDataChangedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Message msg = PhoneSwitcher.this.obtainMessage(EVENT_NON_OPPT_SUBSCRIPTION_CHANGED); Message msg = PhoneSwitcher.this.obtainMessage(EVENT_PRIMARY_DATA_SUB_CHANGED); msg.sendToTarget(); } }; Loading @@ -347,8 +354,8 @@ public class PhoneSwitcher extends Handler { onEvaluate(REQUESTS_UNCHANGED, "subChanged"); break; } case EVENT_NON_OPPT_SUBSCRIPTION_CHANGED: { if (onEvaluate(REQUESTS_UNCHANGED, "non-oppt data subId changed")) { case EVENT_PRIMARY_DATA_SUB_CHANGED: { if (onEvaluate(REQUESTS_UNCHANGED, "primary data subId changed")) { logDataSwitchEvent(mOpptDataSubId, TelephonyEvent.EventState.EVENT_STATE_START, DataSwitch.Reason.DATA_SWITCH_REASON_MANUAL); Loading @@ -369,10 +376,11 @@ public class PhoneSwitcher extends Handler { break; } case EVENT_RADIO_CAPABILITY_CHANGED: { resendRilCommands(msg); final int phoneId = msg.arg1; sendRilCommands(phoneId); break; } case EVENT_OPPT_SUBSCRIPTION_CHANGED: { case EVENT_OPPT_DATA_SUB_CHANGED: { int subId = msg.arg1; boolean needValidation = (msg.arg2 == 1); ISetOpportunisticDataCallback callback = Loading Loading @@ -408,6 +416,21 @@ public class PhoneSwitcher extends Handler { removeDefaultNetworkChangeCallback(); break; } case EVENT_MODEM_COMMAND_DONE: { AsyncResult ar = (AsyncResult) msg.obj; if (ar != null && ar.exception != null) { int phoneId = (int) ar.userObj; log("Modem command failed. with exception " + ar.exception); sendMessageDelayed(Message.obtain(this, EVENT_MODEM_COMMAND_RETRY, phoneId), MODEM_COMMAND_RETRY_PERIOD_MS); } break; } case EVENT_MODEM_COMMAND_RETRY: { int phoneId = (int) msg.obj; log("Resend modem command on phone " + phoneId); sendRilCommands(phoneId); } } } Loading Loading @@ -531,11 +554,11 @@ public class PhoneSwitcher extends Handler { boolean diffDetected = mHalCommandToUse != HAL_COMMAND_PREFERRED_DATA && requestsChanged; // Check if user setting of default non-opportunistic data sub is changed. final int nonOpptDataSubId = mSubscriptionController.getDefaultDataSubId(); if (nonOpptDataSubId != mNonOpptDataSubId) { sb.append(" mNonOpptDataSubId ").append(mNonOpptDataSubId).append("->") .append(nonOpptDataSubId); mNonOpptDataSubId = nonOpptDataSubId; final int primaryDataSubId = mSubscriptionController.getDefaultDataSubId(); if (primaryDataSubId != mPrimaryDataSubId) { sb.append(" mPrimaryDataSubId ").append(mPrimaryDataSubId).append("->") .append(primaryDataSubId); mPrimaryDataSubId = primaryDataSubId; } // Check if phoneId to subId mapping is changed. Loading @@ -562,13 +585,12 @@ public class PhoneSwitcher extends Handler { log("evaluating due to " + sb.toString()); if (mHalCommandToUse == HAL_COMMAND_PREFERRED_DATA) { // With HAL_COMMAND_PREFERRED_DATA, all phones are assumed to allow PS attach. // So marking all phone as active. // So marking all phone as active, and the phone with mPreferredDataPhoneId // will send radioConfig command. for (int phoneId = 0; phoneId < mNumPhones; phoneId++) { activate(phoneId); } if (SubscriptionManager.isUsableSubIdValue(mPreferredDataPhoneId)) { mRadioConfig.setPreferredDataModem(mPreferredDataPhoneId, null); mPhoneStates[phoneId].active = true; } sendRilCommands(mPreferredDataPhoneId); } else { List<Integer> newActivePhones = new ArrayList<Integer>(); Loading Loading @@ -598,7 +620,7 @@ public class PhoneSwitcher extends Handler { } if (VDBG) { log("mNonOpptDataSubId = " + mNonOpptDataSubId); log("mPrimaryDataSubId = " + mPrimaryDataSubId); log("mOpptDataSubId = " + mOpptDataSubId); for (int i = 0; i < mNumPhones; i++) { log(" phone[" + i + "] using sub[" + mPhoneSubscriptions[i] + "]"); Loading Loading @@ -648,12 +670,7 @@ public class PhoneSwitcher extends Handler { state.active = active; log((active ? "activate " : "deactivate ") + phoneId); state.lastRequested = System.currentTimeMillis(); if (mHalCommandToUse == HAL_COMMAND_ALLOW_DATA || mHalCommandToUse == HAL_COMMAND_UNKNOWN) { // Skip ALLOW_DATA for single SIM device if (mNumPhones > 1) { mCommandsInterfaces[phoneId].setDataAllowed(active, null); } } sendRilCommands(phoneId); } /** Loading @@ -667,15 +684,18 @@ public class PhoneSwitcher extends Handler { msg.sendToTarget(); } private void resendRilCommands(Message msg) { final int phoneId = msg.arg1; private void sendRilCommands(int phoneId) { if (!SubscriptionManager.isValidPhoneId(phoneId) || phoneId >= mNumPhones) return; Message message = Message.obtain(this, EVENT_MODEM_COMMAND_DONE, phoneId); if (mHalCommandToUse == HAL_COMMAND_ALLOW_DATA || mHalCommandToUse == HAL_COMMAND_UNKNOWN) { // Skip ALLOW_DATA for single SIM device if (mNumPhones > 1) { mCommandsInterfaces[phoneId].setDataAllowed(isPhoneActive(phoneId), null); mCommandsInterfaces[phoneId].setDataAllowed(isPhoneActive(phoneId), message); } } else { mRadioConfig.setPreferredDataModem(mPreferredDataPhoneId, null); } else if (phoneId == mPreferredDataPhoneId) { // Only setPreferredDataModem if the phoneId equals to current mPreferredDataPhoneId. mRadioConfig.setPreferredDataModem(mPreferredDataPhoneId, message); } } Loading Loading @@ -746,7 +766,7 @@ public class PhoneSwitcher extends Handler { if (mSubscriptionController.isActiveSubId(mOpptDataSubId)) { return mOpptDataSubId; } else { return mNonOpptDataSubId; return mPrimaryDataSubId; } } Loading Loading @@ -863,7 +883,7 @@ public class PhoneSwitcher extends Handler { } // Set mOpptDataSubId back to DEFAULT_SUBSCRIPTION_ID. This will trigger // data switch to mNonOpptDataSubId. // data switch to mPrimaryDataSubId. setOpportunisticSubscriptionInternal(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID); sendSetOpptCallbackHelper(callback, SET_OPPORTUNISTIC_SUB_SUCCESS); } Loading Loading @@ -910,7 +930,7 @@ public class PhoneSwitcher extends Handler { ISetOpportunisticDataCallback callback) { log("Try set opportunistic data subscription to subId " + subId + (needValidation ? " with " : " without ") + "validation"); PhoneSwitcher.this.obtainMessage(EVENT_OPPT_SUBSCRIPTION_CHANGED, PhoneSwitcher.this.obtainMessage(EVENT_OPPT_DATA_SUB_CHANGED, subId, needValidation ? 1 : 0, callback).sendToTarget(); } Loading Loading @@ -943,7 +963,7 @@ public class PhoneSwitcher extends Handler { } private void logDataSwitchEvent(int subId, int state, int reason) { subId = subId == DEFAULT_SUBSCRIPTION_ID ? mNonOpptDataSubId : subId; subId = subId == DEFAULT_SUBSCRIPTION_ID ? mPrimaryDataSubId : subId; DataSwitch dataSwitch = new DataSwitch(); dataSwitch.state = state; dataSwitch.reason = reason; Loading src/java/com/android/internal/telephony/SmsController.java +7 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,13 @@ public class SmsController extends ISmsImplBase { return; } SubscriptionInfo info = getSubscriptionInfo(subId); long token = Binder.clearCallingIdentity(); SubscriptionInfo info; try { info = getSubscriptionInfo(subId); } finally { Binder.restoreCallingIdentity(token); } if (isBluetoothSubscription(info)) { sendBluetoothText(info, destAddr, text, sentIntent, deliveryIntent); } else { Loading Loading
proto/src/telephony.proto +7 −0 Original line number Diff line number Diff line Loading @@ -279,6 +279,9 @@ message TelephonyServiceState { // Current data radio technology optional RadioAccessTechnology data_rat = 6 [default = UNKNOWN]; // Current Channel Number optional int32 channel_number = 7; } // Radio access families Loading Loading @@ -1945,6 +1948,10 @@ message TelephonyCallSession { // This field is true for Conference Calls optional bool is_multiparty = 5; // Detailed cause code for CS Call failures // frameworks/base/telephony/java/android/telephony/PreciseDisconnectCause.java optional int32 precise_disconnect_cause = 6; } // Single Radio Voice Call Continuity(SRVCC) progress state Loading
src/java/com/android/internal/telephony/CarrierResolver.java +7 −4 Original line number Diff line number Diff line Loading @@ -439,12 +439,15 @@ public class CarrierResolver extends Handler { cv.put(CarrierId.CARRIER_NAME, mCarrierName); mContext.getContentResolver().update( Telephony.CarrierId.getUriForSubscriptionId(mPhone.getSubId()), cv, null, null); } // during esim profile switch, there is no sim absent thus carrier id will persist and // might not trigger an update if switch profiles for the same carrier. thus always update // subscriptioninfo db to make sure we have correct carrier id set. if (SubscriptionManager.isValidSubscriptionId(mPhone.getSubId())) { // only persist carrier id to simInfo db when subId is valid. SubscriptionController.getInstance().setCarrierId(mCarrierId, mPhone.getSubId()); } } } private static CarrierMatchingRule makeCarrierMatchingRule(Cursor cursor) { String certs = cursor.getString( Loading
src/java/com/android/internal/telephony/CarrierServicesSmsFilter.java +6 −1 Original line number Diff line number Diff line Loading @@ -238,6 +238,7 @@ public class CarrierServicesSmsFilter { @Override protected void onServiceReady(ICarrierMessagingService carrierMessagingService) { try { log("onServiceReady: calling filterSms"); carrierMessagingService.filterSms( new MessagePdu(Arrays.asList(mPdus)), mSmsFormat, mDestPort, mPhone.getSubId(), mSmsFilterCallback); Loading Loading @@ -270,6 +271,7 @@ public class CarrierServicesSmsFilter { */ @Override public void onFilterComplete(int result) { log("onFilterComplete called with result: " + result); // in the case that timeout has already passed and triggered, but the initial callback // is run afterwards, we should not follow through if (!mIsOnFilterCompleteCalled) { Loading Loading @@ -328,8 +330,10 @@ public class CarrierServicesSmsFilter { } //all onFilterCompletes called before timeout has triggered //remove the pending message log("onFilterComplete called successfully with result = " + result); log("onFilterComplete: called successfully with result = " + result); mCallbackTimeoutHandler.removeMessages(EVENT_ON_FILTER_COMPLETE_NOT_CALLED); } else { log("onFilterComplete: waiting for pending filters " + mNumPendingFilters); } } } Loading Loading @@ -365,6 +369,7 @@ public class CarrierServicesSmsFilter { private void handleFilterCallbacksTimeout() { for (CarrierSmsFilterCallback callback : mFilterAggregator.mCallbacks) { log("handleFilterCallbacksTimeout: calling onFilterComplete"); callback.onFilterComplete(CarrierMessagingService.RECEIVE_OPTIONS_DEFAULT); } } Loading
src/java/com/android/internal/telephony/PhoneSwitcher.java +58 −38 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.net.NetworkFactory; import android.net.NetworkRequest; import android.net.NetworkSpecifier; import android.net.StringNetworkSpecifier; import android.os.AsyncResult; import android.os.Handler; import android.os.Looper; import android.os.Message; Loading Loading @@ -82,6 +83,7 @@ public class PhoneSwitcher extends Handler { private static final boolean VDBG = false; private static final int DEFAULT_NETWORK_CHANGE_TIMEOUT_MS = 5000; private static final int MODEM_COMMAND_RETRY_PERIOD_MS = 5000; private final List<DcRequest> mPrioritizedDcRequests = new ArrayList<DcRequest>(); private final RegistrantList mActivePhoneRegistrants; Loading @@ -105,12 +107,12 @@ public class PhoneSwitcher extends Handler { private int mMaxActivePhones; private static PhoneSwitcher sPhoneSwitcher = null; // Which non-opportunistic subscription is set as data subscription among all non-oppt // Which primary (non-opportunistic) subscription is set as data subscription among all primary // subscriptions. This value usually comes from user setting, and it's the subscription used for // Internet data if mOpptDataSubId is not set. private int mNonOpptDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; private int mPrimaryDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; // mOpptDataSubId must be an active subscription. If it's set, it overrides mNonOpptDataSubId // mOpptDataSubId must be an active subscription. If it's set, it overrides mPrimaryDataSubId // to be used for Internet data. private int mOpptDataSubId = SubscriptionManager.DEFAULT_SUBSCRIPTION_ID; Loading @@ -123,7 +125,7 @@ public class PhoneSwitcher extends Handler { // 1. In modem layer, which modem is DDS (preferred to have data traffic on) // 2. In TelephonyNetworkFactory, which subscription will apply default network requests, which // are requests without specifying a subId. // Corresponding phoneId after considering mOpptDataSubId, mNonOpptDataSubId and // Corresponding phoneId after considering mOpptDataSubId, mPrimaryDataSubId and // mPhoneIdInVoiceCall above. protected int mPreferredDataPhoneId = SubscriptionManager.INVALID_PHONE_INDEX; Loading @@ -132,17 +134,19 @@ public class PhoneSwitcher extends Handler { private ISetOpportunisticDataCallback mSetOpptSubCallback; private static final int EVENT_NON_OPPT_SUBSCRIPTION_CHANGED = 101; private static final int EVENT_PRIMARY_DATA_SUB_CHANGED = 101; private static final int EVENT_SUBSCRIPTION_CHANGED = 102; private static final int EVENT_REQUEST_NETWORK = 103; private static final int EVENT_RELEASE_NETWORK = 104; private static final int EVENT_EMERGENCY_TOGGLE = 105; private static final int EVENT_RADIO_CAPABILITY_CHANGED = 106; private static final int EVENT_OPPT_SUBSCRIPTION_CHANGED = 107; private static final int EVENT_OPPT_DATA_SUB_CHANGED = 107; private static final int EVENT_RADIO_AVAILABLE = 108; private static final int EVENT_PHONE_IN_CALL_CHANGED = 109; private static final int EVENT_NETWORK_VALIDATION_DONE = 110; private static final int EVENT_REMOVE_DEFAULT_NETWORK_CHANGE_CALLBACK = 111; private static final int EVENT_MODEM_COMMAND_DONE = 112; private static final int EVENT_MODEM_COMMAND_RETRY = 113; // Depending on version of IRadioConfig, we need to send either RIL_REQUEST_ALLOW_DATA if it's // 1.0, or RIL_REQUEST_SET_PREFERRED_DATA if it's 1.1 or later. So internally mHalCommandToUse Loading Loading @@ -284,7 +288,10 @@ public class PhoneSwitcher extends Handler { mCommandsInterfaces = cis; if (numPhones > 0) { mCommandsInterfaces[0].registerForAvailable(this, EVENT_RADIO_AVAILABLE, null); } try { tr.addOnSubscriptionsChangedListener(context.getOpPackageName(), mSubscriptionsChangedListener); Loading Loading @@ -326,7 +333,7 @@ public class PhoneSwitcher extends Handler { private final BroadcastReceiver mDefaultDataChangedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Message msg = PhoneSwitcher.this.obtainMessage(EVENT_NON_OPPT_SUBSCRIPTION_CHANGED); Message msg = PhoneSwitcher.this.obtainMessage(EVENT_PRIMARY_DATA_SUB_CHANGED); msg.sendToTarget(); } }; Loading @@ -347,8 +354,8 @@ public class PhoneSwitcher extends Handler { onEvaluate(REQUESTS_UNCHANGED, "subChanged"); break; } case EVENT_NON_OPPT_SUBSCRIPTION_CHANGED: { if (onEvaluate(REQUESTS_UNCHANGED, "non-oppt data subId changed")) { case EVENT_PRIMARY_DATA_SUB_CHANGED: { if (onEvaluate(REQUESTS_UNCHANGED, "primary data subId changed")) { logDataSwitchEvent(mOpptDataSubId, TelephonyEvent.EventState.EVENT_STATE_START, DataSwitch.Reason.DATA_SWITCH_REASON_MANUAL); Loading @@ -369,10 +376,11 @@ public class PhoneSwitcher extends Handler { break; } case EVENT_RADIO_CAPABILITY_CHANGED: { resendRilCommands(msg); final int phoneId = msg.arg1; sendRilCommands(phoneId); break; } case EVENT_OPPT_SUBSCRIPTION_CHANGED: { case EVENT_OPPT_DATA_SUB_CHANGED: { int subId = msg.arg1; boolean needValidation = (msg.arg2 == 1); ISetOpportunisticDataCallback callback = Loading Loading @@ -408,6 +416,21 @@ public class PhoneSwitcher extends Handler { removeDefaultNetworkChangeCallback(); break; } case EVENT_MODEM_COMMAND_DONE: { AsyncResult ar = (AsyncResult) msg.obj; if (ar != null && ar.exception != null) { int phoneId = (int) ar.userObj; log("Modem command failed. with exception " + ar.exception); sendMessageDelayed(Message.obtain(this, EVENT_MODEM_COMMAND_RETRY, phoneId), MODEM_COMMAND_RETRY_PERIOD_MS); } break; } case EVENT_MODEM_COMMAND_RETRY: { int phoneId = (int) msg.obj; log("Resend modem command on phone " + phoneId); sendRilCommands(phoneId); } } } Loading Loading @@ -531,11 +554,11 @@ public class PhoneSwitcher extends Handler { boolean diffDetected = mHalCommandToUse != HAL_COMMAND_PREFERRED_DATA && requestsChanged; // Check if user setting of default non-opportunistic data sub is changed. final int nonOpptDataSubId = mSubscriptionController.getDefaultDataSubId(); if (nonOpptDataSubId != mNonOpptDataSubId) { sb.append(" mNonOpptDataSubId ").append(mNonOpptDataSubId).append("->") .append(nonOpptDataSubId); mNonOpptDataSubId = nonOpptDataSubId; final int primaryDataSubId = mSubscriptionController.getDefaultDataSubId(); if (primaryDataSubId != mPrimaryDataSubId) { sb.append(" mPrimaryDataSubId ").append(mPrimaryDataSubId).append("->") .append(primaryDataSubId); mPrimaryDataSubId = primaryDataSubId; } // Check if phoneId to subId mapping is changed. Loading @@ -562,13 +585,12 @@ public class PhoneSwitcher extends Handler { log("evaluating due to " + sb.toString()); if (mHalCommandToUse == HAL_COMMAND_PREFERRED_DATA) { // With HAL_COMMAND_PREFERRED_DATA, all phones are assumed to allow PS attach. // So marking all phone as active. // So marking all phone as active, and the phone with mPreferredDataPhoneId // will send radioConfig command. for (int phoneId = 0; phoneId < mNumPhones; phoneId++) { activate(phoneId); } if (SubscriptionManager.isUsableSubIdValue(mPreferredDataPhoneId)) { mRadioConfig.setPreferredDataModem(mPreferredDataPhoneId, null); mPhoneStates[phoneId].active = true; } sendRilCommands(mPreferredDataPhoneId); } else { List<Integer> newActivePhones = new ArrayList<Integer>(); Loading Loading @@ -598,7 +620,7 @@ public class PhoneSwitcher extends Handler { } if (VDBG) { log("mNonOpptDataSubId = " + mNonOpptDataSubId); log("mPrimaryDataSubId = " + mPrimaryDataSubId); log("mOpptDataSubId = " + mOpptDataSubId); for (int i = 0; i < mNumPhones; i++) { log(" phone[" + i + "] using sub[" + mPhoneSubscriptions[i] + "]"); Loading Loading @@ -648,12 +670,7 @@ public class PhoneSwitcher extends Handler { state.active = active; log((active ? "activate " : "deactivate ") + phoneId); state.lastRequested = System.currentTimeMillis(); if (mHalCommandToUse == HAL_COMMAND_ALLOW_DATA || mHalCommandToUse == HAL_COMMAND_UNKNOWN) { // Skip ALLOW_DATA for single SIM device if (mNumPhones > 1) { mCommandsInterfaces[phoneId].setDataAllowed(active, null); } } sendRilCommands(phoneId); } /** Loading @@ -667,15 +684,18 @@ public class PhoneSwitcher extends Handler { msg.sendToTarget(); } private void resendRilCommands(Message msg) { final int phoneId = msg.arg1; private void sendRilCommands(int phoneId) { if (!SubscriptionManager.isValidPhoneId(phoneId) || phoneId >= mNumPhones) return; Message message = Message.obtain(this, EVENT_MODEM_COMMAND_DONE, phoneId); if (mHalCommandToUse == HAL_COMMAND_ALLOW_DATA || mHalCommandToUse == HAL_COMMAND_UNKNOWN) { // Skip ALLOW_DATA for single SIM device if (mNumPhones > 1) { mCommandsInterfaces[phoneId].setDataAllowed(isPhoneActive(phoneId), null); mCommandsInterfaces[phoneId].setDataAllowed(isPhoneActive(phoneId), message); } } else { mRadioConfig.setPreferredDataModem(mPreferredDataPhoneId, null); } else if (phoneId == mPreferredDataPhoneId) { // Only setPreferredDataModem if the phoneId equals to current mPreferredDataPhoneId. mRadioConfig.setPreferredDataModem(mPreferredDataPhoneId, message); } } Loading Loading @@ -746,7 +766,7 @@ public class PhoneSwitcher extends Handler { if (mSubscriptionController.isActiveSubId(mOpptDataSubId)) { return mOpptDataSubId; } else { return mNonOpptDataSubId; return mPrimaryDataSubId; } } Loading Loading @@ -863,7 +883,7 @@ public class PhoneSwitcher extends Handler { } // Set mOpptDataSubId back to DEFAULT_SUBSCRIPTION_ID. This will trigger // data switch to mNonOpptDataSubId. // data switch to mPrimaryDataSubId. setOpportunisticSubscriptionInternal(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID); sendSetOpptCallbackHelper(callback, SET_OPPORTUNISTIC_SUB_SUCCESS); } Loading Loading @@ -910,7 +930,7 @@ public class PhoneSwitcher extends Handler { ISetOpportunisticDataCallback callback) { log("Try set opportunistic data subscription to subId " + subId + (needValidation ? " with " : " without ") + "validation"); PhoneSwitcher.this.obtainMessage(EVENT_OPPT_SUBSCRIPTION_CHANGED, PhoneSwitcher.this.obtainMessage(EVENT_OPPT_DATA_SUB_CHANGED, subId, needValidation ? 1 : 0, callback).sendToTarget(); } Loading Loading @@ -943,7 +963,7 @@ public class PhoneSwitcher extends Handler { } private void logDataSwitchEvent(int subId, int state, int reason) { subId = subId == DEFAULT_SUBSCRIPTION_ID ? mNonOpptDataSubId : subId; subId = subId == DEFAULT_SUBSCRIPTION_ID ? mPrimaryDataSubId : subId; DataSwitch dataSwitch = new DataSwitch(); dataSwitch.state = state; dataSwitch.reason = reason; Loading
src/java/com/android/internal/telephony/SmsController.java +7 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,13 @@ public class SmsController extends ISmsImplBase { return; } SubscriptionInfo info = getSubscriptionInfo(subId); long token = Binder.clearCallingIdentity(); SubscriptionInfo info; try { info = getSubscriptionInfo(subId); } finally { Binder.restoreCallingIdentity(token); } if (isBluetoothSubscription(info)) { sendBluetoothText(info, destAddr, text, sentIntent, deliveryIntent); } else { Loading