Skip to content

Commit 03da2f0

Browse files
author
Tom Taylor
committed
Add new secure setting for controlling Messaging notifications
Bug 5552615 We're adding a new intent to allow 3rd party apps to disable the Messaging app's notification. We want any app to be able to query the setting of whether sms notifications are on or off, but only allow system apps, particularly the Messaging app, to change that setting. Other apps can change the setting by firing off an intent which brings up a dialog activity in the Messaging app that'll let them turn off Messaging notifications. Change-Id: I4d2721191b86010efb383a24c28d911496440657
1 parent 064975c commit 03da2f0

File tree

5 files changed

+28
-1
lines changed

5 files changed

+28
-1
lines changed

api/current.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17363,6 +17363,7 @@ package android.provider {
1736317363
field public static final java.lang.String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
1736417364
field public static final java.lang.String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
1736517365
field public static final deprecated java.lang.String LOGGING_ID = "logging_id";
17366+
field public static final java.lang.String MESSAGING_APP_NOTIFICATIONS = "messaging_app_notifications";
1736617367
field public static final java.lang.String NETWORK_PREFERENCE = "network_preference";
1736717368
field public static final java.lang.String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
1736817369
field public static final java.lang.String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";

core/java/android/provider/Settings.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4067,6 +4067,13 @@ public static final String getBluetoothInputDevicePriorityKey(String address) {
40674067
public static final String CONTACTS_PREAUTH_URI_EXPIRATION =
40684068
"contacts_preauth_uri_expiration";
40694069

4070+
/**
4071+
* Whether the Messaging app posts notifications.
4072+
* 0=disabled. 1=enabled.
4073+
*/
4074+
public static final String MESSAGING_APP_NOTIFICATIONS = "messaging_app_notifications";
4075+
4076+
40704077
/**
40714078
* This are the settings to be backed up.
40724079
*
@@ -4104,7 +4111,8 @@ public static final String getBluetoothInputDevicePriorityKey(String address) {
41044111
MOUNT_UMS_NOTIFY_ENABLED,
41054112
UI_NIGHT_MODE,
41064113
LOCK_SCREEN_OWNER_INFO,
4107-
LOCK_SCREEN_OWNER_INFO_ENABLED
4114+
LOCK_SCREEN_OWNER_INFO_ENABLED,
4115+
MESSAGING_APP_NOTIFICATIONS
41084116
};
41094117

41104118
/**

core/java/android/provider/Telephony.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,5 +1838,15 @@ private Intents() {
18381838
public static final String EXTRA_PLMN = "plmn";
18391839
public static final String EXTRA_SHOW_SPN = "showSpn";
18401840
public static final String EXTRA_SPN = "spn";
1841+
1842+
/**
1843+
* Activity Action: Shows a dialog to turn off Messaging app notification.
1844+
* <p>Input: Nothing.
1845+
* <p>Output: Nothing.
1846+
*/
1847+
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1848+
public static final String ACTION_MESSAGING_APP_NOTIFICATIONS =
1849+
"android.provider.Telephony.MESSAGING_APP_NOTIFICATIONS";
1850+
18411851
}
18421852
}

packages/SettingsProvider/res/values/defaults.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,8 @@
133133
<bool name="def_dtmf_tones_enabled">true</bool>
134134
<!-- Default for UI touch sounds enabled -->
135135
<bool name="def_sound_effects_enabled">true</bool>
136+
137+
<!-- Default for Messaging app notifications enabled -->
138+
<bool name="def_messaging_app_notifications_on">true</bool>
139+
136140
</resources>

packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,10 @@ private void loadSecureSettings(SQLiteDatabase db) {
14721472

14731473
loadBooleanSetting(stmt, Settings.Secure.TOUCH_EXPLORATION_ENABLED,
14741474
R.bool.def_touch_exploration_enabled);
1475+
1476+
loadBooleanSetting(stmt, Settings.Secure.MESSAGING_APP_NOTIFICATIONS,
1477+
R.bool.def_messaging_app_notifications_on);
1478+
14751479
} finally {
14761480
if (stmt != null) stmt.close();
14771481
}

0 commit comments

Comments
 (0)