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

Commit ee8a4983 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Replace no error code '0' for SMS with '-1'"

parents 3a45b007 215e1e51
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.internal.telephony;

import static com.android.internal.telephony.SmsResponse.NO_ERROR_CODE;

import android.content.Context;
import android.os.PersistableBundle;
import android.os.RemoteException;
@@ -132,7 +134,7 @@ public class ImsSmsDispatcher extends SMSDispatcher {
                    mPhone.notifySmsSent(tracker.mDestAddress);
                    break;
                case ImsSmsImplBase.SEND_STATUS_ERROR:
                    tracker.onFailed(mContext, reason, 0 /* errorCode */);
                    tracker.onFailed(mContext, reason, NO_ERROR_CODE);
                    mTrackers.remove(token);
                    break;
                case ImsSmsImplBase.SEND_STATUS_ERROR_RETRY:
+12 −12
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static android.telephony.SmsManager.RESULT_ERROR_SHORT_CODE_NOT_ALLOWED;

import static com.android.internal.telephony.IccSmsInterfaceManager.SMS_MESSAGE_PERIOD_NOT_SPECIFIED;
import static com.android.internal.telephony.IccSmsInterfaceManager.SMS_MESSAGE_PRIORITY_NOT_SPECIFIED;
import static com.android.internal.telephony.SmsResponse.NO_ERROR_CODE;

import android.annotation.Nullable;
import android.annotation.UnsupportedAppUsage;
@@ -318,7 +319,7 @@ public abstract class SMSDispatcher extends Handler {
            Rlog.d(TAG, "SMSDispatcher: EVENT_SENDING_NOT_ALLOWED - "
                    + "sending SHORT_CODE_NEVER_ALLOWED error code.");
            handleSmsTrackersFailure(
                    trackers, RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED, 0 /*errorCode*/);
                    trackers, RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED, NO_ERROR_CODE);
            break;
        }

@@ -345,7 +346,7 @@ public abstract class SMSDispatcher extends Handler {
                Rlog.e(TAG, "SMSDispatcher: EVENT_STOP_SENDING - unexpected cases.");
            }

            handleSmsTrackersFailure(trackers, error, 0 /*errorCode*/);
            handleSmsTrackersFailure(trackers, error, NO_ERROR_CODE);
            mPendingTrackerCount--;
            break;
        }
@@ -511,8 +512,7 @@ public abstract class SMSDispatcher extends Handler {
            return;
        }

        SmsResponse smsResponse = new SmsResponse(
                messageRef, null /* ackPdu */, -1 /* unknown error code */);
        SmsResponse smsResponse = new SmsResponse(messageRef, null /* ackPdu */, NO_ERROR_CODE);

        switch (result) {
        case CarrierMessagingService.SEND_STATUS_OK:
@@ -650,7 +650,7 @@ public abstract class SMSDispatcher extends Handler {
    private void sendSubmitPdu(SmsTracker[] trackers) {
        if (shouldBlockSmsForEcbm()) {
            Rlog.d(TAG, "Block SMS in Emergency Callback mode");
            handleSmsTrackersFailure(trackers, RESULT_ERROR_NO_SERVICE, 0 /*errorCode*/);
            handleSmsTrackersFailure(trackers, RESULT_ERROR_NO_SERVICE, NO_ERROR_CODE);
        } else {
            sendRawPdu(trackers);
        }
@@ -710,7 +710,7 @@ public abstract class SMSDispatcher extends Handler {

            // if sms over IMS is not supported on data and voice is not available...
            if (!isIms() && ss != ServiceState.STATE_IN_SERVICE) {
                tracker.onFailed(mContext, getNotInServiceError(ss), 0/*errorCode*/);
                tracker.onFailed(mContext, getNotInServiceError(ss), NO_ERROR_CODE);
            } else if ((((CommandException)(ar.exception)).getCommandError()
                    == CommandException.Error.SMS_FAIL_RETRY) &&
                   tracker.mRetryCount < MAX_SEND_RETRIES) {
@@ -726,7 +726,7 @@ public abstract class SMSDispatcher extends Handler {
                Message retryMsg = obtainMessage(EVENT_SEND_RETRY, tracker);
                sendMessageDelayed(retryMsg, SEND_RETRY_DELAY);
            } else {
                int errorCode = 0;
                int errorCode = NO_ERROR_CODE;
                if (ar.result != null) {
                    errorCode = ((SmsResponse)ar.result).mErrorCode;
                }
@@ -1194,7 +1194,7 @@ public abstract class SMSDispatcher extends Handler {
        }

        if (error != RESULT_ERROR_NONE) {
            handleSmsTrackersFailure(trackers, error, 0 /*errorCode*/);
            handleSmsTrackersFailure(trackers, error, NO_ERROR_CODE);
            return;
        }

@@ -1326,7 +1326,7 @@ public abstract class SMSDispatcher extends Handler {
        if (mPendingTrackerCount >= MO_MSG_QUEUE_LIMIT) {
            // Deny sending message when the queue limit is reached.
            Rlog.e(TAG, "Denied because queue limit reached");
            handleSmsTrackersFailure(trackers, RESULT_ERROR_LIMIT_EXCEEDED, 0 /*errorCode*/);
            handleSmsTrackersFailure(trackers, RESULT_ERROR_LIMIT_EXCEEDED, NO_ERROR_CODE);
            return true;
        }
        mPendingTrackerCount++;
@@ -1649,7 +1649,7 @@ public abstract class SMSDispatcher extends Handler {
            if (mDeliveryIntent != null) {
                values.put(Sms.STATUS, Telephony.Sms.STATUS_PENDING);
            }
            if (errorCode != 0) {
            if (errorCode != NO_ERROR_CODE) {
                values.put(Sms.ERROR_CODE, errorCode);
            }
            final long identity = Binder.clearCallingIdentity();
@@ -1718,7 +1718,7 @@ public abstract class SMSDispatcher extends Handler {
                        // Pass this to SMS apps so that they know where it is stored
                        fillIn.putExtra("uri", mMessageUri.toString());
                    }
                    if (errorCode != 0) {
                    if (errorCode != NO_ERROR_CODE) {
                        fillIn.putExtra("errorCode", errorCode);
                    }
                    if (mUnsentPartCount != null && isSinglePartOrLastPart) {
@@ -1749,7 +1749,7 @@ public abstract class SMSDispatcher extends Handler {
                if (mAnyPartFailed != null && mAnyPartFailed.get()) {
                    messageType = Sms.MESSAGE_TYPE_FAILED;
                }
                persistOrUpdateMessage(context, messageType, 0/*errorCode*/);
                persistOrUpdateMessage(context, messageType, NO_ERROR_CODE);
            }
            if (mSentIntent != null) {
                try {
+2 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.internal.telephony;

import static com.android.internal.telephony.IccSmsInterfaceManager.SMS_MESSAGE_PERIOD_NOT_SPECIFIED;
import static com.android.internal.telephony.IccSmsInterfaceManager.SMS_MESSAGE_PRIORITY_NOT_SPECIFIED;
import static com.android.internal.telephony.SmsResponse.NO_ERROR_CODE;
import static com.android.internal.telephony.cdma.sms.BearerData.ERROR_NONE;
import static com.android.internal.telephony.cdma.sms.BearerData.ERROR_TEMPORARY;

@@ -460,7 +461,7 @@ public class SmsDispatchersController extends Handler {
                || (map.containsKey("data") && map.containsKey("destPort"))))) {
            // should never come here...
            Rlog.e(TAG, "sendRetrySms failed to re-encode per missing fields!");
            tracker.onFailed(mContext, SmsManager.RESULT_ERROR_GENERIC_FAILURE, 0/*errorCode*/);
            tracker.onFailed(mContext, SmsManager.RESULT_ERROR_GENERIC_FAILURE, NO_ERROR_CODE);
            return;
        }
        String scAddr = (String) map.get("scAddr");
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import android.annotation.UnsupportedAppUsage;
 *
 */
public class SmsResponse {
    public static final int NO_ERROR_CODE = -1;

    /** Message reference of the just-sent SMS. */
    @UnsupportedAppUsage
    int mMessageRef;
+3 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.internal.telephony.cdma;

import static com.android.internal.telephony.SmsResponse.NO_ERROR_CODE;

import android.annotation.UnsupportedAppUsage;
import android.os.Message;
import android.telephony.Rlog;
@@ -128,7 +130,7 @@ public class CdmaSMSDispatcher extends SMSDispatcher {
        int ss = mPhone.getServiceState().getState();
        // if sms over IMS is not supported on data and voice is not available...
        if (!isIms() && ss != ServiceState.STATE_IN_SERVICE) {
            tracker.onFailed(mContext, getNotInServiceError(ss), 0/*errorCode*/);
            tracker.onFailed(mContext, getNotInServiceError(ss), NO_ERROR_CODE);
            return;
        }

Loading