Loading src/java/com/android/internal/telephony/PhoneSwitcher.java +109 −60 Original line number Diff line number Diff line Loading @@ -99,8 +99,19 @@ public class PhoneSwitcher extends Handler { 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_RESEND_DATA_ALLOWED = 106; private static final int EVENT_RADIO_CAPABILITY_CHANGED = 106; private static final int EVENT_PREFERRED_SUBSCRIPTION_CHANGED = 107; private static final int EVENT_RADIO_AVAILABLE = 108; // 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 // will be either HAL_COMMAND_ALLOW_DATA or HAL_COMMAND_ALLOW_DATA or HAL_COMMAND_UNKNOWN. private static final int HAL_COMMAND_UNKNOWN = 0; private static final int HAL_COMMAND_ALLOW_DATA = 1; private static final int HAL_COMMAND_PREFERRED_DATA = 2; private int mHalCommandToUse = HAL_COMMAND_UNKNOWN; private RadioConfig mRadioConfig; private final static int MAX_LOCAL_LOG_LINES = 30; Loading Loading @@ -138,6 +149,7 @@ public class PhoneSwitcher extends Handler { mLocalLog = null; mActivePhoneRegistrants = null; mNumPhones = 0; mRadioConfig = RadioConfig.getInstance(mContext); mPhoneStateListener = new PhoneStateListener(looper) { public void onPhoneCapabilityChanged(PhoneCapability capability) { onPhoneCapabilityChangedInternal(capability); Loading @@ -158,6 +170,7 @@ public class PhoneSwitcher extends Handler { mLocalLog = new LocalLog(MAX_LOCAL_LOG_LINES); mSubscriptionController = subscriptionController; mRadioConfig = RadioConfig.getInstance(mContext); mPhoneStateListener = new PhoneStateListener(looper) { public void onPhoneCapabilityChanged(PhoneCapability capability) { Loading @@ -181,6 +194,7 @@ public class PhoneSwitcher extends Handler { mCommandsInterfaces = cis; mCommandsInterfaces[0].registerForAvailable(this, EVENT_RADIO_AVAILABLE, null); try { tr.addOnSubscriptionsChangedListener(context.getOpPackageName(), mSubscriptionsChangedListener); Loading Loading @@ -255,14 +269,19 @@ public class PhoneSwitcher extends Handler { onEvaluate(REQUESTS_CHANGED, "emergencyToggle"); break; } case EVENT_RESEND_DATA_ALLOWED: { onResendDataAllowed(msg); case EVENT_RADIO_CAPABILITY_CHANGED: { resendRilCommands(msg); break; } case EVENT_PREFERRED_SUBSCRIPTION_CHANGED: { onEvaluate(REQUESTS_UNCHANGED, "preferredDataSubIdChanged"); break; } case EVENT_RADIO_AVAILABLE: { updateHalCommandToUse(); onEvaluate(REQUESTS_UNCHANGED, "EVENT_RADIO_AVAILABLE"); break; } } } Loading Loading @@ -334,8 +353,8 @@ public class PhoneSwitcher extends Handler { return; } // Check if preferred slotId is changed. boolean diffDetected = requestsChanged; // If we use HAL_COMMAND_PREFERRED_DATA, boolean diffDetected = mHalCommandToUse != HAL_COMMAND_PREFERRED_DATA && requestsChanged; // Check if user setting of default data sub is changed. final int dataSub = mSubscriptionController.getDefaultDataSubId(); Loading Loading @@ -366,7 +385,15 @@ public class PhoneSwitcher extends Handler { if (diffDetected) { log("evaluating due to " + sb.toString()); if (mHalCommandToUse == HAL_COMMAND_PREFERRED_DATA) { if (SubscriptionManager.isUsableSubIdValue(mPreferredDataPhoneId)) { mRadioConfig.setPreferredDataModem(mPreferredDataPhoneId, null); // Notify all registrants. for (int phoneId = 0; phoneId < mNumPhones; phoneId++) { mActivePhoneRegistrants[phoneId].notifyRegistrants(); } } } else { List<Integer> newActivePhones = new ArrayList<Integer>(); for (DcRequest dcRequest : mPrioritizedDcRequests) { Loading @@ -388,7 +415,7 @@ public class PhoneSwitcher extends Handler { } for (int phoneId = 0; phoneId < mNumPhones; phoneId++) { if (newActivePhones.contains(phoneId) == false) { if (!newActivePhones.contains(phoneId)) { deactivate(phoneId); } } Loading @@ -399,53 +426,58 @@ public class PhoneSwitcher extends Handler { } } } } private static class PhoneState { public volatile boolean active = false; public long lastRequested = 0; } private void deactivate(int phoneId) { PhoneState state = mPhoneStates[phoneId]; if (state.active == false) return; state.active = false; log("deactivate " + phoneId); state.lastRequested = System.currentTimeMillis(); // Skip ALLOW_DATA for single SIM device if (mNumPhones > 1) { mCommandsInterfaces[phoneId].setDataAllowed(false, null); private void activate(int phoneId) { switchPhone(phoneId, true); } mActivePhoneRegistrants[phoneId].notifyRegistrants(); private void deactivate(int phoneId) { switchPhone(phoneId, false); } private void activate(int phoneId) { private void switchPhone(int phoneId, boolean active) { PhoneState state = mPhoneStates[phoneId]; if (state.active == true) return; state.active = true; log("activate " + phoneId); if (state.active == active) return; 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(true, null); mCommandsInterfaces[phoneId].setDataAllowed(active, null); } } mActivePhoneRegistrants[phoneId].notifyRegistrants(); } // used when the modem may have been rebooted and we want to resend // setDataAllowed public void resendDataAllowed(int phoneId) { /** * Used when the modem may have been rebooted and we * want to resend setDataAllowed or setPreferredData */ public void onRadioCapChanged(int phoneId) { validatePhoneId(phoneId); Message msg = obtainMessage(EVENT_RESEND_DATA_ALLOWED); Message msg = obtainMessage(EVENT_RADIO_CAPABILITY_CHANGED); msg.arg1 = phoneId; msg.sendToTarget(); } private void onResendDataAllowed(Message msg) { private void resendRilCommands(Message msg) { final int phoneId = msg.arg1; if (mHalCommandToUse == HAL_COMMAND_ALLOW_DATA || mHalCommandToUse == HAL_COMMAND_UNKNOWN) { // Skip ALLOW_DATA for single SIM device if (mNumPhones > 1) { mCommandsInterfaces[phoneId].setDataAllowed(mPhoneStates[phoneId].active, null); } } else { mRadioConfig.setPreferredDataModem(mPreferredDataPhoneId, null); } } private void onPhoneCapabilityChangedInternal(PhoneCapability capability) { Loading Loading @@ -517,15 +549,27 @@ public class PhoneSwitcher extends Handler { } /** * Returns whether phone should handle default network requests. * Returns whether phone should handle network requests * that don't specify a subId. */ public boolean isActiveForDefaultRequests(int phoneId) { return isPhoneActive(phoneId) && phoneId == mPreferredDataPhoneId; public boolean shouldApplyUnspecifiedRequests(int phoneId) { validatePhoneId(phoneId); if (mHalCommandToUse == HAL_COMMAND_PREFERRED_DATA) { return phoneId == mPreferredDataPhoneId; } else { return mPhoneStates[phoneId].active && phoneId == mPreferredDataPhoneId; } } public boolean isPhoneActive(int phoneId) { /** * Returns whether phone should handle network requests * that specify a subId. */ public boolean shouldApplySpecifiedRequests(int phoneId) { validatePhoneId(phoneId); return mPhoneStates[phoneId].active; // If we use SET_PREFERRED_DATA, always apply specified network requests. Otherwise, // only apply network requests if the phone is active (dataAllowed). return mHalCommandToUse == HAL_COMMAND_PREFERRED_DATA || mPhoneStates[phoneId].active; } public void registerForActivePhoneSwitch(int phoneId, Handler h, int what, Object o) { Loading Loading @@ -559,6 +603,11 @@ public class PhoneSwitcher extends Handler { } } private void updateHalCommandToUse() { mHalCommandToUse = mRadioConfig.isSetPreferredDataCommandSupported() ? HAL_COMMAND_PREFERRED_DATA : HAL_COMMAND_ALLOW_DATA; } private void log(String l) { Rlog.d(LOG_TAG, l); mLocalLog.log(l); Loading src/java/com/android/internal/telephony/ProxyController.java +1 −1 Original line number Diff line number Diff line Loading @@ -454,7 +454,7 @@ public class ProxyController { logd("onNotificationRadioCapabilityChanged: phoneId=" + id + " status=SUCCESS"); mSetRadioAccessFamilyStatus[id] = SET_RC_STATUS_SUCCESS; // The modems may have been restarted and forgotten this mPhoneSwitcher.resendDataAllowed(id); mPhoneSwitcher.onRadioCapChanged(id); mPhones[id].radioCapabilityUpdated(rc); } Loading src/java/com/android/internal/telephony/RadioConfig.java +29 −2 Original line number Diff line number Diff line Loading @@ -17,8 +17,10 @@ package com.android.internal.telephony; import static com.android.internal.telephony.RILConstants.RADIO_NOT_AVAILABLE; import static com.android.internal.telephony.RILConstants.REQUEST_NOT_SUPPORTED; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SLOT_STATUS; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_LOGICAL_TO_PHYSICAL_SLOT_MAPPING; import static com.android.internal.telephony.RILConstants .RIL_REQUEST_SET_LOGICAL_TO_PHYSICAL_SLOT_MAPPING; import android.content.Context; import android.hardware.radio.V1_0.RadioResponseInfo; Loading Loading @@ -258,7 +260,32 @@ public class RadioConfig extends Handler { } /** * Wrapper function for IRadioConfig.getSimSlotsStatus(). * Wrapper function for IRadioConfig.setPreferredDataModem(int modemId). */ public void setPreferredDataModem(int modemId, Message result) { if (!isSetPreferredDataCommandSupported()) { if (result != null) { AsyncResult.forMessage(result, null, CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED)); result.sendToTarget(); } } // TODO: call radioConfigProxy.setPreferredDataModem when it's ready. } /** * @return whether current radio config version supports SET_PREFERRED_DATA_MODEM command. * If yes, we'll use RIL_REQUEST_SET_PREFERRED_DATA_MODEM to indicate which modem is preferred. * If not, we shall use RIL_REQUEST_ALLOW_DATA for on-demand PS attach / detach. * See PhoneSwitcher for more details. */ public boolean isSetPreferredDataCommandSupported() { // TODO: call radioConfigProxy.isSetPreferredDataCommandSupported when it's ready. return false; } /** * Wrapper function for IRadioConfig.setSimSlotsMapping(int32_t serial, vec<uint32_t> slotMap). */ public void setSimSlotsMapping(int[] physicalSlots, Message result) { IRadioConfig radioConfigProxy = getRadioConfigProxy(result); Loading src/java/com/android/internal/telephony/dataconnection/TelephonyNetworkFactory.java +3 −2 Original line number Diff line number Diff line Loading @@ -183,8 +183,9 @@ public class TelephonyNetworkFactory extends NetworkFactory { // apply or revoke requests if our active-ness changes private void onActivePhoneSwitch() { final boolean newIsActive = mPhoneSwitcher.isPhoneActive(mPhoneId); final boolean newIsActiveForDefault = mPhoneSwitcher.isActiveForDefaultRequests(mPhoneId); final boolean newIsActive = mPhoneSwitcher.shouldApplySpecifiedRequests(mPhoneId); final boolean newIsActiveForDefault = mPhoneSwitcher.shouldApplyUnspecifiedRequests(mPhoneId); String logString = "onActivePhoneSwitch(newIsActive " + newIsActive + ", " + "newIsActive " + newIsActiveForDefault + ")"; Loading tests/telephonytests/src/com/android/internal/telephony/PhoneSwitcherTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -103,13 +103,13 @@ public class PhoneSwitcherTest extends TelephonyTest { // verify nothing has been done while there are no inputs assertFalse("data allowed initially", mDataAllowed[0]); assertFalse("data allowed initially", mDataAllowed[0]); assertFalse("phone active initially", mPhoneSwitcher.isPhoneActive(0)); assertFalse("phone active initially", mPhoneSwitcher.shouldApplySpecifiedRequests(0)); NetworkRequest internetNetworkRequest = addInternetNetworkRequest(null, 50); waitABit(); assertFalse("data allowed after request", mDataAllowed[0]); assertFalse("phone active after request", mPhoneSwitcher.isPhoneActive(0)); assertFalse("phone active after request", mPhoneSwitcher.shouldApplySpecifiedRequests(0)); // not registered yet - shouldn't inc verify(mActivePhoneSwitchHandler, never()).sendMessageAtTime(any(), anyLong()); Loading Loading
src/java/com/android/internal/telephony/PhoneSwitcher.java +109 −60 Original line number Diff line number Diff line Loading @@ -99,8 +99,19 @@ public class PhoneSwitcher extends Handler { 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_RESEND_DATA_ALLOWED = 106; private static final int EVENT_RADIO_CAPABILITY_CHANGED = 106; private static final int EVENT_PREFERRED_SUBSCRIPTION_CHANGED = 107; private static final int EVENT_RADIO_AVAILABLE = 108; // 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 // will be either HAL_COMMAND_ALLOW_DATA or HAL_COMMAND_ALLOW_DATA or HAL_COMMAND_UNKNOWN. private static final int HAL_COMMAND_UNKNOWN = 0; private static final int HAL_COMMAND_ALLOW_DATA = 1; private static final int HAL_COMMAND_PREFERRED_DATA = 2; private int mHalCommandToUse = HAL_COMMAND_UNKNOWN; private RadioConfig mRadioConfig; private final static int MAX_LOCAL_LOG_LINES = 30; Loading Loading @@ -138,6 +149,7 @@ public class PhoneSwitcher extends Handler { mLocalLog = null; mActivePhoneRegistrants = null; mNumPhones = 0; mRadioConfig = RadioConfig.getInstance(mContext); mPhoneStateListener = new PhoneStateListener(looper) { public void onPhoneCapabilityChanged(PhoneCapability capability) { onPhoneCapabilityChangedInternal(capability); Loading @@ -158,6 +170,7 @@ public class PhoneSwitcher extends Handler { mLocalLog = new LocalLog(MAX_LOCAL_LOG_LINES); mSubscriptionController = subscriptionController; mRadioConfig = RadioConfig.getInstance(mContext); mPhoneStateListener = new PhoneStateListener(looper) { public void onPhoneCapabilityChanged(PhoneCapability capability) { Loading @@ -181,6 +194,7 @@ public class PhoneSwitcher extends Handler { mCommandsInterfaces = cis; mCommandsInterfaces[0].registerForAvailable(this, EVENT_RADIO_AVAILABLE, null); try { tr.addOnSubscriptionsChangedListener(context.getOpPackageName(), mSubscriptionsChangedListener); Loading Loading @@ -255,14 +269,19 @@ public class PhoneSwitcher extends Handler { onEvaluate(REQUESTS_CHANGED, "emergencyToggle"); break; } case EVENT_RESEND_DATA_ALLOWED: { onResendDataAllowed(msg); case EVENT_RADIO_CAPABILITY_CHANGED: { resendRilCommands(msg); break; } case EVENT_PREFERRED_SUBSCRIPTION_CHANGED: { onEvaluate(REQUESTS_UNCHANGED, "preferredDataSubIdChanged"); break; } case EVENT_RADIO_AVAILABLE: { updateHalCommandToUse(); onEvaluate(REQUESTS_UNCHANGED, "EVENT_RADIO_AVAILABLE"); break; } } } Loading Loading @@ -334,8 +353,8 @@ public class PhoneSwitcher extends Handler { return; } // Check if preferred slotId is changed. boolean diffDetected = requestsChanged; // If we use HAL_COMMAND_PREFERRED_DATA, boolean diffDetected = mHalCommandToUse != HAL_COMMAND_PREFERRED_DATA && requestsChanged; // Check if user setting of default data sub is changed. final int dataSub = mSubscriptionController.getDefaultDataSubId(); Loading Loading @@ -366,7 +385,15 @@ public class PhoneSwitcher extends Handler { if (diffDetected) { log("evaluating due to " + sb.toString()); if (mHalCommandToUse == HAL_COMMAND_PREFERRED_DATA) { if (SubscriptionManager.isUsableSubIdValue(mPreferredDataPhoneId)) { mRadioConfig.setPreferredDataModem(mPreferredDataPhoneId, null); // Notify all registrants. for (int phoneId = 0; phoneId < mNumPhones; phoneId++) { mActivePhoneRegistrants[phoneId].notifyRegistrants(); } } } else { List<Integer> newActivePhones = new ArrayList<Integer>(); for (DcRequest dcRequest : mPrioritizedDcRequests) { Loading @@ -388,7 +415,7 @@ public class PhoneSwitcher extends Handler { } for (int phoneId = 0; phoneId < mNumPhones; phoneId++) { if (newActivePhones.contains(phoneId) == false) { if (!newActivePhones.contains(phoneId)) { deactivate(phoneId); } } Loading @@ -399,53 +426,58 @@ public class PhoneSwitcher extends Handler { } } } } private static class PhoneState { public volatile boolean active = false; public long lastRequested = 0; } private void deactivate(int phoneId) { PhoneState state = mPhoneStates[phoneId]; if (state.active == false) return; state.active = false; log("deactivate " + phoneId); state.lastRequested = System.currentTimeMillis(); // Skip ALLOW_DATA for single SIM device if (mNumPhones > 1) { mCommandsInterfaces[phoneId].setDataAllowed(false, null); private void activate(int phoneId) { switchPhone(phoneId, true); } mActivePhoneRegistrants[phoneId].notifyRegistrants(); private void deactivate(int phoneId) { switchPhone(phoneId, false); } private void activate(int phoneId) { private void switchPhone(int phoneId, boolean active) { PhoneState state = mPhoneStates[phoneId]; if (state.active == true) return; state.active = true; log("activate " + phoneId); if (state.active == active) return; 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(true, null); mCommandsInterfaces[phoneId].setDataAllowed(active, null); } } mActivePhoneRegistrants[phoneId].notifyRegistrants(); } // used when the modem may have been rebooted and we want to resend // setDataAllowed public void resendDataAllowed(int phoneId) { /** * Used when the modem may have been rebooted and we * want to resend setDataAllowed or setPreferredData */ public void onRadioCapChanged(int phoneId) { validatePhoneId(phoneId); Message msg = obtainMessage(EVENT_RESEND_DATA_ALLOWED); Message msg = obtainMessage(EVENT_RADIO_CAPABILITY_CHANGED); msg.arg1 = phoneId; msg.sendToTarget(); } private void onResendDataAllowed(Message msg) { private void resendRilCommands(Message msg) { final int phoneId = msg.arg1; if (mHalCommandToUse == HAL_COMMAND_ALLOW_DATA || mHalCommandToUse == HAL_COMMAND_UNKNOWN) { // Skip ALLOW_DATA for single SIM device if (mNumPhones > 1) { mCommandsInterfaces[phoneId].setDataAllowed(mPhoneStates[phoneId].active, null); } } else { mRadioConfig.setPreferredDataModem(mPreferredDataPhoneId, null); } } private void onPhoneCapabilityChangedInternal(PhoneCapability capability) { Loading Loading @@ -517,15 +549,27 @@ public class PhoneSwitcher extends Handler { } /** * Returns whether phone should handle default network requests. * Returns whether phone should handle network requests * that don't specify a subId. */ public boolean isActiveForDefaultRequests(int phoneId) { return isPhoneActive(phoneId) && phoneId == mPreferredDataPhoneId; public boolean shouldApplyUnspecifiedRequests(int phoneId) { validatePhoneId(phoneId); if (mHalCommandToUse == HAL_COMMAND_PREFERRED_DATA) { return phoneId == mPreferredDataPhoneId; } else { return mPhoneStates[phoneId].active && phoneId == mPreferredDataPhoneId; } } public boolean isPhoneActive(int phoneId) { /** * Returns whether phone should handle network requests * that specify a subId. */ public boolean shouldApplySpecifiedRequests(int phoneId) { validatePhoneId(phoneId); return mPhoneStates[phoneId].active; // If we use SET_PREFERRED_DATA, always apply specified network requests. Otherwise, // only apply network requests if the phone is active (dataAllowed). return mHalCommandToUse == HAL_COMMAND_PREFERRED_DATA || mPhoneStates[phoneId].active; } public void registerForActivePhoneSwitch(int phoneId, Handler h, int what, Object o) { Loading Loading @@ -559,6 +603,11 @@ public class PhoneSwitcher extends Handler { } } private void updateHalCommandToUse() { mHalCommandToUse = mRadioConfig.isSetPreferredDataCommandSupported() ? HAL_COMMAND_PREFERRED_DATA : HAL_COMMAND_ALLOW_DATA; } private void log(String l) { Rlog.d(LOG_TAG, l); mLocalLog.log(l); Loading
src/java/com/android/internal/telephony/ProxyController.java +1 −1 Original line number Diff line number Diff line Loading @@ -454,7 +454,7 @@ public class ProxyController { logd("onNotificationRadioCapabilityChanged: phoneId=" + id + " status=SUCCESS"); mSetRadioAccessFamilyStatus[id] = SET_RC_STATUS_SUCCESS; // The modems may have been restarted and forgotten this mPhoneSwitcher.resendDataAllowed(id); mPhoneSwitcher.onRadioCapChanged(id); mPhones[id].radioCapabilityUpdated(rc); } Loading
src/java/com/android/internal/telephony/RadioConfig.java +29 −2 Original line number Diff line number Diff line Loading @@ -17,8 +17,10 @@ package com.android.internal.telephony; import static com.android.internal.telephony.RILConstants.RADIO_NOT_AVAILABLE; import static com.android.internal.telephony.RILConstants.REQUEST_NOT_SUPPORTED; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SLOT_STATUS; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_LOGICAL_TO_PHYSICAL_SLOT_MAPPING; import static com.android.internal.telephony.RILConstants .RIL_REQUEST_SET_LOGICAL_TO_PHYSICAL_SLOT_MAPPING; import android.content.Context; import android.hardware.radio.V1_0.RadioResponseInfo; Loading Loading @@ -258,7 +260,32 @@ public class RadioConfig extends Handler { } /** * Wrapper function for IRadioConfig.getSimSlotsStatus(). * Wrapper function for IRadioConfig.setPreferredDataModem(int modemId). */ public void setPreferredDataModem(int modemId, Message result) { if (!isSetPreferredDataCommandSupported()) { if (result != null) { AsyncResult.forMessage(result, null, CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED)); result.sendToTarget(); } } // TODO: call radioConfigProxy.setPreferredDataModem when it's ready. } /** * @return whether current radio config version supports SET_PREFERRED_DATA_MODEM command. * If yes, we'll use RIL_REQUEST_SET_PREFERRED_DATA_MODEM to indicate which modem is preferred. * If not, we shall use RIL_REQUEST_ALLOW_DATA for on-demand PS attach / detach. * See PhoneSwitcher for more details. */ public boolean isSetPreferredDataCommandSupported() { // TODO: call radioConfigProxy.isSetPreferredDataCommandSupported when it's ready. return false; } /** * Wrapper function for IRadioConfig.setSimSlotsMapping(int32_t serial, vec<uint32_t> slotMap). */ public void setSimSlotsMapping(int[] physicalSlots, Message result) { IRadioConfig radioConfigProxy = getRadioConfigProxy(result); Loading
src/java/com/android/internal/telephony/dataconnection/TelephonyNetworkFactory.java +3 −2 Original line number Diff line number Diff line Loading @@ -183,8 +183,9 @@ public class TelephonyNetworkFactory extends NetworkFactory { // apply or revoke requests if our active-ness changes private void onActivePhoneSwitch() { final boolean newIsActive = mPhoneSwitcher.isPhoneActive(mPhoneId); final boolean newIsActiveForDefault = mPhoneSwitcher.isActiveForDefaultRequests(mPhoneId); final boolean newIsActive = mPhoneSwitcher.shouldApplySpecifiedRequests(mPhoneId); final boolean newIsActiveForDefault = mPhoneSwitcher.shouldApplyUnspecifiedRequests(mPhoneId); String logString = "onActivePhoneSwitch(newIsActive " + newIsActive + ", " + "newIsActive " + newIsActiveForDefault + ")"; Loading
tests/telephonytests/src/com/android/internal/telephony/PhoneSwitcherTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -103,13 +103,13 @@ public class PhoneSwitcherTest extends TelephonyTest { // verify nothing has been done while there are no inputs assertFalse("data allowed initially", mDataAllowed[0]); assertFalse("data allowed initially", mDataAllowed[0]); assertFalse("phone active initially", mPhoneSwitcher.isPhoneActive(0)); assertFalse("phone active initially", mPhoneSwitcher.shouldApplySpecifiedRequests(0)); NetworkRequest internetNetworkRequest = addInternetNetworkRequest(null, 50); waitABit(); assertFalse("data allowed after request", mDataAllowed[0]); assertFalse("phone active after request", mPhoneSwitcher.isPhoneActive(0)); assertFalse("phone active after request", mPhoneSwitcher.shouldApplySpecifiedRequests(0)); // not registered yet - shouldn't inc verify(mActivePhoneSwitchHandler, never()).sendMessageAtTime(any(), anyLong()); Loading