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

Commit cd7617d5 authored by pkanwar's avatar pkanwar
Browse files

Provide an API to make USSD calls and read the responses.

Test: will be added in a subsequent CL.
Bug: 30973910
Change-Id: Ibf622e154f3f987be547f4f85e15891d4e382118
parent 7d4a354f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -38227,6 +38227,7 @@ package android.telephony {
    method public void listen(android.telephony.PhoneStateListener, int);
    method public java.lang.String sendEnvelopeWithStatus(java.lang.String);
    method public void sendUssdRequest(java.lang.String, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler);
    method public void sendUssdRequest(java.lang.String, int, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler);
    method public void setDataEnabled(boolean);
    method public boolean setLine1NumberForDisplay(java.lang.String, java.lang.String);
    method public boolean setOperatorBrandOverride(java.lang.String);
+1 −0
Original line number Diff line number Diff line
@@ -41452,6 +41452,7 @@ package android.telephony {
    method public boolean needsOtaServiceProvisioning();
    method public java.lang.String sendEnvelopeWithStatus(java.lang.String);
    method public void sendUssdRequest(java.lang.String, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler);
    method public void sendUssdRequest(java.lang.String, int, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler);
    method public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>);
    method public void setDataEnabled(boolean);
    method public void setDataEnabled(int, boolean);
+1 −0
Original line number Diff line number Diff line
@@ -38326,6 +38326,7 @@ package android.telephony {
    method public void listen(android.telephony.PhoneStateListener, int);
    method public java.lang.String sendEnvelopeWithStatus(java.lang.String);
    method public void sendUssdRequest(java.lang.String, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler);
    method public void sendUssdRequest(java.lang.String, int, android.telephony.TelephonyManager.OnReceiveUssdResponseCallback, android.os.Handler);
    method public void setDataEnabled(boolean);
    method public boolean setLine1NumberForDisplay(java.lang.String, java.lang.String);
    method public boolean setOperatorBrandOverride(java.lang.String);
+31 −17
Original line number Diff line number Diff line
@@ -5006,10 +5006,24 @@ public class TelephonyManager {

    /* <p>Requires permission:
     * @link android.Manifest.permission#CALL_PHONE}
     * @param ussdRequest the USSD command to be executed.
     * @param wrappedCallback receives a callback result.
     */
    @RequiresPermission(android.Manifest.permission.CALL_PHONE)
    public void sendUssdRequest(String ussdRequest,
                                final OnReceiveUssdResponseCallback callback, Handler handler) {
        sendUssdRequest(ussdRequest, getSubId(), callback, handler);
    }

   /* <p>Requires permission:
    * @link android.Manifest.permission#CALL_PHONE}
    * @param subId The subscription to use.
    * @param ussdRequest the USSD command to be executed.
    * @param wrappedCallback receives a callback result.
    */
    @RequiresPermission(android.Manifest.permission.CALL_PHONE)
    public void sendUssdRequest(String ussdRequest, int subId,
                                final OnReceiveUssdResponseCallback callback, Handler handler) {
        checkNotNull(callback, "OnReceiveUssdResponseCallback cannot be null.");

        ResultReceiver wrappedCallback = new ResultReceiver(handler) {
@@ -5031,7 +5045,7 @@ public class TelephonyManager {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                telephony.handleUssdRequest(ussdRequest, wrappedCallback);
                telephony.handleUssdRequest(subId, ussdRequest, wrappedCallback);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelephony#sendUSSDCode", e);
+2 −1
Original line number Diff line number Diff line
@@ -277,10 +277,11 @@ interface ITelephony {
    /**
     * Handles USSD commands.
     *
     * @param subId The subscription to use.
     * @param ussdRequest the USSD command to be executed.
     * @param wrappedCallback receives a callback result.
     */
    void handleUssdRequest(String ussdRequest, in ResultReceiver wrappedCallback);
    void handleUssdRequest(int subId, String ussdRequest, in ResultReceiver wrappedCallback);

    /**
     * Handles PIN MMI commands (PIN/PIN2/PUK/PUK2), which are initiated