Skip to content

Commit 321ec19

Browse files
Jake HambyAndroid (Google) Code Review
authored andcommitted
Merge "DO NOT MERGE: Remove SMS shortcode warning feature." into jb-dev
2 parents b7161f5 + b1fc08c commit 321ec19

File tree

6 files changed

+9
-1045
lines changed

6 files changed

+9
-1045
lines changed

core/res/res/values/public.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,6 @@
11411141
<java-symbol type="xml" name="password_kbd_symbols_shift" />
11421142
<java-symbol type="xml" name="power_profile" />
11431143
<java-symbol type="xml" name="time_zones_by_country" />
1144-
<java-symbol type="xml" name="sms_short_codes" />
11451144

11461145
<java-symbol type="raw" name="accessibility_gestures" />
11471146
<java-symbol type="raw" name="incognito_mode_start_page" />

core/res/res/values/strings.xml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2925,22 +2925,6 @@
29252925
<!-- See SMS_DIALOG. This is a button choice to disallow sending the SMSes. [CHAR LIMIT=30] -->
29262926
<string name="sms_control_no">Deny</string>
29272927

2928-
<!-- SMS short code verification dialog. --> <skip />
2929-
<!-- The dialog title for the SMS short code confirmation dialog. [CHAR LIMIT=30] -->
2930-
<string name="sms_short_code_confirm_title">Send SMS to short code?</string>
2931-
<!-- The dialog title for the SMS premium short code confirmation dialog. [CHAR LIMIT=30] -->
2932-
<string name="sms_premium_short_code_confirm_title">Send premium SMS?</string>
2933-
<!-- The message text for the SMS short code confirmation dialog. [CHAR LIMIT=NONE] -->
2934-
<string name="sms_short_code_confirm_message">&lt;b><xliff:g id="app_name">%1$s</xliff:g>&lt;/b> would like to send a text message to &lt;b><xliff:g id="dest_address">%2$s</xliff:g>&lt;/b>, which appears to be an SMS short code.&lt;p>Sending text messages to some short codes may cause your mobile account to be billed for premium services.&lt;p>Do you want to allow this app to send the message?</string>
2935-
<!-- The message text for the SMS short code confirmation dialog. [CHAR LIMIT=NONE] -->
2936-
<string name="sms_premium_short_code_confirm_message">&lt;b><xliff:g id="app_name">%1$s</xliff:g>&lt;/b> would like to send a text message to &lt;b><xliff:g id="dest_address">%2$s</xliff:g>&lt;/b>, which is a premium SMS short code.&lt;p>&lt;b>Sending a message to this destination will cause your mobile account to be billed for premium services.&lt;/b>&lt;p>Do you want to allow this app to send the message?</string>
2937-
<!-- Text of the approval button for the SMS short code confirmation dialog. [CHAR LIMIT=50] -->
2938-
<string name="sms_short_code_confirm_allow">Send message</string>
2939-
<!-- Text of the cancel button for the SMS short code confirmation dialog. [CHAR LIMIT=30] -->
2940-
<string name="sms_short_code_confirm_deny">Don\'t send</string>
2941-
<!-- Text of the button for the SMS short code confirmation dialog to report a malicious app. [CHAR LIMIT=30] -->
2942-
<string name="sms_short_code_confirm_report">Report malicious app</string>
2943-
29442928
<!-- SIM swap and device reboot Dialog --> <skip />
29452929
<!-- See SIM_REMOVED_DIALOG. This is the title of that dialog. -->
29462930
<string name="sim_removed_title">SIM card removed</string>

core/res/res/xml/sms_short_codes.xml

Lines changed: 0 additions & 189 deletions
This file was deleted.

telephony/java/com/android/internal/telephony/SMSDispatcher.java

Lines changed: 9 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -920,61 +920,18 @@ protected void sendRawPdu(byte[] smsc, byte[] pdu, PendingIntent sentIntent,
920920
SmsTracker tracker = new SmsTracker(map, sentIntent, deliveryIntent, appPackage,
921921
PhoneNumberUtils.extractNetworkPortion(destAddr));
922922

923-
// checkDestination() returns true if the destination is not a premium short code or the
924-
// sending app is approved to send to short codes. Otherwise, a message is sent to our
925-
// handler with the SmsTracker to request user confirmation before sending.
926-
if (checkDestination(tracker)) {
927-
// check for excessive outgoing SMS usage by this app
928-
if (!mUsageMonitor.check(appPackage, SINGLE_PART_SMS)) {
929-
sendMessage(obtainMessage(EVENT_SEND_LIMIT_REACHED_CONFIRMATION, tracker));
930-
return;
931-
}
932-
933-
int ss = mPhone.getServiceState().getState();
934-
935-
if (ss != ServiceState.STATE_IN_SERVICE) {
936-
handleNotInService(ss, tracker.mSentIntent);
937-
} else {
938-
sendSms(tracker);
939-
}
923+
// check for excessive outgoing SMS usage by this app
924+
if (!mUsageMonitor.check(appPackage, SINGLE_PART_SMS)) {
925+
sendMessage(obtainMessage(EVENT_SEND_LIMIT_REACHED_CONFIRMATION, tracker));
926+
return;
940927
}
941-
}
942928

943-
/**
944-
* Check if destination is a potential premium short code and sender is not pre-approved to
945-
* send to short codes.
946-
*
947-
* @param tracker the tracker for the SMS to send
948-
* @return true if the destination is approved; false if user confirmation event was sent
949-
*/
950-
boolean checkDestination(SmsTracker tracker) {
951-
if (mContext.checkCallingOrSelfPermission(SEND_SMS_NO_CONFIRMATION_PERMISSION)
952-
== PackageManager.PERMISSION_GRANTED) {
953-
return true; // app is pre-approved to send to short codes
954-
} else {
955-
String countryIso = mTelephonyManager.getSimCountryIso();
956-
if (countryIso == null || countryIso.length() != 2) {
957-
Log.e(TAG, "Can't get SIM country code: trying network country code");
958-
countryIso = mTelephonyManager.getNetworkCountryIso();
959-
}
929+
int ss = mPhone.getServiceState().getState();
960930

961-
switch (mUsageMonitor.checkDestination(tracker.mDestAddress, countryIso)) {
962-
case SmsUsageMonitor.CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE:
963-
sendMessage(obtainMessage(EVENT_CONFIRM_SEND_TO_POSSIBLE_PREMIUM_SHORT_CODE,
964-
tracker));
965-
return false; // wait for user confirmation before sending
966-
967-
case SmsUsageMonitor.CATEGORY_PREMIUM_SHORT_CODE:
968-
sendMessage(obtainMessage(EVENT_CONFIRM_SEND_TO_PREMIUM_SHORT_CODE,
969-
tracker));
970-
return false; // wait for user confirmation before sending
971-
972-
case SmsUsageMonitor.CATEGORY_NOT_SHORT_CODE:
973-
case SmsUsageMonitor.CATEGORY_FREE_SHORT_CODE:
974-
case SmsUsageMonitor.CATEGORY_STANDARD_SHORT_CODE:
975-
default:
976-
return true; // destination is not a premium short code
977-
}
931+
if (ss != ServiceState.STATE_IN_SERVICE) {
932+
handleNotInService(ss, tracker.mSentIntent);
933+
} else {
934+
sendSms(tracker);
978935
}
979936
}
980937

0 commit comments

Comments
 (0)