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

Commit 5a435d58 authored by abdalkader's avatar abdalkader Committed by android-build-merger
Browse files

Merge "Send SMS over IMS regardless of SMS class"

am: 90bb0357

Change-Id: I3f3dfac71e67ae5620a23929579a2ef1621ce06b
parents fd2f6abf 90bb0357
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ public class ImsSmsDispatcher extends SMSDispatcher {
                } catch (ImsException e) {
                    Rlog.e(TAG, "Failed to acknowledgeSms(). Error: " + e.getMessage());
                }
            });
            }, true);
        }
    };

+26 −7
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ public class SmsDispatchersController extends Handler {
    }

    /**
     * Inject an SMS PDU into the android platform.
     * Inject an SMS PDU into the android platform only if it is class 1.
     *
     * @param pdu is the byte array of pdu to be injected into android telephony layer
     * @param format is the format of SMS pdu (3gpp or 3gpp2)
@@ -186,6 +186,22 @@ public class SmsDispatchersController extends Handler {
     */
    @VisibleForTesting
    public void injectSmsPdu(byte[] pdu, String format, SmsInjectionCallback callback) {
        injectSmsPdu(pdu, format, callback, false /* ignoreClass */);
    }

    /**
     * Inject an SMS PDU into the android platform.
     *
     * @param pdu is the byte array of pdu to be injected into android telephony layer
     * @param format is the format of SMS pdu (3gpp or 3gpp2)
     * @param callback if not NULL this callback is triggered when the message is successfully
     *                 received by the android telephony layer. This callback is triggered at
     *                 the same time an SMS received from radio is responded back.
     * @param ignoreClass if set to false, this method will inject class 1 sms only.
     */
    @VisibleForTesting
    public void injectSmsPdu(byte[] pdu, String format, SmsInjectionCallback callback,
            boolean ignoreClass) {
        Rlog.d(TAG, "SmsDispatchersController:injectSmsPdu");
        try {
            // TODO We need to decide whether we should allow injecting GSM(3gpp)
@@ -193,12 +209,15 @@ public class SmsDispatchersController extends Handler {
            android.telephony.SmsMessage msg =
                    android.telephony.SmsMessage.createFromPdu(pdu, format);

            // Only class 1 SMS are allowed to be injected.
            if (msg == null
                    || msg.getMessageClass() != android.telephony.SmsMessage.MessageClass.CLASS_1) {
            if (msg == null) {
                Rlog.e(TAG, "injectSmsPdu: createFromPdu returned null");
                callback.onSmsInjectedResult(Intents.RESULT_SMS_GENERIC_ERROR);
                return;
            }

            if (!ignoreClass
                    && msg.getMessageClass() != android.telephony.SmsMessage.MessageClass.CLASS_1) {
                Rlog.e(TAG, "injectSmsPdu: not class 1");
                callback.onSmsInjectedResult(Intents.RESULT_SMS_GENERIC_ERROR);
                return;
            }