summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorMax Spencer <maxspencer@google.com>2023-05-25 10:51:21 +0000
committerMax Spencer <maxspencer@google.com>2023-05-25 13:33:27 +0000
commit88d51c81ef256ce5c07abe1eedd08ecc2f70c03d (patch)
tree979221af5b014a4c9fff844841cd8f6720a97c47 /service
parent2c37a54c94d730f0fd3815e93516dd55b6cf6d4a (diff)
downloadPermission-88d51c81ef256ce5c07abe1eedd08ecc2f70c03d.tar.gz
Guard notifyActionSuccess with flag
Also adds tests and I created a new bug to decide if there's actually a better course of action to take when our notifications flag has been turned off AFTER some SC notification(s) is/are already posted. Test: SafetyCenterNotificationTest Bug: 283780918 Bug: 284271124 Relnote: N/A Change-Id: I13a551ac6a8bc2e4fb73a0c9098b49c71e09ff77
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/safetycenter/notifications/SafetyCenterNotificationReceiver.java1
-rw-r--r--service/java/com/android/safetycenter/notifications/SafetyCenterNotificationSender.java6
2 files changed, 7 insertions, 0 deletions
diff --git a/service/java/com/android/safetycenter/notifications/SafetyCenterNotificationReceiver.java b/service/java/com/android/safetycenter/notifications/SafetyCenterNotificationReceiver.java
index 41c54a9fd..bb4977bb5 100644
--- a/service/java/com/android/safetycenter/notifications/SafetyCenterNotificationReceiver.java
+++ b/service/java/com/android/safetycenter/notifications/SafetyCenterNotificationReceiver.java
@@ -173,6 +173,7 @@ public final class SafetyCenterNotificationReceiver extends BroadcastReceiver {
}
if (!SafetyCenterFlags.getNotificationsEnabled()) {
+ // TODO(b/284271124): Decide what to do with existing notifications
Log.i(TAG, "Received notification broadcast but notifications are disabled");
return;
}
diff --git a/service/java/com/android/safetycenter/notifications/SafetyCenterNotificationSender.java b/service/java/com/android/safetycenter/notifications/SafetyCenterNotificationSender.java
index 77dd80c47..90be3618e 100644
--- a/service/java/com/android/safetycenter/notifications/SafetyCenterNotificationSender.java
+++ b/service/java/com/android/safetycenter/notifications/SafetyCenterNotificationSender.java
@@ -145,6 +145,11 @@ public final class SafetyCenterNotificationSender {
*/
public void notifyActionSuccess(
String sourceId, SafetyEvent safetyEvent, @UserIdInt int userId) {
+ if (!SafetyCenterFlags.getNotificationsEnabled()) {
+ // TODO(b/284271124): Decide what to do with existing notifications
+ return;
+ }
+
if (safetyEvent.getType() != SAFETY_EVENT_TYPE_RESOLVING_ACTION_SUCCEEDED) {
Log.w(TAG, "Received safety event of wrong type");
return;
@@ -224,6 +229,7 @@ public final class SafetyCenterNotificationSender {
*/
public void updateNotifications(@UserIdInt int userId) {
if (!SafetyCenterFlags.getNotificationsEnabled()) {
+ // TODO(b/284271124): Decide what to do with existing notifications
return;
}