diff options
| author | 2019-09-17 12:02:19 -0700 | |
|---|---|---|
| committer | 2019-10-14 11:57:12 -0700 | |
| commit | 793928c33896ab153585497466d3aee81f327daa (patch) | |
| tree | fe157950aa2dc717b4db28717705a0a75b48296e | |
| parent | f6da74661c9249de75574df9d759a89af2209663 (diff) | |
Add APIs to return max possible active phones.
This is first step towards reboot free single SIM to DSDS switch. As
getPhoneCount returns active phone count based on current configuration,
getMaxPhoneCount (subject to renaming) will return max possible active
phones(logical modems).
Bug: 141023026
Test: manual
Change-Id: Icc6e7da7c065eb3f72ec85a99ccc148639c574da
Merged-In: Icc6e7da7c065eb3f72ec85a99ccc148639c574da
| -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 ee254d7d2b9f..020fe2e6c9dc 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -362,7 +362,6 @@ public class TelephonyManager { } } - /** * Returns the number of phones available. * Returns 0 if none of voice, sms, data is not supported @@ -395,6 +394,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 dd9b2421a333..bf5c0a18cc96 100644 --- a/telephony/java/com/android/internal/telephony/TelephonyProperties.java +++ b/telephony/java/com/android/internal/telephony/TelephonyProperties.java @@ -231,4 +231,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"; } |