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

Commit adb7ee97 authored by Michele Berionne's avatar Michele Berionne Committed by android-build-merger
Browse files

Merge "Add APIs to get/set if usage of multiple SIMs is restricted." am: 59133875

am: e01966e8

Change-Id: I383b701bff4c77596fad1d72929a5afcc5b0cf56
parents f6116ad4 e01966e8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -6315,6 +6315,7 @@ 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 @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging();
@@ -6331,6 +6332,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 boolean setRadio(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadioPower(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSimPowerState(int);
+48 −0
Original line number Diff line number Diff line
@@ -9800,4 +9800,52 @@ public class TelephonyManager {
        }
        return ret;
    }

    /**
     * Indicate if the user is allowed to use multiple SIM cards at the same time to register
     * on the network (e.g. Dual Standby or Dual Active) when the device supports it, or if the
     * usage is restricted. This API is used to prevent usage of multiple SIM card, based on
     * policies of the carrier.
     * <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
     * otherwise.
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
    public void setMultisimCarrierRestriction(boolean isMultisimCarrierRestricted) {
        try {
            ITelephony service = getITelephony();
            if (service != null) {
                service.setMultisimCarrierRestriction(isMultisimCarrierRestricted);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "setMultisimCarrierRestriction RemoteException", e);
        }
    }

    /**
     * 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.
     *
     * @return true if usage of multiple SIMs is restricted, false otherwise.
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    public boolean isMultisimCarrierRestricted() {
        try {
            ITelephony service = getITelephony();
            if (service != null) {
                return service.isMultisimCarrierRestricted();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "isMultisimCarrierRestricted RemoteException", e);
        }
        return true;
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -1825,4 +1825,16 @@ interface ITelephony {
     * Enable or disable a logical modem stack associated with the slotIndex.
     */
    boolean enableModemForSlot(int slotIndex, boolean enable);

    /**
     * Indicate if the enablement of multi SIM functionality is restricted.
     * @hide
     */
    void setMultisimCarrierRestriction(boolean isMultisimCarrierRestricted);

    /**
     * Returns if the usage of multiple SIM cards at the same time is restricted.
     * @hide
     */
    boolean isMultisimCarrierRestricted();
}