summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/statusbar
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2014-08-03 22:58:28 -0400
committerJohn Spurlock <jspurlock@google.com>2014-08-04 11:32:18 -0400
commitcb566aab57cafb69c628809fc0a0ffa2151c7d6e (patch)
tree619b8dee42537cc2a71f7a198fbaf3e9757e05f5 /packages/SystemUI/src/com/android/systemui/statusbar
parent3e137eb2b1c638c271d6dc5b53da30550bee1fe0 (diff)
downloadframeworks_base-cb566aab57cafb69c628809fc0a0ffa2151c7d6e.zip
frameworks_base-cb566aab57cafb69c628809fc0a0ffa2151c7d6e.tar.gz
frameworks_base-cb566aab57cafb69c628809fc0a0ffa2151c7d6e.tar.bz2
Doze: Follow the notification light.
- Send the notification light info up to SystemUI from NoMan. - Doze mode will now periodically pulse the display (once) if the notification light is active. - Change "tease" terminology to "pulse", which is the singular. Maintain the multi-pulse on buzz-beep-blink for now as extra emphasis. - Scrim controller now always takes number of pulses as an arg, to support a single pulse (used for notification light, and eventually pickup once available). - Dial down the display brightness when pulsing. Bug:15863249 Change-Id: Ifb208a27e82b66cff1d0c04e5b7f758098ea29cf
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java24
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java34
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java71
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java8
4 files changed, 93 insertions, 44 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index a82c907..9107790 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -55,6 +55,8 @@ public class CommandQueue extends IStatusBar.Stub {
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;
+ private static final int MSG_NOTIFICATION_LIGHT_OFF = 17 << MSG_SHIFT;
+ private static final int MSG_NOTIFICATION_LIGHT_PULSE = 18 << MSG_SHIFT;
public static final int FLAG_EXCLUDE_NONE = 0;
public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0;
@@ -95,6 +97,8 @@ public class CommandQueue extends IStatusBar.Stub {
public void hideSearchPanel();
public void setWindowState(int window, int state);
public void buzzBeepBlinked();
+ public void notificationLightOff();
+ public void notificationLightPulse(int argb, int onMillis, int offMillis);
}
public CommandQueue(Callbacks callbacks, StatusBarIconList list) {
@@ -230,6 +234,19 @@ public class CommandQueue extends IStatusBar.Stub {
}
}
+ public void notificationLightOff() {
+ synchronized (mList) {
+ mHandler.sendEmptyMessage(MSG_NOTIFICATION_LIGHT_OFF);
+ }
+ }
+
+ public void notificationLightPulse(int argb, int onMillis, int offMillis) {
+ synchronized (mList) {
+ mHandler.obtainMessage(MSG_NOTIFICATION_LIGHT_PULSE, onMillis, offMillis, argb)
+ .sendToTarget();
+ }
+ }
+
private final class H extends Handler {
public void handleMessage(Message msg) {
final int what = msg.what & MSG_MASK;
@@ -306,7 +323,12 @@ public class CommandQueue extends IStatusBar.Stub {
case MSG_BUZZ_BEEP_BLINKED:
mCallbacks.buzzBeepBlinked();
break;
-
+ case MSG_NOTIFICATION_LIGHT_OFF:
+ mCallbacks.notificationLightOff();
+ break;
+ case MSG_NOTIFICATION_LIGHT_PULSE:
+ mCallbacks.notificationLightPulse((Integer) msg.obj, msg.arg1, msg.arg2);
+ 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 e38bada..99b0259 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -2336,6 +2336,20 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
}
+ @Override
+ public void notificationLightOff() {
+ if (mDozeServiceHost != null) {
+ mDozeServiceHost.fireNotificationLight(false);
+ }
+ }
+
+ @Override
+ public void notificationLightPulse(int argb, int onMillis, int offMillis) {
+ if (mDozeServiceHost != null) {
+ mDozeServiceHost.fireNotificationLight(true);
+ }
+ }
+
@Override // CommandQueue
public void setSystemUiVisibility(int vis, int mask) {
final int oldVal = mSystemUiVisibility;
@@ -3799,6 +3813,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
}
+ public void fireNotificationLight(boolean on) {
+ for (Callback callback : mCallbacks) {
+ callback.onNotificationLight(on);
+ }
+ }
+
public void fireNewNotifications() {
for (Callback callback : mCallbacks) {
callback.onNewNotifications();
@@ -3823,10 +3843,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
@Override
- public void requestTease(DozeService dozeService) {
+ public void requestPulse(int pulses, DozeService dozeService) {
if (dozeService == null) return;
dozeService.stayAwake(PROCESSING_TIME);
- mHandler.obtainMessage(H.REQUEST_TEASE, dozeService).sendToTarget();
+ mHandler.obtainMessage(H.REQUEST_PULSE, pulses, 0, dozeService).sendToTarget();
}
@Override
@@ -3845,9 +3865,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mCurrentDozeService.startDozing();
}
- private void handleRequestTease(DozeService dozeService) {
+ private void handleRequestPulse(int pulses, DozeService dozeService) {
if (!dozeService.equals(mCurrentDozeService)) return;
- final long stayAwake = mScrimController.tease();
+ final long stayAwake = mScrimController.pulse(pulses);
mCurrentDozeService.stayAwake(stayAwake);
}
@@ -3863,15 +3883,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
private final class H extends Handler {
private static final int REQUEST_DOZE = 1;
- private static final int REQUEST_TEASE = 2;
+ private static final int REQUEST_PULSE = 2;
private static final int DOZING_STOPPED = 3;
@Override
public void handleMessage(Message msg) {
if (msg.what == REQUEST_DOZE) {
handleRequestDoze((DozeService) msg.obj);
- } else if (msg.what == REQUEST_TEASE) {
- handleRequestTease((DozeService) msg.obj);
+ } else if (msg.what == REQUEST_PULSE) {
+ handleRequestPulse(msg.arg1, (DozeService) msg.obj);
} else if (msg.what == DOZING_STOPPED) {
handleDozingStopped((DozeService) msg.obj);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index 7bce664..cbd66aa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -43,14 +43,13 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener {
private static final long ANIMATION_DURATION = 220;
private static final int TAG_KEY_ANIM = R.id.scrim;
- private static final int NUM_TEASES = 3;
- private static final long TEASE_IN_ANIMATION_DURATION = 1000;
- private static final long TEASE_VISIBLE_DURATION = 2000;
- private static final long TEASE_OUT_ANIMATION_DURATION = 1000;
- private static final long TEASE_INVISIBLE_DURATION = 1000;
- private static final long TEASE_DURATION = TEASE_IN_ANIMATION_DURATION
- + TEASE_VISIBLE_DURATION + TEASE_OUT_ANIMATION_DURATION + TEASE_INVISIBLE_DURATION;
- private static final long PRE_TEASE_DELAY = 1000;
+ private static final long PULSE_IN_ANIMATION_DURATION = 1000;
+ private static final long PULSE_VISIBLE_DURATION = 2000;
+ private static final long PULSE_OUT_ANIMATION_DURATION = 1000;
+ private static final long PULSE_INVISIBLE_DURATION = 1000;
+ private static final long PULSE_DURATION = PULSE_IN_ANIMATION_DURATION
+ + PULSE_VISIBLE_DURATION + PULSE_OUT_ANIMATION_DURATION + PULSE_INVISIBLE_DURATION;
+ private static final long PRE_PULSE_DELAY = 1000;
private final View mScrimBehind;
private final View mScrimInFront;
@@ -70,7 +69,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener {
private Runnable mOnAnimationFinished;
private boolean mAnimationStarted;
private boolean mDozing;
- private int mTeasesRemaining;
+ private int mPulsesRemaining;
private final Interpolator mInterpolator = new DecelerateInterpolator();
public ScrimController(View scrimBehind, View scrimInFront) {
@@ -126,23 +125,23 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener {
if (mDozing == dozing) return;
mDozing = dozing;
if (!mDozing) {
- cancelTeasing();
+ cancelPulsing();
}
scheduleUpdate();
}
/** When dozing, fade screen contents in and out a few times using the front scrim. */
- public long tease() {
+ public long pulse(int pulses) {
if (!mDozing) return 0;
- mTeasesRemaining = NUM_TEASES;
- mScrimInFront.postDelayed(mTeaseIn, PRE_TEASE_DELAY);
- return PRE_TEASE_DELAY + NUM_TEASES * TEASE_DURATION;
+ mPulsesRemaining = Math.max(pulses, mPulsesRemaining);
+ mScrimInFront.postDelayed(mPulseIn, PRE_PULSE_DELAY);
+ return PRE_PULSE_DELAY + mPulsesRemaining * PULSE_DURATION;
}
- private void cancelTeasing() {
- mTeasesRemaining = 0;
- mScrimInFront.removeCallbacks(mTeaseIn);
- mScrimInFront.removeCallbacks(mTeaseOut);
+ private void cancelPulsing() {
+ mPulsesRemaining = 0;
+ mScrimInFront.removeCallbacks(mPulseIn);
+ mScrimInFront.removeCallbacks(mPulseOut);
}
private void scheduleUpdate() {
@@ -285,49 +284,49 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener {
return true;
}
- private final Runnable mTeaseIn = new Runnable() {
+ private final Runnable mPulseIn = new Runnable() {
@Override
public void run() {
- if (DEBUG) Log.d(TAG, "Tease in, mDozing=" + mDozing
- + " mTeasesRemaining=" + mTeasesRemaining);
- if (!mDozing || mTeasesRemaining == 0) return;
- mTeasesRemaining--;
- mDurationOverride = TEASE_IN_ANIMATION_DURATION;
+ if (DEBUG) Log.d(TAG, "Pulse in, mDozing=" + mDozing
+ + " mPulsesRemaining=" + mPulsesRemaining);
+ if (!mDozing || mPulsesRemaining == 0) return;
+ mPulsesRemaining--;
+ mDurationOverride = PULSE_IN_ANIMATION_DURATION;
mAnimationDelay = 0;
mAnimateChange = true;
- mOnAnimationFinished = mTeaseInFinished;
+ mOnAnimationFinished = mPulseInFinished;
setScrimColor(mScrimInFront, 0);
}
};
- private final Runnable mTeaseInFinished = new Runnable() {
+ private final Runnable mPulseInFinished = new Runnable() {
@Override
public void run() {
- if (DEBUG) Log.d(TAG, "Tease in finished, mDozing=" + mDozing);
+ if (DEBUG) Log.d(TAG, "Pulse in finished, mDozing=" + mDozing);
if (!mDozing) return;
- mScrimInFront.postDelayed(mTeaseOut, TEASE_VISIBLE_DURATION);
+ mScrimInFront.postDelayed(mPulseOut, PULSE_VISIBLE_DURATION);
}
};
- private final Runnable mTeaseOut = new Runnable() {
+ private final Runnable mPulseOut = new Runnable() {
@Override
public void run() {
- if (DEBUG) Log.d(TAG, "Tease in finished, mDozing=" + mDozing);
+ if (DEBUG) Log.d(TAG, "Pulse out, mDozing=" + mDozing);
if (!mDozing) return;
- mDurationOverride = TEASE_OUT_ANIMATION_DURATION;
+ mDurationOverride = PULSE_OUT_ANIMATION_DURATION;
mAnimationDelay = 0;
mAnimateChange = true;
- mOnAnimationFinished = mTeaseOutFinished;
+ mOnAnimationFinished = mPulseOutFinished;
setScrimColor(mScrimInFront, 1);
}
};
- private final Runnable mTeaseOutFinished = new Runnable() {
+ private final Runnable mPulseOutFinished = new Runnable() {
@Override
public void run() {
- if (DEBUG) Log.d(TAG, "Tease out finished, mTeasesRemaining=" + mTeasesRemaining);
- if (mTeasesRemaining > 0) {
- mScrimInFront.postDelayed(mTeaseIn, TEASE_INVISIBLE_DURATION);
+ if (DEBUG) Log.d(TAG, "Pulse out finished, mPulsesRemaining=" + mPulsesRemaining);
+ if (mPulsesRemaining > 0) {
+ mScrimInFront.postDelayed(mPulseIn, PULSE_INVISIBLE_DURATION);
}
}
};
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 a123bf7..049add5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
@@ -99,6 +99,14 @@ public class TvStatusBar extends BaseStatusBar {
public void buzzBeepBlinked() {
}
+ @Override // CommandQueue
+ public void notificationLightOff() {
+ }
+
+ @Override // CommandQueue
+ public void notificationLightPulse(int argb, int onMillis, int offMillis) {
+ }
+
@Override
protected WindowManager.LayoutParams getSearchLayoutParams(
LayoutParams layoutParams) {