Merge "Modified MultiSim APIs"

This commit is contained in:
Michele Berionne
2019-03-21 18:53:11 +00:00
committed by Gerrit Code Review
4 changed files with 52 additions and 14 deletions

View File

@@ -43121,7 +43121,7 @@ package android.telephony {
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isDataRoamingEnabled();
method public boolean isEmergencyNumber(@NonNull String);
method public boolean isHearingAidCompatibilitySupported();
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isMultisimSupported();
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int isMultiSimSupported();
method public boolean isNetworkRoaming();
method public boolean isRttSupported();
method public boolean isSmsCapable();
@@ -43200,6 +43200,9 @@ 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 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
field public static final int NETWORK_TYPE_1xRTT = 7; // 0x7
field public static final int NETWORK_TYPE_CDMA = 4; // 0x4
field public static final int NETWORK_TYPE_EDGE = 2; // 0x2

View File

@@ -6410,7 +6410,7 @@ package android.telephony {
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataActivationState(int);
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(int, boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataRoamingEnabled(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMultisimCarrierRestriction(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMultiSimCarrierRestriction(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmask(long);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadio(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadioPower(boolean);

View File

@@ -10508,24 +10508,52 @@ public class TelephonyManager {
* <p>Note: the API does not prevent access to the SIM cards for operations that don't require
* access to the network.
*
* @param isMultisimCarrierRestricted true if usage of multiple SIMs is restricted, false
* @param isMultiSimCarrierRestricted true if usage of multiple SIMs is restricted, false
* otherwise.
*
* @hide
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void setMultisimCarrierRestriction(boolean isMultisimCarrierRestricted) {
public void setMultiSimCarrierRestriction(boolean isMultiSimCarrierRestricted) {
try {
ITelephony service = getITelephony();
if (service != null) {
service.setMultisimCarrierRestriction(isMultisimCarrierRestricted);
service.setMultiSimCarrierRestriction(isMultiSimCarrierRestricted);
}
} catch (RemoteException e) {
Log.e(TAG, "setMultisimCarrierRestriction RemoteException", e);
Log.e(TAG, "setMultiSimCarrierRestriction RemoteException", e);
}
}
/**
* The usage of multiple SIM cards at the same time to register on the network (e.g. Dual
* Standby or Dual Active) is supported.
*/
public static final int MULTISIM_ALLOWED = 0;
/**
* The usage of multiple SIM cards at the same time to register on the network (e.g. Dual
* Standby or Dual Active) is not supported by the hardware.
*/
public static final int MULTISIM_NOT_SUPPORTED_BY_HARDWARE = 1;
/**
* The usage of multiple SIM cards at the same time to register on the network (e.g. Dual
* Standby or Dual Active) is supported by the hardware, but restricted by the carrier.
*/
public static final int MULTISIM_NOT_SUPPORTED_BY_CARRIER = 2;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"MULTISIM_"},
value = {
MULTISIM_ALLOWED,
MULTISIM_NOT_SUPPORTED_BY_HARDWARE,
MULTISIM_NOT_SUPPORTED_BY_CARRIER
})
public @interface IsMultiSimSupportedResult {}
/**
* 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 supported by the device and by the carrier.
@@ -10533,20 +10561,24 @@ public class TelephonyManager {
* <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
* or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
*
* @return true if usage of multiple SIMs is supported, false otherwise.
* @return {@link #MULTISIM_ALLOWED} if the device supports multiple SIMs.
* {@link #MULTISIM_NOT_SUPPORTED_BY_HARDWARE} if the device does not support multiple SIMs.
* {@link #MULTISIM_NOT_SUPPORTED_BY_CARRIER} in the device supports multiple SIMs, but the
* functionality is restricted by the carrier.
*/
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
public boolean isMultisimSupported() {
@IsMultiSimSupportedResult
public int isMultiSimSupported() {
try {
ITelephony service = getITelephony();
if (service != null) {
return service.isMultisimSupported(getOpPackageName());
return service.isMultiSimSupported(getOpPackageName());
}
} catch (RemoteException e) {
Log.e(TAG, "isMultisimSupported RemoteException", e);
Log.e(TAG, "isMultiSimSupported RemoteException", e);
}
return false;
return MULTISIM_NOT_SUPPORTED_BY_HARDWARE;
}
/**

View File

@@ -1911,15 +1911,18 @@ interface ITelephony {
* Indicate if the enablement of multi SIM functionality is restricted.
* @hide
*/
void setMultisimCarrierRestriction(boolean isMultisimCarrierRestricted);
void setMultiSimCarrierRestriction(boolean isMultiSimCarrierRestricted);
/**
* 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.
* @return {@link #MULTISIM_ALLOWED} if the device supports multiple SIMs.
* {@link #MULTISIM_NOT_SUPPORTED_BY_HARDWARE} if the device does not support multiple SIMs.
* {@link #MULTISIM_NOT_SUPPORTED_BY_CARRIER} in the device supports multiple SIMs, but the
* functionality is restricted by the carrier.
*/
boolean isMultisimSupported(String callingPackage);
int isMultiSimSupported(String callingPackage);
/**
* Switch configs to enable multi-sim or switch back to single-sim