diff options
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 26 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/TelephonyProperties.java | 7 |
2 files changed, 32 insertions, 1 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 70796752be84..ea55a82cb8fe 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -361,7 +361,6 @@ public class TelephonyManager { } } - /** * Returns the number of phones available. * Returns 0 if none of voice, sms, data is not supported @@ -394,6 +393,31 @@ public class TelephonyManager { return phoneCount; } + /** + * + * Return how many phone / logical modem can be active simultaneously, in terms of device + * capability. + * For example, for a dual-SIM capable device, it always returns 2, even if only one logical + * modem / SIM is active (aka in single SIM mode). + * + * TODO: b/139642279 publicize and rename. + * @hide + */ + public static int getMaxPhoneCount() { + // TODO: b/139642279 when turning on this feature, remove dependency of + // PROPERTY_REBOOT_REQUIRED_ON_MODEM_CHANGE and always return result based on + // PROPERTY_MAX_ACTIVE_MODEMS. + String rebootRequired = SystemProperties.get( + TelephonyProperties.PROPERTY_REBOOT_REQUIRED_ON_MODEM_CHANGE); + if (rebootRequired.equals("false")) { + // If no reboot is required, return max possible active modems. + return SystemProperties.getInt( + TelephonyProperties.PROPERTY_MAX_ACTIVE_MODEMS, getDefault().getPhoneCount()); + } else { + return getDefault().getPhoneCount(); + } + } + /** {@hide} */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public static TelephonyManager from(Context context) { diff --git a/telephony/java/com/android/internal/telephony/TelephonyProperties.java b/telephony/java/com/android/internal/telephony/TelephonyProperties.java index ef4850716701..4e42c20d28db 100644 --- a/telephony/java/com/android/internal/telephony/TelephonyProperties.java +++ b/telephony/java/com/android/internal/telephony/TelephonyProperties.java @@ -234,4 +234,11 @@ public interface TelephonyProperties String DISPLAY_OPPORTUNISTIC_SUBSCRIPTION_CARRIER_TEXT_PROPERTY_NAME = "persist.radio.display_opportunistic_carrier"; + /** + * How many logical modems can be active simultaneously. For example, if a device is dual-SIM + * capable but currently only one SIM slot and one logical modem is active, this value is still + * two. + * Type: int + */ + static final String PROPERTY_MAX_ACTIVE_MODEMS = "ro.telephony.max.active.modems"; } |