Merge "Modified MultiSim APIs"
diff --git a/api/current.txt b/api/current.txt
index 8f5dcaf..098d0e8 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -43121,7 +43121,7 @@
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 @@
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
diff --git a/api/system-current.txt b/api/system-current.txt
index 83f0cd2..97b210f 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -6410,7 +6410,7 @@
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);
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 279989c..bf8eb0f 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -10508,45 +10508,77 @@
* <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.
*
* <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;
}
/**
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 02a5bc8..cbb9b88 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -1911,15 +1911,18 @@
* 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