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

Commit 3a4eee3b authored by Taesu Lee's avatar Taesu Lee Committed by android-build-merger
Browse files

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

am: ee8a4983

Change-Id: I8f8a2f9afc296f57a05caa9fa0b0c61dd624f7a6
parents ac02942a ee8a4983
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.Binder;
import android.os.PersistableBundle;
@@ -133,7 +135,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;
@@ -319,7 +320,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;
        }

@@ -346,7 +347,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;
        }
@@ -512,8 +513,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:
@@ -651,7 +651,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);
        }
@@ -711,7 +711,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) {
@@ -727,7 +727,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;
                }
@@ -1196,7 +1196,7 @@ public abstract class SMSDispatcher extends Handler {
        }

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

@@ -1328,7 +1328,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++;
@@ -1653,7 +1653,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();
@@ -1722,7 +1722,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) {
@@ -1753,7 +1753,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