Doze: Update tease signal to buzz-beep-blink from NoMan.

Inform SystemUI when NoMan buzzes, beeps or blinks.  Use that
as the notification signal when dozing instead of trying to figure
out interesting panel content updates.

At some point, we should move the entire calculation up into SystemUI
itself, but that's too large of a refactoring to perform now.

Bug:15863249
Change-Id: I40e92334977e0676a1363774c2cbbf91d72ec8e5
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
index 333b8b4..01b30ca 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
@@ -292,6 +292,11 @@
         @Override
         public void onNewNotifications() {
             if (DEBUG) Log.d(mTag, "onNewNotifications");
+            // noop for now
+        }
+        @Override
+        public void onBuzzBeepBlinked() {
+            if (DEBUG) Log.d(mTag, "onBuzzBeepBlinked");
             requestTease();
         }
     };
@@ -305,6 +310,7 @@
 
         public interface Callback {
             void onNewNotifications();
+            void onBuzzBeepBlinked();
         }
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index eb44002..a82c907 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -54,6 +54,7 @@
     private static final int MSG_SET_WINDOW_STATE           = 13 << MSG_SHIFT;
     private static final int MSG_SHOW_RECENT_APPS           = 14 << MSG_SHIFT;
     private static final int MSG_HIDE_RECENT_APPS           = 15 << MSG_SHIFT;
+    private static final int MSG_BUZZ_BEEP_BLINKED          = 16 << MSG_SHIFT;
 
     public static final int FLAG_EXCLUDE_NONE = 0;
     public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
@@ -93,6 +94,7 @@
         public void showSearchPanel();
         public void hideSearchPanel();
         public void setWindowState(int window, int state);
+        public void buzzBeepBlinked();
     }
 
     public CommandQueue(Callbacks callbacks, StatusBarIconList list) {
@@ -221,6 +223,12 @@
         }
     }
 
+    public void buzzBeepBlinked() {
+        synchronized (mList) {
+            mHandler.removeMessages(MSG_BUZZ_BEEP_BLINKED);
+            mHandler.sendEmptyMessage(MSG_BUZZ_BEEP_BLINKED);
+        }
+    }
 
     private final class H extends Handler {
         public void handleMessage(Message msg) {
@@ -295,6 +303,9 @@
                 case MSG_SET_WINDOW_STATE:
                     mCallbacks.setWindowState(msg.arg1, msg.arg2);
                     break;
+                case MSG_BUZZ_BEEP_BLINKED:
+                    mCallbacks.buzzBeepBlinked();
+                    break;
 
             }
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 13fad7b..d089ae6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -2346,6 +2346,13 @@
     }
 
     @Override // CommandQueue
+    public void buzzBeepBlinked() {
+        if (mDozeServiceHost != null) {
+            mDozeServiceHost.fireBuzzBeepBlinked();
+        }
+    }
+
+    @Override // CommandQueue
     public void setSystemUiVisibility(int vis, int mask) {
         final int oldVal = mSystemUiVisibility;
         final int newVal = (oldVal&~mask) | (vis&mask);
@@ -3757,6 +3764,12 @@
 
         private DozeService mCurrentDozeService;
 
+        public void fireBuzzBeepBlinked() {
+            for (Callback callback : mCallbacks) {
+                callback.onBuzzBeepBlinked();
+            }
+        }
+
         public void fireNewNotifications() {
             for (Callback callback : mCallbacks) {
                 callback.onNewNotifications();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
index d0f61f0..a123bf7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
@@ -95,6 +95,10 @@
     public void setWindowState(int window, int state) {
     }
 
+    @Override // CommandQueue
+    public void buzzBeepBlinked() {
+    }
+
     @Override
     protected WindowManager.LayoutParams getSearchLayoutParams(
             LayoutParams layoutParams) {