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

Commit 3a831fda authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Use EVENT_NEW_SMS_STATUS_REPORT in common" am: 89fdda75

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1772930

Change-Id: Ie6517fc5e0a56b181d344d45d42f6bca46d897f5
parents 2908cad3 89fdda75
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -131,8 +131,8 @@ public abstract class SMSDispatcher extends Handler {
    /** Confirmation required for third-party apps sending to an SMS short code. */
    private static final int EVENT_CONFIRM_SEND_TO_PREMIUM_SHORT_CODE = 9;

    /** Handle status report from {@code CdmaInboundSmsHandler}. */
    protected static final int EVENT_HANDLE_STATUS_REPORT = 10;
    /** New status report received. */
    protected static final int EVENT_NEW_SMS_STATUS_REPORT = 10;

    // other
    protected static final int EVENT_NEW_ICC_SMS = 14;
@@ -247,9 +247,11 @@ public abstract class SMSDispatcher extends Handler {
    protected abstract String getFormat();

    /**
     * Pass the Message object to subclass to handle. Currently used to pass CDMA status reports
     * from {@link com.android.internal.telephony.cdma.CdmaInboundSmsHandler}.
     * @param o the SmsMessage containing the status report
     * Called when a status report is received. This should correspond to a previously successful
     * SEND.
     *
     * @param o AsyncResult object including a byte array for 3GPP status report PDU or SmsMessage
     *          object for 3GPP2 status report.
     */
    protected void handleStatusReport(Object o) {
        Rlog.d(TAG, "handleStatusReport() called with no subclass.");
@@ -333,7 +335,7 @@ public abstract class SMSDispatcher extends Handler {
            break;
        }

        case EVENT_HANDLE_STATUS_REPORT:
        case EVENT_NEW_SMS_STATUS_REPORT:
            handleStatusReport(msg.obj);
            break;

+2 −3
Original line number Diff line number Diff line
@@ -56,14 +56,13 @@ public class CdmaSMSDispatcher extends SMSDispatcher {
     * @param sms the CDMA SMS message containing the status report
     */
    public void sendStatusReportMessage(SmsMessage sms) {
        if (VDBG) Rlog.d(TAG, "sending EVENT_HANDLE_STATUS_REPORT message");
        sendMessage(obtainMessage(EVENT_HANDLE_STATUS_REPORT, sms));
        if (VDBG) Rlog.d(TAG, "sending EVENT_NEW_SMS_STATUS_REPORT message");
        sendMessage(obtainMessage(EVENT_NEW_SMS_STATUS_REPORT, sms));
    }

    @Override
    protected void handleStatusReport(Object o) {
        if (o instanceof SmsMessage) {
            if (VDBG) Rlog.d(TAG, "calling handleSmsStatusReport()");
            byte[] pdu = ((SmsMessage) o).getPdu();
            mSmsDispatchersController.handleSmsStatusReport(SmsConstants.FORMAT_3GPP2, pdu);
        } else {
+18 −27
Original line number Diff line number Diff line
@@ -51,9 +51,6 @@ public final class GsmSMSDispatcher extends SMSDispatcher {
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    private GsmInboundSmsHandler mGsmInboundSmsHandler;

    /** Status report received */
    private static final int EVENT_NEW_SMS_STATUS_REPORT = 100;

    public GsmSMSDispatcher(Phone phone, SmsDispatchersController smsDispatchersController,
            GsmInboundSmsHandler gsmInboundSmsHandler) {
        super(phone, smsDispatchersController);
@@ -86,10 +83,6 @@ public final class GsmSMSDispatcher extends SMSDispatcher {
    @Override
    public void handleMessage(Message msg) {
        switch (msg.what) {
        case EVENT_NEW_SMS_STATUS_REPORT:
            handleStatusReport((AsyncResult) msg.obj);
            break;

            case EVENT_NEW_ICC_SMS:
                // pass to InboundSmsHandler to process
                mGsmInboundSmsHandler.sendMessage(InboundSmsHandler.EVENT_NEW_SMS, msg.obj);
@@ -130,17 +123,15 @@ public final class GsmSMSDispatcher extends SMSDispatcher {
        return SMSDispatcherUtil.calculateLengthGsm(messageBody, use7bitOnly);
    }

    /**
     * Called when a status report is received. This should correspond to a previously successful
     * SEND.
     *
     * @param ar AsyncResult passed into the message handler. ar.result should be a byte array for
     *           the status report PDU.
     */
    private void handleStatusReport(AsyncResult ar) {
        byte[] pdu = (byte[]) ar.result;
    @Override
    protected void handleStatusReport(Object o) {
        if (o instanceof AsyncResult) {
            byte[] pdu = (byte[]) ((AsyncResult) o).result;
            mSmsDispatchersController.handleSmsStatusReport(SmsConstants.FORMAT_3GPP, pdu);
            mCi.acknowledgeLastIncomingGsmSms(true, 0 /* cause */, null);
        } else {
            Rlog.e(TAG, "handleStatusReport() called for object type " + o.getClass().getName());
        }
    }

    /** {@inheritDoc} */