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
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user