Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e17c706 authored by Michele's avatar Michele
Browse files

Modified MultiSim APIs

Capitalize S in Multisim.
isMultiSimSupported should return three states, to describe the three possible cases
(hardware not supported, hardware supported but carrier restricted, available)

Bug: 128524079
Test: compilation
Change-Id: Icbd36f714c577a965d39336d54d7224c8c2c7cd2
Merged-In: Icbd36f714c577a965d39336d54d7224c8c2c7cd2
parent f6cbc2d5
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -43110,7 +43110,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();
@@ -43189,6 +43189,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
+1 −1
Original line number Diff line number Diff line
@@ -6420,7 +6420,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);
+41 −9
Original line number Diff line number Diff line
@@ -10509,24 +10509,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.
@@ -10534,20 +10562,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;
    }

    /**
+6 −3
Original line number Diff line number Diff line
@@ -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