Skip to content

Commit 4505a43

Browse files
John HuangAndroid (Google) Code Review
authored andcommitted
Merge "Add support for per-package policy for sending premium SMS." into jb-mr1-dev
2 parents 306df86 + 76a6142 commit 4505a43

4 files changed

Lines changed: 121 additions & 31 deletions

File tree

core/java/android/provider/Settings.java

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3236,7 +3236,7 @@ public static final String getBluetoothInputDevicePriorityKey(String address) {
32363236
public static final String DISPLAY_DENSITY_FORCED = Global.DISPLAY_DENSITY_FORCED;
32373237

32383238
/**
3239-
* @deprecated Use {@link android.provider.Settings.Global#ASSISTED_GPS_ENABLE} instead
3239+
* @deprecated Use {@link android.provider.Settings.Global#ASSISTED_GPS_ENABLED} instead
32403240
* @hide
32413241
*/
32423242
@Deprecated
@@ -4345,21 +4345,18 @@ public static final String getBluetoothInputDevicePriorityKey(String address) {
43454345
"sync_max_retry_delay_in_seconds";
43464346

43474347
/**
4348-
* The interval in milliseconds at which to check the number of SMS sent
4349-
* out without asking for use permit, to limit the un-authorized SMS
4350-
* usage.
4348+
* @deprecated Use {@link Settings.Global#SMS_OUTGOING_CHECK_INTERVAL_MS} instead.
43514349
* @hide
43524350
*/
43534351
public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
4354-
"sms_outgoing_check_interval_ms";
4352+
Global.SMS_OUTGOING_CHECK_INTERVAL_MS;
43554353

43564354
/**
4357-
* The number of outgoing SMS sent without asking for user permit
4358-
* (of {@link #SMS_OUTGOING_CHECK_INTERVAL_MS}
4355+
* @deprecated Use {@link Settings.Global#SMS_OUTGOING_CHECK_MAX_COUNT} instead.
43594356
* @hide
43604357
*/
43614358
public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
4362-
"sms_outgoing_check_max_count";
4359+
Global.SMS_OUTGOING_CHECK_MAX_COUNT;
43634360

43644361
/**
43654362
* The global search provider chosen by the user (if multiple global
@@ -4860,13 +4857,6 @@ public static final String getBluetoothInputDevicePriorityKey(String address) {
48604857
public static final String CONTACTS_PREAUTH_URI_EXPIRATION =
48614858
"contacts_preauth_uri_expiration";
48624859

4863-
/**
4864-
* Prefix for SMS short code regex patterns (country code is appended).
4865-
* @see com.android.internal.telephony.SmsUsageMonitor
4866-
* @hide
4867-
*/
4868-
public static final String SMS_SHORT_CODES_PREFIX = "sms_short_codes_";
4869-
48704860
/**
48714861
* Overlay display devices setting.
48724862
* The associated value is a specially formatted string that describes the
@@ -5426,6 +5416,38 @@ public static final class Global extends NameValueTable {
54265416
public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
54275417
"setup_prepaid_detection_redir_host";
54285418

5419+
/**
5420+
* The interval in milliseconds at which to check the number of SMS sent out without asking
5421+
* for use permit, to limit the un-authorized SMS usage.
5422+
*
5423+
* @hide
5424+
*/
5425+
public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
5426+
"sms_outgoing_check_interval_ms";
5427+
5428+
/**
5429+
* The number of outgoing SMS sent without asking for user permit (of {@link
5430+
* #SMS_OUTGOING_CHECK_INTERVAL_MS}
5431+
*
5432+
* @hide
5433+
*/
5434+
public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
5435+
"sms_outgoing_check_max_count";
5436+
5437+
/**
5438+
* Used to disable SMS short code confirmation - defaults to true.
5439+
* @see com.android.internal.telephony.SmsUsageMonitor
5440+
* @hide
5441+
*/
5442+
public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation";
5443+
5444+
/**
5445+
* Prefix for SMS short code regex patterns (country code is appended).
5446+
* @see com.android.internal.telephony.SmsUsageMonitor
5447+
* @hide
5448+
*/
5449+
public static final String SMS_SHORT_CODES_PREFIX = "sms_short_codes_";
5450+
54295451
/**
54305452
* Used to disable Tethering on a device - defaults to true
54315453
* @hide
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/*
4+
** Copyright 2012 The Android Open Source Project
5+
**
6+
** Licensed under the Apache License, Version 2.0 (the "License");
7+
** you may not use this file except in compliance with the License.
8+
** You may obtain a copy of the License at
9+
**
10+
** http://www.apache.org/licenses/LICENSE-2.0
11+
**
12+
** Unless required by applicable law or agreed to in writing, software
13+
** distributed under the License is distributed on an "AS IS" BASIS,
14+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
** See the License for the specific language governing permissions and
16+
** limitations under the License.
17+
*/
18+
-->
19+
20+
<LinearLayout
21+
xmlns:android="http://schemas.android.com/apk/res/android"
22+
android:id="@+id/parentPanel"
23+
android:layout_width="match_parent"
24+
android:layout_height="wrap_content"
25+
android:layout_marginLeft="8dip"
26+
android:layout_marginRight="8dip"
27+
android:orientation="vertical">
28+
29+
<TextView android:id="@+id/sms_short_code_confirm_message"
30+
style="?android:attr/textAppearanceMedium"
31+
android:layout_width="match_parent"
32+
android:layout_height="wrap_content"
33+
android:paddingLeft="16dip"
34+
android:paddingRight="16dip"
35+
android:paddingTop="8dip"
36+
android:paddingBottom="8dip"/>
37+
38+
<LinearLayout android:id="@+id/sms_short_code_detail_layout"
39+
android:layout_width="match_parent"
40+
android:layout_height="wrap_content"
41+
android:orientation="horizontal"
42+
android:gravity="center_vertical"
43+
android:minHeight="@dimen/alert_dialog_title_height"
44+
android:layout_marginLeft="16dip"
45+
android:layout_marginRight="16dip">
46+
<ImageView android:id="@+id/sms_short_code_coins_icon"
47+
android:layout_width="wrap_content"
48+
android:layout_height="wrap_content"
49+
android:paddingRight="8dip"
50+
android:src="@null" />
51+
<TextView android:id="@+id/sms_short_code_detail_message"
52+
style="?android:attr/textAppearanceMedium"
53+
android:layout_width="match_parent"
54+
android:layout_height="wrap_content" />
55+
</LinearLayout>
56+
57+
<CheckBox android:id="@+id/sms_short_code_remember_choice_checkbox"
58+
android:layout_width="match_parent"
59+
android:layout_height="wrap_content"
60+
android:text="@string/sms_short_code_remember_choice" />
61+
</LinearLayout>

core/res/res/values/strings.xml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3089,20 +3089,22 @@
30893089
<string name="sms_control_no">Deny</string>
30903090

30913091
<!-- SMS short code verification dialog. --> <skip />
3092-
<!-- The dialog title for the SMS short code confirmation dialog. [CHAR LIMIT=30] -->
3093-
<string name="sms_short_code_confirm_title">Send SMS to short code?</string>
3094-
<!-- The dialog title for the SMS premium short code confirmation dialog. [CHAR LIMIT=30] -->
3095-
<string name="sms_premium_short_code_confirm_title">Send premium SMS?</string>
30963092
<!-- The message text for the SMS short code confirmation dialog. [CHAR LIMIT=NONE] -->
3097-
<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>
3098-
<!-- The message text for the SMS short code confirmation dialog. [CHAR LIMIT=NONE] -->
3099-
<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>
3100-
<!-- Text of the approval button for the SMS short code confirmation dialog. [CHAR LIMIT=50] -->
3101-
<string name="sms_short_code_confirm_allow">Send message</string>
3093+
<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 message to &lt;b><xliff:g id="dest_address">%2$s</xliff:g>&lt;/b>.</string>
3094+
<!-- Message details for the SMS short code confirmation dialog (possible premium short code). [CHAR LIMIT=NONE] -->
3095+
<string name="sms_short_code_details">This may cause charges on your mobile account.</string>
3096+
<!-- Message details for the SMS short code confirmation dialog (premium short code). [CHAR LIMIT=NONE] -->
3097+
<string name="sms_premium_short_code_details">This will cause charges on your mobile account.</string>
3098+
<!-- Text of the approval button for the SMS short code confirmation dialog. [CHAR LIMIT=30] -->
3099+
<string name="sms_short_code_confirm_allow">Send</string>
31023100
<!-- Text of the cancel button for the SMS short code confirmation dialog. [CHAR LIMIT=30] -->
3103-
<string name="sms_short_code_confirm_deny">Don\'t send</string>
3104-
<!-- Text of the button for the SMS short code confirmation dialog to report a malicious app. [CHAR LIMIT=30] -->
3105-
<string name="sms_short_code_confirm_report">Report malicious app</string>
3101+
<string name="sms_short_code_confirm_deny">Cancel</string>
3102+
<!-- Text of the checkbox for the SMS short code confirmation dialog to remember the user's choice. [CHAR LIMIT=40] -->
3103+
<string name="sms_short_code_remember_choice">Remember my choice</string>
3104+
<!-- Text of the approval button for the SMS short code confirmation dialog when checkbox is checked. [CHAR LIMIT=30] -->
3105+
<string name="sms_short_code_confirm_always_allow">Always Allow</string>
3106+
<!-- Text of the cancel button for the SMS short code confirmation dialog when checkbox is checked. [CHAR LIMIT=30] -->
3107+
<string name="sms_short_code_confirm_never_allow">Never Allow</string>
31063108

31073109
<!-- SIM swap and device reboot Dialog --> <skip />
31083110
<!-- See SIM_REMOVED_DIALOG. This is the title of that dialog. -->

core/res/res/values/symbols.xml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@
211211
<java-symbol type="id" name="status_bar_latest_event_content" />
212212
<java-symbol type="id" name="action_divider" />
213213
<java-symbol type="id" name="overflow_divider" />
214+
<java-symbol type="id" name="sms_short_code_confirm_message" />
215+
<java-symbol type="id" name="sms_short_code_detail_layout" />
216+
<java-symbol type="id" name="sms_short_code_detail_message" />
217+
<java-symbol type="id" name="sms_short_code_remember_choice_checkbox" />
214218

215219
<java-symbol type="attr" name="actionModeShareDrawable" />
216220
<java-symbol type="attr" name="alertDialogCenterButtons" />
@@ -739,13 +743,13 @@
739743
<java-symbol type="string" name="sms_control_title" />
740744
<java-symbol type="string" name="sms_control_no" />
741745
<java-symbol type="string" name="sms_control_yes" />
742-
<java-symbol type="string" name="sms_premium_short_code_confirm_message" />
743-
<java-symbol type="string" name="sms_premium_short_code_confirm_title" />
744746
<java-symbol type="string" name="sms_short_code_confirm_allow" />
745747
<java-symbol type="string" name="sms_short_code_confirm_deny" />
748+
<java-symbol type="string" name="sms_short_code_confirm_always_allow" />
749+
<java-symbol type="string" name="sms_short_code_confirm_never_allow" />
746750
<java-symbol type="string" name="sms_short_code_confirm_message" />
747-
<java-symbol type="string" name="sms_short_code_confirm_report" />
748-
<java-symbol type="string" name="sms_short_code_confirm_title" />
751+
<java-symbol type="string" name="sms_short_code_details" />
752+
<java-symbol type="string" name="sms_premium_short_code_details" />
749753
<java-symbol type="string" name="submit" />
750754
<java-symbol type="string" name="sync_binding_label" />
751755
<java-symbol type="string" name="sync_do_nothing" />
@@ -1051,6 +1055,7 @@
10511055
<java-symbol type="layout" name="notification_template_inbox" />
10521056
<java-symbol type="layout" name="keyguard_multi_user_avatar" />
10531057
<java-symbol type="layout" name="keyguard_multi_user_selector_widget" />
1058+
<java-symbol type="layout" name="sms_short_code_confirmation_dialog" />
10541059

10551060
<java-symbol type="anim" name="slide_in_child_bottom" />
10561061
<java-symbol type="anim" name="slide_in_right" />

0 commit comments

Comments
 (0)