Loading src/java/com/android/internal/telephony/CommandsInterface.java +8 −0 Original line number Diff line number Diff line Loading @@ -2363,6 +2363,14 @@ public interface CommandsInterface { */ default void enableModem(boolean enable, Message result) {}; /** * Notify CommandsInterface that whether its corresponding slot is active or not. If not, * it means it has no RIL service or logical modem to connect to. * * @param active whether there's a matching active SIM slot. */ default void onSlotActiveStatusChange(boolean active) {} /** * Query whether logical modem is enabled or disabled * Loading src/java/com/android/internal/telephony/PhoneConfigurationManager.java +18 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,19 @@ public class PhoneConfigurationManager { return sInstance; } /** * Whether the phoneId has a corresponding active slot / logical modem. If a DSDS capable * device is in single SIM mode, phoneId=1 is valid but not active. * * TODO: b/139642279 combine with SubscriptionManager#isValidPhoneId when phone objects * are dynamically allocated instead of always based on getMaxPhoneCount. * @hide */ public static boolean isPhoneActive(int phoneId) { // Currently it simply depends on getPhoneCount. In future it can be generalized. return phoneId >= 0 && phoneId < TelephonyManager.getDefault().getPhoneCount(); } /** * Handler class to handle callbacks */ Loading Loading @@ -365,6 +378,11 @@ public class PhoneConfigurationManager { } else { log("setMultiSimProperties: Rebooting is not required to switch multi-sim config to " + finalMultiSimConfig); // Register to RIL service if needed. for (int i = 0; i < mPhones.length; i++) { Phone phone = mPhones[i]; phone.mCi.onSlotActiveStatusChange(isPhoneActive(i)); } } } Loading src/java/com/android/internal/telephony/RIL.java +11 −3 Original line number Diff line number Diff line Loading @@ -91,7 +91,6 @@ import android.telephony.Rlog; import android.telephony.ServiceState; import android.telephony.SignalStrength; import android.telephony.SmsManager; import android.telephony.SubscriptionManager; import android.telephony.TelephonyHistogram; import android.telephony.TelephonyManager; import android.telephony.TelephonyManager.PrefNetworkMode; Loading Loading @@ -414,7 +413,7 @@ public class RIL extends BaseCommands implements CommandsInterface { /** Returns a {@link IRadio} instance or null if the service is not available. */ @VisibleForTesting public synchronized IRadio getRadioProxy(Message result) { if (!SubscriptionManager.isActivePhoneId(mPhoneId)) return null; if (!PhoneConfigurationManager.isPhoneActive(mPhoneId)) return null; if (!mIsMobileNetworkSupported) { if (RILJ_LOGV) riljLog("getRadioProxy: Not calling getService(): wifi-only"); if (result != null) { Loading Loading @@ -505,10 +504,19 @@ public class RIL extends BaseCommands implements CommandsInterface { return mRadioProxy; } @Override public synchronized void onSlotActiveStatusChange(boolean active) { if (active) { // Try to connect to RIL services and set response functions. getRadioProxy(null); getOemHookProxy(null); } } /** Returns an {@link IOemHook} instance or null if the service is not available. */ @VisibleForTesting public synchronized IOemHook getOemHookProxy(Message result) { if (!SubscriptionManager.isActivePhoneId(mPhoneId)) return null; if (!PhoneConfigurationManager.isPhoneActive(mPhoneId)) return null; if (!mIsMobileNetworkSupported) { if (RILJ_LOGV) riljLog("getOemHookProxy: Not calling getService(): wifi-only"); if (result != null) { Loading Loading
src/java/com/android/internal/telephony/CommandsInterface.java +8 −0 Original line number Diff line number Diff line Loading @@ -2363,6 +2363,14 @@ public interface CommandsInterface { */ default void enableModem(boolean enable, Message result) {}; /** * Notify CommandsInterface that whether its corresponding slot is active or not. If not, * it means it has no RIL service or logical modem to connect to. * * @param active whether there's a matching active SIM slot. */ default void onSlotActiveStatusChange(boolean active) {} /** * Query whether logical modem is enabled or disabled * Loading
src/java/com/android/internal/telephony/PhoneConfigurationManager.java +18 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,19 @@ public class PhoneConfigurationManager { return sInstance; } /** * Whether the phoneId has a corresponding active slot / logical modem. If a DSDS capable * device is in single SIM mode, phoneId=1 is valid but not active. * * TODO: b/139642279 combine with SubscriptionManager#isValidPhoneId when phone objects * are dynamically allocated instead of always based on getMaxPhoneCount. * @hide */ public static boolean isPhoneActive(int phoneId) { // Currently it simply depends on getPhoneCount. In future it can be generalized. return phoneId >= 0 && phoneId < TelephonyManager.getDefault().getPhoneCount(); } /** * Handler class to handle callbacks */ Loading Loading @@ -365,6 +378,11 @@ public class PhoneConfigurationManager { } else { log("setMultiSimProperties: Rebooting is not required to switch multi-sim config to " + finalMultiSimConfig); // Register to RIL service if needed. for (int i = 0; i < mPhones.length; i++) { Phone phone = mPhones[i]; phone.mCi.onSlotActiveStatusChange(isPhoneActive(i)); } } } Loading
src/java/com/android/internal/telephony/RIL.java +11 −3 Original line number Diff line number Diff line Loading @@ -91,7 +91,6 @@ import android.telephony.Rlog; import android.telephony.ServiceState; import android.telephony.SignalStrength; import android.telephony.SmsManager; import android.telephony.SubscriptionManager; import android.telephony.TelephonyHistogram; import android.telephony.TelephonyManager; import android.telephony.TelephonyManager.PrefNetworkMode; Loading Loading @@ -414,7 +413,7 @@ public class RIL extends BaseCommands implements CommandsInterface { /** Returns a {@link IRadio} instance or null if the service is not available. */ @VisibleForTesting public synchronized IRadio getRadioProxy(Message result) { if (!SubscriptionManager.isActivePhoneId(mPhoneId)) return null; if (!PhoneConfigurationManager.isPhoneActive(mPhoneId)) return null; if (!mIsMobileNetworkSupported) { if (RILJ_LOGV) riljLog("getRadioProxy: Not calling getService(): wifi-only"); if (result != null) { Loading Loading @@ -505,10 +504,19 @@ public class RIL extends BaseCommands implements CommandsInterface { return mRadioProxy; } @Override public synchronized void onSlotActiveStatusChange(boolean active) { if (active) { // Try to connect to RIL services and set response functions. getRadioProxy(null); getOemHookProxy(null); } } /** Returns an {@link IOemHook} instance or null if the service is not available. */ @VisibleForTesting public synchronized IOemHook getOemHookProxy(Message result) { if (!SubscriptionManager.isActivePhoneId(mPhoneId)) return null; if (!PhoneConfigurationManager.isPhoneActive(mPhoneId)) return null; if (!mIsMobileNetworkSupported) { if (RILJ_LOGV) riljLog("getOemHookProxy: Not calling getService(): wifi-only"); if (result != null) { Loading