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

Commit bc773727 authored by Amit Mahajan's avatar Amit Mahajan Committed by Android (Google) Code Review
Browse files

Merge "New permission to bypass premium short code check" into nyc-dev

parents 9b745eec bd5e7244
Loading
Loading
Loading
Loading
+56 −50
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ import java.util.Random;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

import static android.Manifest.permission.SEND_SMS_NO_CONFIRMATION;
import static android.telephony.SmsManager.RESULT_ERROR_FDN_CHECK_FAILURE;
import static android.telephony.SmsManager.RESULT_ERROR_GENERIC_FAILURE;
import static android.telephony.SmsManager.RESULT_ERROR_LIMIT_EXCEEDED;
@@ -1011,6 +1012,10 @@ public abstract class SMSDispatcher extends Handler {
     * @return true if the destination is approved; false if user confirmation event was sent
     */
    boolean checkDestination(SmsTracker tracker) {
        if (mContext.checkCallingOrSelfPermission(SEND_SMS_NO_CONFIRMATION)
                == PackageManager.PERMISSION_GRANTED) {
            return true;            // app is pre-approved to send to short codes
        } else {
            int rule = mPremiumSmsRule.get();
            int smsCategory = SmsUsageMonitor.CATEGORY_NOT_SHORT_CODE;
            if (rule == PREMIUM_RULE_USE_SIM || rule == PREMIUM_RULE_USE_BOTH) {
@@ -1069,6 +1074,7 @@ public abstract class SMSDispatcher extends Handler {
                    return false;   // wait for user confirmation
            }
        }
    }

    /**
     * Deny sending an SMS if the outgoing queue limit is reached. Used when the message