summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-03-23 19:06:45 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2020-03-23 19:06:45 +0000
commitd51ea86e03d5c4ed7cede2c0e328d4a9a09a2d8c (patch)
treeb6f451cf055128a71716176ec423c939caf6cb4d
parent7ba28111c2b8134102c4b10e637d6b05b126f5db (diff)
parentc03e30cfe36aea9578bf73c3b23739bb81bfbbf7 (diff)
Merge "Ensure broadcasts are sent as system" into rvc-dev am: 98bc8e9c71 am: 93c78efb15 am: d88abe031a am: 95b83c1a6e am: c03e30cfe3
Change-Id: Iadcd65287a28558660d69ddd668b45bcc4c1e81f
-rwxr-xr-xservices/core/java/com/android/server/notification/NotificationManagerService.java42
1 files changed, 26 insertions, 16 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 172f5bb39b52..7f33d9d2d8f7 100755
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -27,6 +27,8 @@ import static android.app.Notification.FLAG_ONLY_ALERT_ONCE;
import static android.app.NotificationChannel.CONVERSATION_CHANNEL_ID_FORMAT;
import static android.app.NotificationManager.ACTION_APP_BLOCK_STATE_CHANGED;
import static android.app.NotificationManager.ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED;
+import static android.app.NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED;
+import static android.app.NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED_INTERNAL;
import static android.app.NotificationManager.ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED;
import static android.app.NotificationManager.ACTION_NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED;
import static android.app.NotificationManager.ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED;
@@ -244,6 +246,7 @@ import com.android.internal.util.ArrayUtils;
import com.android.internal.util.CollectionUtils;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.FastXmlSerializer;
+import com.android.internal.util.FunctionalUtils;
import com.android.internal.util.Preconditions;
import com.android.internal.util.XmlUtils;
import com.android.internal.util.function.TriPredicate;
@@ -1914,30 +1917,37 @@ public class NotificationManagerService extends SystemService {
@Override
void onZenModeChanged() {
- sendRegisteredOnlyBroadcast(NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED);
- getContext().sendBroadcastAsUser(
- new Intent(NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED_INTERNAL)
- .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT),
- UserHandle.ALL, android.Manifest.permission.MANAGE_NOTIFICATIONS);
- synchronized (mNotificationLock) {
- updateInterruptionFilterLocked();
- }
- mRankingHandler.requestSort();
+ Binder.withCleanCallingIdentity(() -> {
+ sendRegisteredOnlyBroadcast(ACTION_INTERRUPTION_FILTER_CHANGED);
+ getContext().sendBroadcastAsUser(
+ new Intent(ACTION_INTERRUPTION_FILTER_CHANGED_INTERNAL)
+ .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT),
+ UserHandle.ALL, permission.MANAGE_NOTIFICATIONS);
+ synchronized (mNotificationLock) {
+ updateInterruptionFilterLocked();
+ }
+ mRankingHandler.requestSort();
+ });
}
@Override
void onPolicyChanged() {
- sendRegisteredOnlyBroadcast(NotificationManager.ACTION_NOTIFICATION_POLICY_CHANGED);
- mRankingHandler.requestSort();
+ Binder.withCleanCallingIdentity(() -> {
+ sendRegisteredOnlyBroadcast(
+ NotificationManager.ACTION_NOTIFICATION_POLICY_CHANGED);
+ mRankingHandler.requestSort();
+ });
}
@Override
void onAutomaticRuleStatusChanged(int userId, String pkg, String id, int status) {
- Intent intent = new Intent(ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED);
- intent.setPackage(pkg);
- intent.putExtra(EXTRA_AUTOMATIC_ZEN_RULE_ID, id);
- intent.putExtra(EXTRA_AUTOMATIC_ZEN_RULE_STATUS, status);
- getContext().sendBroadcastAsUser(intent, UserHandle.of(userId));
+ Binder.withCleanCallingIdentity(() -> {
+ Intent intent = new Intent(ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED);
+ intent.setPackage(pkg);
+ intent.putExtra(EXTRA_AUTOMATIC_ZEN_RULE_ID, id);
+ intent.putExtra(EXTRA_AUTOMATIC_ZEN_RULE_STATUS, status);
+ getContext().sendBroadcastAsUser(intent, UserHandle.of(userId));
+ });
}
});
mPreferencesHelper = new PreferencesHelper(getContext(),