Merge changes from topic "getDeviceCapableModemCount"

am: 8ed3fb4bcf

Change-Id: I092ecb302852b4814fcef58084764e84bede154e
This commit is contained in:
Xiangyu/Malcolm Chen
2019-10-29 16:09:15 -07:00
committed by android-build-merger
6 changed files with 55 additions and 23 deletions

View File

@@ -44970,6 +44970,7 @@ package android.telephony {
method @Nullable public android.telephony.TelephonyManager createForPhoneAccountHandle(android.telecom.PhoneAccountHandle); method @Nullable public android.telephony.TelephonyManager createForPhoneAccountHandle(android.telecom.PhoneAccountHandle);
method public android.telephony.TelephonyManager createForSubscriptionId(int); method public android.telephony.TelephonyManager createForSubscriptionId(int);
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean doesSwitchMultiSimConfigTriggerReboot(); 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 @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public java.util.List<android.telephony.CellInfo> getAllCellInfo();
method public int getCallState(); method public int getCallState();
method public int getCardIdForDefaultEuicc(); method public int getCardIdForDefaultEuicc();
@@ -45002,7 +45003,7 @@ package android.telephony {
method public String getNetworkOperatorName(); method public String getNetworkOperatorName();
method public String getNetworkSpecifier(); method public String getNetworkSpecifier();
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getNetworkType(); 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 public int getPhoneType();
method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PHONE_STATE}) public int getPreferredOpportunisticDataSubscription(); 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(); 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();
method public int getSimState(int); method public int getSimState(int);
method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getSubscriberId(); 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();
method @Nullable public String getTypeAllocationCode(int); method @Nullable public String getTypeAllocationCode(int);
method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") @NonNull public java.util.List<android.telephony.UiccCardInfo> getUiccCardsInfo(); method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") @NonNull public java.util.List<android.telephony.UiccCardInfo> getUiccCardsInfo();
@@ -45122,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_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 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 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_ALLOWED = 0; // 0x0
field public static final int MULTISIM_NOT_SUPPORTED_BY_CARRIER = 2; // 0x2 field public static final int MULTISIM_NOT_SUPPORTED_BY_CARRIER = 2; // 0x2
field public static final int MULTISIM_NOT_SUPPORTED_BY_HARDWARE = 1; // 0x1 field public static final int MULTISIM_NOT_SUPPORTED_BY_HARDWARE = 1; // 0x1

View File

@@ -172,7 +172,7 @@ public class CarrierTextController {
mSeparator = separator; mSeparator = separator;
mWakefulnessLifecycle = Dependency.get(WakefulnessLifecycle.class); mWakefulnessLifecycle = Dependency.get(WakefulnessLifecycle.class);
mSimSlotsNumber = ((TelephonyManager) context.getSystemService( mSimSlotsNumber = ((TelephonyManager) context.getSystemService(
Context.TELEPHONY_SERVICE)).getMaxPhoneCount(); Context.TELEPHONY_SERVICE)).getSupportedModemCount();
mSimErrorState = new boolean[mSimSlotsNumber]; mSimErrorState = new boolean[mSimSlotsNumber];
updateDisplayOpportunisticSubscriptionCarrierText(SystemProperties.getBoolean( updateDisplayOpportunisticSubscriptionCarrierText(SystemProperties.getBoolean(
TelephonyProperties.DISPLAY_OPPORTUNISTIC_SUBSCRIPTION_CARRIER_TEXT_PROPERTY_NAME, TelephonyProperties.DISPLAY_OPPORTUNISTIC_SUBSCRIPTION_CARRIER_TEXT_PROPERTY_NAME,

View File

@@ -119,7 +119,7 @@ public class CarrierTextControllerTest extends SysuiTestCase {
mCarrierTextCallbackInfo = new CarrierTextController.CarrierTextCallbackInfo("", mCarrierTextCallbackInfo = new CarrierTextController.CarrierTextCallbackInfo("",
new CharSequence[]{}, false, new int[]{}); new CharSequence[]{}, false, new int[]{});
when(mTelephonyManager.getMaxPhoneCount()).thenReturn(3); when(mTelephonyManager.getSupportedModemCount()).thenReturn(3);
mCarrierTextController = new TestCarrierTextController(mContext, SEPARATOR, true, true, mCarrierTextController = new TestCarrierTextController(mContext, SEPARATOR, true, true,
mKeyguardUpdateMonitor); mKeyguardUpdateMonitor);

View File

@@ -382,7 +382,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mContext = context; mContext = context;
mBatteryStats = BatteryStatsService.getService(); mBatteryStats = BatteryStatsService.getService();
int numPhones = TelephonyManager.getDefault().getMaxPhoneCount(); int numPhones = TelephonyManager.getDefault().getSupportedModemCount();
if (DBG) log("TelephonyRegistry: ctor numPhones=" + numPhones); if (DBG) log("TelephonyRegistry: ctor numPhones=" + numPhones);
mNumPhones = numPhones; mNumPhones = numPhones;
mCallState = new int[numPhones]; mCallState = new int[numPhones];

View File

@@ -2095,13 +2095,13 @@ public class SubscriptionManager {
/** @hide */ /** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
public static boolean isValidSlotIndex(int slotIndex) { public static boolean isValidSlotIndex(int slotIndex) {
return slotIndex >= 0 && slotIndex < TelephonyManager.getDefault().getMaxPhoneCount(); return slotIndex >= 0 && slotIndex < TelephonyManager.getDefault().getSupportedModemCount();
} }
/** @hide */ /** @hide */
@UnsupportedAppUsage @UnsupportedAppUsage
public static boolean isValidPhoneId(int phoneId) { public static boolean isValidPhoneId(int phoneId) {
return phoneId >= 0 && phoneId < TelephonyManager.getDefault().getMaxPhoneCount(); return phoneId >= 0 && phoneId < TelephonyManager.getDefault().getSupportedModemCount();
} }
/** @hide */ /** @hide */

View File

@@ -288,6 +288,21 @@ public class TelephonyManager {
UNKNOWN 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 */ /** @hide */
@UnsupportedAppUsage @UnsupportedAppUsage
public TelephonyManager(Context context) { public TelephonyManager(Context context) {
@@ -365,12 +380,26 @@ public class TelephonyManager {
/** /**
* Returns the number of phones available. * Returns the number of phones available.
* Returns 0 if none of voice, sms, data is not supported * Returns 0 if none of voice, sms, data is not supported
* Returns 1 for Single standby mode (Single SIM functionality) * Returns 1 for Single standby mode (Single SIM functionality).
* Returns 2 for Dual standby mode.(Dual SIM functionality) * Returns 2 for Dual standby mode (Dual SIM functionality).
* Returns 3 for Tri standby mode.(Tri SIM functionality) * Returns 3 for Tri standby mode (Tri SIM functionality).
* @deprecated Use {@link #getActiveModemCount} instead.
*/ */
@Deprecated
public int getPhoneCount() { 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()) { switch (getMultiSimConfiguration()) {
case UNKNOWN: case UNKNOWN:
ConnectivityManager cm = mContext == null ? null : (ConnectivityManager) mContext ConnectivityManager cm = mContext == null ? null : (ConnectivityManager) mContext
@@ -378,33 +407,30 @@ public class TelephonyManager {
// check for voice and data support, 0 if not supported // check for voice and data support, 0 if not supported
if (!isVoiceCapable() && !isSmsCapable() && cm != null if (!isVoiceCapable() && !isSmsCapable() && cm != null
&& !cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)) { && !cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)) {
phoneCount = 0; modemCount = MODEM_COUNT_NO_MODEM;
} else { } else {
phoneCount = 1; modemCount = MODEM_COUNT_SINGLE_MODEM;
} }
break; break;
case DSDS: case DSDS:
case DSDA: case DSDA:
phoneCount = PhoneConstants.MAX_PHONE_COUNT_DUAL_SIM; modemCount = MODEM_COUNT_DUAL_MODEM;
break; break;
case TSTS: case TSTS:
phoneCount = PhoneConstants.MAX_PHONE_COUNT_TRI_SIM; modemCount = MODEM_COUNT_TRI_MODEM;
break; break;
} }
return phoneCount; return modemCount;
} }
/** /**
* * Return how many logical modem can be potentially active simultaneously, in terms of hardware
* Return how many phone / logical modem can be active simultaneously, in terms of device
* capability. * capability.
* For example, for a dual-SIM capable device, it always returns 2, even if only one logical * It might return different value from {@link #getActiveModemCount}. For example, for a
* modem / SIM is active (aka in single SIM mode). * 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.
* TODO: b/139642279 publicize and rename.
* @hide
*/ */
public int getMaxPhoneCount() { public @ModemCount int getSupportedModemCount() {
// TODO: b/139642279 when turning on this feature, remove dependency of // TODO: b/139642279 when turning on this feature, remove dependency of
// PROPERTY_REBOOT_REQUIRED_ON_MODEM_CHANGE and always return result based on // PROPERTY_REBOOT_REQUIRED_ON_MODEM_CHANGE and always return result based on
// PROPERTY_MAX_ACTIVE_MODEMS. // PROPERTY_MAX_ACTIVE_MODEMS.