Merge "Add checks on multisim capabilities."

This commit is contained in:
Michele Berionne
2019-02-22 01:18:41 +00:00
committed by Gerrit Code Review
5 changed files with 21 additions and 19 deletions

View File

@@ -43089,6 +43089,7 @@ package android.telephony {
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.MODIFY_PHONE_STATE}) public boolean isDataEnabled();
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isDataRoamingEnabled();
method public boolean isHearingAidCompatibilitySupported();
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isMultisimSupported();
method public boolean isNetworkRoaming();
method public boolean isRttSupported();
method public boolean isSmsCapable();

View File

@@ -6369,7 +6369,6 @@ package android.telephony {
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isCurrentPotentialEmergencyNumber(@NonNull String);
method public boolean isDataConnectivityPossible();
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isIdle();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isMultisimCarrierRestricted();
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isOffhook();
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRadioOn();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isRebootRequiredForModemConfigChange();

View File

@@ -10219,24 +10219,25 @@ public class TelephonyManager {
/**
* Returns if the usage of multiple SIM cards at the same time to register on the network
* (e.g. Dual Standby or Dual Active) is restricted.
* (e.g. Dual Standby or Dual Active) is supported by the device and by the carrier.
*
* @return true if usage of multiple SIMs is restricted, false otherwise.
* <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
* or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
*
* @hide
* @return true if usage of multiple SIMs is supported, false otherwise.
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public boolean isMultisimCarrierRestricted() {
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
public boolean isMultisimSupported() {
try {
ITelephony service = getITelephony();
if (service != null) {
return service.isMultisimCarrierRestricted();
return service.isMultisimSupported(getOpPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "isMultisimCarrierRestricted RemoteException", e);
Log.e(TAG, "isMultisimSupported RemoteException", e);
}
return true;
return false;
}
/**
@@ -10272,8 +10273,8 @@ public class TelephonyManager {
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void switchMultiSimConfig(int numOfSims) {
//only proceed if multi-sim is not restricted
if (isMultisimCarrierRestricted()) {
Rlog.e(TAG, "switchMultiSimConfig not possible. It is restricted.");
if (!isMultisimSupported()) {
Rlog.e(TAG, "switchMultiSimConfig not possible. It is restricted or not supported.");
return;
}

View File

@@ -1826,10 +1826,12 @@ interface ITelephony {
void setMultisimCarrierRestriction(boolean isMultisimCarrierRestricted);
/**
* Returns if the usage of multiple SIM cards at the same time is restricted.
* @hide
* Returns if the usage of multiple SIM cards at the same time is supported.
*
* @param callingPackage The package making the call.
* @return true if multisim is supported, false otherwise.
*/
boolean isMultisimCarrierRestricted();
boolean isMultisimSupported(String callingPackage);
/**
* Switch configs to enable multi-sim or switch back to single-sim

View File

@@ -188,18 +188,17 @@ public interface TelephonyProperties
*/
static final String PROPERTY_IGNORE_NITZ = "telephony.test.ignore.nitz";
/**
/**
* Property to set multi sim feature.
* Type: String(dsds, dsda)
*/
static final String PROPERTY_MULTI_SIM_CONFIG = "persist.radio.multisim.config";
/**
/**
* Property to indicate if reboot is required when changing modems configurations
* Type: String(true, false) default is false; most devices don't need reboot
*/
String PROPERTY_REBOOT_REQUIRED_ON_MODEM_CHANGE =
"persist.radio.reboot_on_modem_change";
String PROPERTY_REBOOT_REQUIRED_ON_MODEM_CHANGE = "persist.radio.reboot_on_modem_change";
/**
* Property to store default subscription.