Merge changes from topic "getDeviceCapableModemCount"
* changes: Rename and publicize getMaxPhoneCount; and deprecate getPhoneCount. Add public intent ACTION_MULTI_SIM_CONFIG_CHANGED.
This commit is contained in:
@@ -44970,6 +44970,7 @@ package android.telephony {
|
||||
method @Nullable public android.telephony.TelephonyManager createForPhoneAccountHandle(android.telecom.PhoneAccountHandle);
|
||||
method public android.telephony.TelephonyManager createForSubscriptionId(int);
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean doesSwitchMultiSimConfigTriggerReboot();
|
||||
method public int getActiveModemCount();
|
||||
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public java.util.List<android.telephony.CellInfo> getAllCellInfo();
|
||||
method public int getCallState();
|
||||
method public int getCardIdForDefaultEuicc();
|
||||
@@ -45002,7 +45003,7 @@ package android.telephony {
|
||||
method public String getNetworkOperatorName();
|
||||
method public String getNetworkSpecifier();
|
||||
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getNetworkType();
|
||||
method public int getPhoneCount();
|
||||
method @Deprecated public int getPhoneCount();
|
||||
method public int getPhoneType();
|
||||
method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PHONE_STATE}) public int getPreferredOpportunisticDataSubscription();
|
||||
method @RequiresPermission(allOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.ACCESS_COARSE_LOCATION}) public android.telephony.ServiceState getServiceState();
|
||||
@@ -45018,6 +45019,7 @@ package android.telephony {
|
||||
method public int getSimState();
|
||||
method public int getSimState(int);
|
||||
method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getSubscriberId();
|
||||
method public int getSupportedModemCount();
|
||||
method @Nullable public String getTypeAllocationCode();
|
||||
method @Nullable public String getTypeAllocationCode(int);
|
||||
method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") @NonNull public java.util.List<android.telephony.UiccCardInfo> getUiccCardsInfo();
|
||||
@@ -45070,6 +45072,7 @@ package android.telephony {
|
||||
method public void updateAvailableNetworks(@NonNull java.util.List<android.telephony.AvailableNetworkInfo>, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
|
||||
field public static final String ACTION_CARRIER_MESSAGING_CLIENT_SERVICE = "android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE";
|
||||
field public static final String ACTION_CONFIGURE_VOICEMAIL = "android.telephony.action.CONFIGURE_VOICEMAIL";
|
||||
field public static final String ACTION_MULTI_SIM_CONFIG_CHANGED = "android.telephony.action.MULTI_SIM_CONFIG_CHANGED";
|
||||
field public static final String ACTION_NETWORK_COUNTRY_CHANGED = "android.telephony.action.NETWORK_COUNTRY_CHANGED";
|
||||
field @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public static final String ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE";
|
||||
field public static final String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE";
|
||||
@@ -45110,6 +45113,7 @@ package android.telephony {
|
||||
field public static final String EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT = "android.telephony.extra.LAUNCH_VOICEMAIL_SETTINGS_INTENT";
|
||||
field public static final String EXTRA_NETWORK_COUNTRY = "android.telephony.extra.NETWORK_COUNTRY";
|
||||
field public static final String EXTRA_NOTIFICATION_COUNT = "android.telephony.extra.NOTIFICATION_COUNT";
|
||||
field public static final String EXTRA_NUM_OF_ACTIVE_SIM_SUPPORTED = "android.telephony.extra.NUM_OF_ACTIVE_SIM_SUPPORTED";
|
||||
field public static final String EXTRA_PHONE_ACCOUNT_HANDLE = "android.telephony.extra.PHONE_ACCOUNT_HANDLE";
|
||||
field public static final String EXTRA_SPECIFIC_CARRIER_ID = "android.telephony.extra.SPECIFIC_CARRIER_ID";
|
||||
field public static final String EXTRA_SPECIFIC_CARRIER_NAME = "android.telephony.extra.SPECIFIC_CARRIER_NAME";
|
||||
@@ -45120,6 +45124,10 @@ package android.telephony {
|
||||
field public static final String EXTRA_SUBSCRIPTION_ID = "android.telephony.extra.SUBSCRIPTION_ID";
|
||||
field public static final String EXTRA_VOICEMAIL_NUMBER = "android.telephony.extra.VOICEMAIL_NUMBER";
|
||||
field public static final String METADATA_HIDE_VOICEMAIL_SETTINGS_MENU = "android.telephony.HIDE_VOICEMAIL_SETTINGS_MENU";
|
||||
field public static final int MODEM_COUNT_DUAL_MODEM = 2; // 0x2
|
||||
field public static final int MODEM_COUNT_NO_MODEM = 0; // 0x0
|
||||
field public static final int MODEM_COUNT_SINGLE_MODEM = 1; // 0x1
|
||||
field public static final int MODEM_COUNT_TRI_MODEM = 3; // 0x3
|
||||
field public static final int MULTISIM_ALLOWED = 0; // 0x0
|
||||
field public static final int MULTISIM_NOT_SUPPORTED_BY_CARRIER = 2; // 0x2
|
||||
field public static final int MULTISIM_NOT_SUPPORTED_BY_HARDWARE = 1; // 0x1
|
||||
|
||||
@@ -172,7 +172,7 @@ public class CarrierTextController {
|
||||
mSeparator = separator;
|
||||
mWakefulnessLifecycle = Dependency.get(WakefulnessLifecycle.class);
|
||||
mSimSlotsNumber = ((TelephonyManager) context.getSystemService(
|
||||
Context.TELEPHONY_SERVICE)).getMaxPhoneCount();
|
||||
Context.TELEPHONY_SERVICE)).getSupportedModemCount();
|
||||
mSimErrorState = new boolean[mSimSlotsNumber];
|
||||
updateDisplayOpportunisticSubscriptionCarrierText(SystemProperties.getBoolean(
|
||||
TelephonyProperties.DISPLAY_OPPORTUNISTIC_SUBSCRIPTION_CARRIER_TEXT_PROPERTY_NAME,
|
||||
|
||||
@@ -119,7 +119,7 @@ public class CarrierTextControllerTest extends SysuiTestCase {
|
||||
|
||||
mCarrierTextCallbackInfo = new CarrierTextController.CarrierTextCallbackInfo("",
|
||||
new CharSequence[]{}, false, new int[]{});
|
||||
when(mTelephonyManager.getMaxPhoneCount()).thenReturn(3);
|
||||
when(mTelephonyManager.getSupportedModemCount()).thenReturn(3);
|
||||
|
||||
mCarrierTextController = new TestCarrierTextController(mContext, SEPARATOR, true, true,
|
||||
mKeyguardUpdateMonitor);
|
||||
|
||||
@@ -382,7 +382,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
mContext = context;
|
||||
mBatteryStats = BatteryStatsService.getService();
|
||||
|
||||
int numPhones = TelephonyManager.getDefault().getMaxPhoneCount();
|
||||
int numPhones = TelephonyManager.getDefault().getSupportedModemCount();
|
||||
if (DBG) log("TelephonyRegistry: ctor numPhones=" + numPhones);
|
||||
mNumPhones = numPhones;
|
||||
mCallState = new int[numPhones];
|
||||
|
||||
@@ -2095,13 +2095,13 @@ public class SubscriptionManager {
|
||||
/** @hide */
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
|
||||
public static boolean isValidSlotIndex(int slotIndex) {
|
||||
return slotIndex >= 0 && slotIndex < TelephonyManager.getDefault().getMaxPhoneCount();
|
||||
return slotIndex >= 0 && slotIndex < TelephonyManager.getDefault().getSupportedModemCount();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@UnsupportedAppUsage
|
||||
public static boolean isValidPhoneId(int phoneId) {
|
||||
return phoneId >= 0 && phoneId < TelephonyManager.getDefault().getMaxPhoneCount();
|
||||
return phoneId >= 0 && phoneId < TelephonyManager.getDefault().getSupportedModemCount();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
|
||||
@@ -288,6 +288,21 @@ public class TelephonyManager {
|
||||
UNKNOWN
|
||||
};
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = {"MODEM_COUNT_"},
|
||||
value = {
|
||||
MODEM_COUNT_NO_MODEM,
|
||||
MODEM_COUNT_SINGLE_MODEM,
|
||||
MODEM_COUNT_DUAL_MODEM,
|
||||
MODEM_COUNT_TRI_MODEM
|
||||
})
|
||||
public @interface ModemCount {}
|
||||
|
||||
public static final int MODEM_COUNT_NO_MODEM = 0;
|
||||
public static final int MODEM_COUNT_SINGLE_MODEM = 1;
|
||||
public static final int MODEM_COUNT_DUAL_MODEM = 2;
|
||||
public static final int MODEM_COUNT_TRI_MODEM = 3;
|
||||
|
||||
/** @hide */
|
||||
@UnsupportedAppUsage
|
||||
public TelephonyManager(Context context) {
|
||||
@@ -365,12 +380,26 @@ public class TelephonyManager {
|
||||
/**
|
||||
* Returns the number of phones available.
|
||||
* Returns 0 if none of voice, sms, data is not supported
|
||||
* Returns 1 for Single standby mode (Single SIM functionality)
|
||||
* Returns 2 for Dual standby mode.(Dual SIM functionality)
|
||||
* Returns 3 for Tri standby mode.(Tri SIM functionality)
|
||||
* Returns 1 for Single standby mode (Single SIM functionality).
|
||||
* Returns 2 for Dual standby mode (Dual SIM functionality).
|
||||
* Returns 3 for Tri standby mode (Tri SIM functionality).
|
||||
* @deprecated Use {@link #getActiveModemCount} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getPhoneCount() {
|
||||
int phoneCount = 1;
|
||||
return getActiveModemCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of logical modems currently configured to be activated.
|
||||
*
|
||||
* Returns 0 if none of voice, sms, data is not supported
|
||||
* Returns 1 for Single standby mode (Single SIM functionality).
|
||||
* Returns 2 for Dual standby mode (Dual SIM functionality).
|
||||
* Returns 3 for Tri standby mode (Tri SIM functionality).
|
||||
*/
|
||||
public @ModemCount int getActiveModemCount() {
|
||||
int modemCount = 1;
|
||||
switch (getMultiSimConfiguration()) {
|
||||
case UNKNOWN:
|
||||
ConnectivityManager cm = mContext == null ? null : (ConnectivityManager) mContext
|
||||
@@ -378,33 +407,30 @@ public class TelephonyManager {
|
||||
// check for voice and data support, 0 if not supported
|
||||
if (!isVoiceCapable() && !isSmsCapable() && cm != null
|
||||
&& !cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)) {
|
||||
phoneCount = 0;
|
||||
modemCount = MODEM_COUNT_NO_MODEM;
|
||||
} else {
|
||||
phoneCount = 1;
|
||||
modemCount = MODEM_COUNT_SINGLE_MODEM;
|
||||
}
|
||||
break;
|
||||
case DSDS:
|
||||
case DSDA:
|
||||
phoneCount = PhoneConstants.MAX_PHONE_COUNT_DUAL_SIM;
|
||||
modemCount = MODEM_COUNT_DUAL_MODEM;
|
||||
break;
|
||||
case TSTS:
|
||||
phoneCount = PhoneConstants.MAX_PHONE_COUNT_TRI_SIM;
|
||||
modemCount = MODEM_COUNT_TRI_MODEM;
|
||||
break;
|
||||
}
|
||||
return phoneCount;
|
||||
return modemCount;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Return how many phone / logical modem can be active simultaneously, in terms of device
|
||||
* Return how many logical modem can be potentially active simultaneously, in terms of hardware
|
||||
* 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
|
||||
* It might return different value from {@link #getActiveModemCount}. For example, for a
|
||||
* dual-SIM capable device operating in single SIM mode (only one logical modem is turned on),
|
||||
* {@link #getActiveModemCount} returns 1 while this API returns 2.
|
||||
*/
|
||||
public int getMaxPhoneCount() {
|
||||
public @ModemCount int getSupportedModemCount() {
|
||||
// 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.
|
||||
@@ -1176,6 +1202,35 @@ public class TelephonyManager {
|
||||
public static final String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING =
|
||||
"android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING";
|
||||
|
||||
/**
|
||||
* Broadcast intent that indicates multi-SIM configuration is changed. For example, it changed
|
||||
* from single SIM capable to dual-SIM capable (DSDS or DSDA) or triple-SIM mode.
|
||||
*
|
||||
* It doesn't indicate how many subscriptions are actually active, or which states SIMs are,
|
||||
* or that all steps during multi-SIM change are done. To know those information you still need
|
||||
* to listen to SIM_STATE changes or active subscription changes.
|
||||
*
|
||||
* See extra of {@link #EXTRA_NUM_OF_ACTIVE_SIM_SUPPORTED} for updated value.
|
||||
*/
|
||||
public static final String ACTION_MULTI_SIM_CONFIG_CHANGED =
|
||||
"android.telephony.action.MULTI_SIM_CONFIG_CHANGED";
|
||||
|
||||
|
||||
/**
|
||||
* The number of active SIM supported by current multi-SIM config. It's not related to how many
|
||||
* SIM/subscriptions are currently active.
|
||||
*
|
||||
* For single SIM mode, it's 1.
|
||||
* For DSDS or DSDA mode, it's 2.
|
||||
* For triple-SIM mode, it's 3.
|
||||
*
|
||||
* Extra of {@link #ACTION_MULTI_SIM_CONFIG_CHANGED}.
|
||||
*
|
||||
* type: integer
|
||||
*/
|
||||
public static final String EXTRA_NUM_OF_ACTIVE_SIM_SUPPORTED =
|
||||
"android.telephony.extra.NUM_OF_ACTIVE_SIM_SUPPORTED";
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user