summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2014-08-22 14:54:46 -0400
committerJohn Spurlock <jspurlock@google.com>2014-08-22 18:08:17 -0400
commitb4782526f5600d9759baac64b23e0c0cd05e2050 (patch)
tree3054c86a04839b7d9fcd36b7291a1e7ef0195dbd /services
parenta34cb5e363c10984f07742d5eb1890787fe128f0 (diff)
downloadframeworks_base-b4782526f5600d9759baac64b23e0c0cd05e2050.zip
frameworks_base-b4782526f5600d9759baac64b23e0c0cd05e2050.tar.gz
frameworks_base-b4782526f5600d9759baac64b23e0c0cd05e2050.tar.bz2
Display notification effects suppressor in the volume panel.
Bug:16958514 Change-Id: I0eac173875e8af62e3c6b39001722c3fda4517de
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 45bd812..c390f9b 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -29,6 +29,7 @@ import android.app.IActivityManager;
import android.app.INotificationManager;
import android.app.ITransientNotification;
import android.app.Notification;
+import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.StatusBarManager;
import android.content.BroadcastReceiver;
@@ -56,6 +57,7 @@ import android.os.IBinder;
import android.os.IInterface;
import android.os.Looper;
import android.os.Message;
+import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
@@ -109,6 +111,7 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.NoSuchElementException;
+import java.util.Objects;
/** {@hide} */
public class NotificationManagerService extends SystemService {
@@ -173,6 +176,7 @@ public class NotificationManagerService extends SystemService {
NotificationRecord mVibrateNotification;
private final ArraySet<ManagedServiceInfo> mListenersDisablingEffects = new ArraySet<>();
+ private ComponentName mEffectsSuppressor;
private int mListenerHints; // right now, all hints are global
// for enabling and disabling notification pulse behavior
@@ -941,6 +945,15 @@ public class NotificationManagerService extends SystemService {
scheduleListenerHintsChanged(hints);
}
+ private void updateEffectsSuppressorLocked() {
+ final ComponentName suppressor = !mListenersDisablingEffects.isEmpty()
+ ? mListenersDisablingEffects.valueAt(0).component : null;
+ if (Objects.equals(suppressor, mEffectsSuppressor)) return;
+ mEffectsSuppressor = suppressor;
+ getContext().sendBroadcast(new Intent(NotificationManager.ACTION_EFFECTS_SUPPRESSOR_CHANGED)
+ .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY));
+ }
+
private final IBinder mService = new INotificationManager.Stub() {
// Toasts
// ============================================================================
@@ -1299,6 +1312,7 @@ public class NotificationManagerService extends SystemService {
}
mZenModeHelper.requestFromListener(hints);
updateListenerHintsLocked();
+ updateEffectsSuppressorLocked();
}
} finally {
Binder.restoreCallingIdentity(identity);
@@ -1384,6 +1398,12 @@ public class NotificationManagerService extends SystemService {
dumpImpl(pw, DumpFilter.parseFromArguments(args));
}
+
+ @Override
+ public ComponentName getEffectsSuppressor() {
+ enforceSystemOrSystemUI("INotificationManager.getEffectsSuppressor");
+ return mEffectsSuppressor;
+ }
};
private String[] getActiveNotificationKeys(INotificationListener token) {