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

Commit e60a35c1 authored by Jake Hamby's avatar Jake Hamby Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE: Remove SMS shortcode warning feature." into jb-dev

parents 5ddf003c 004ff5ad
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -812,13 +812,6 @@
  <java-symbol type="string" name="sms_control_title" />
  <java-symbol type="string" name="sms_control_no" />
  <java-symbol type="string" name="sms_control_yes" />
  <java-symbol type="string" name="sms_premium_short_code_confirm_message" />
  <java-symbol type="string" name="sms_premium_short_code_confirm_title" />
  <java-symbol type="string" name="sms_short_code_confirm_allow" />
  <java-symbol type="string" name="sms_short_code_confirm_deny" />
  <java-symbol type="string" name="sms_short_code_confirm_message" />
  <java-symbol type="string" name="sms_short_code_confirm_report" />
  <java-symbol type="string" name="sms_short_code_confirm_title" />
  <java-symbol type="string" name="submit" />
  <java-symbol type="string" name="sync_binding_label" />
  <java-symbol type="string" name="sync_do_nothing" />
+0 −55
Original line number Diff line number Diff line
@@ -116,12 +116,6 @@ public abstract class SMSDispatcher extends Handler {
    /** Don't send SMS (user did not confirm). */
    static final int EVENT_STOP_SENDING = 7;        // accessed from inner class

    /** Confirmation required for third-party apps sending to an SMS short code. */
    private static final int EVENT_CONFIRM_SEND_TO_POSSIBLE_PREMIUM_SHORT_CODE = 8;

    /** Confirmation required for third-party apps sending to an SMS short code. */
    private static final int EVENT_CONFIRM_SEND_TO_PREMIUM_SHORT_CODE = 9;

    protected final Phone mPhone;
    protected final Context mContext;
    protected final ContentResolver mResolver;
@@ -294,14 +288,6 @@ public abstract class SMSDispatcher extends Handler {
            handleReachSentLimit((SmsTracker)(msg.obj));
            break;

        case EVENT_CONFIRM_SEND_TO_POSSIBLE_PREMIUM_SHORT_CODE:
            handleConfirmShortCode(false, (SmsTracker)(msg.obj));
            break;

        case EVENT_CONFIRM_SEND_TO_PREMIUM_SHORT_CODE:
            handleConfirmShortCode(true, (SmsTracker)(msg.obj));
            break;

        case EVENT_SEND_CONFIRMED_SMS:
        {
            SmsTracker tracker = (SmsTracker) msg.obj;
@@ -999,47 +985,6 @@ public abstract class SMSDispatcher extends Handler {
        d.show();
    }

    /**
     * Post an alert for user confirmation when sending to a potential short code.
     * @param isPremium true if the destination is known to be a premium short code
     * @param tracker the SmsTracker for the current message.
     */
    protected void handleConfirmShortCode(boolean isPremium, SmsTracker tracker) {
        if (denyIfQueueLimitReached(tracker)) {
            return;     // queue limit reached; error was returned to caller
        }

        int messageId;
        int titleId;
        if (isPremium) {
            messageId = R.string.sms_premium_short_code_confirm_message;
            titleId = R.string.sms_premium_short_code_confirm_title;
        } else {
            messageId = R.string.sms_short_code_confirm_message;
            titleId = R.string.sms_short_code_confirm_title;
        }

        CharSequence appLabel = getAppLabel(tracker.mAppPackage);
        Resources r = Resources.getSystem();
        Spanned messageText = Html.fromHtml(r.getString(messageId, appLabel, tracker.mDestAddress));

        ConfirmDialogListener listener = new ConfirmDialogListener(tracker);

        AlertDialog d = new AlertDialog.Builder(mContext)
                .setTitle(titleId)
                .setIcon(R.drawable.stat_sys_warning)
                .setMessage(messageText)
                .setPositiveButton(r.getString(R.string.sms_short_code_confirm_allow), listener)
                .setNegativeButton(r.getString(R.string.sms_short_code_confirm_deny), listener)
// TODO: add third button for "Report malicious app" feature
//                .setNeutralButton(r.getString(R.string.sms_short_code_confirm_report), listener)
                .setOnCancelListener(listener)
                .create();

        d.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        d.show();
    }

    /**
     * Send the message along to the radio.
     *