From 31d9ef7a402b58b10758da1d71ff5e2181abe8a4 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Wed, 15 Apr 2015 19:29:49 -0700 Subject: Fixed the behavior for HUNs with fullscreen intents Now HUNs with full screen intents don't fire automatically when added and don't time out anymore when HUN'd Change-Id: Ic2d5033febe514760cbb4e6e028c3cea84d07cd8 --- .../android/systemui/statusbar/phone/PhoneStatusBar.java | 5 +++-- .../android/systemui/statusbar/policy/HeadsUpManager.java | 14 ++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) 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 61e679a..a5dad92 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1116,11 +1116,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, if (shadeEntry == null) { return; } - if (mUseHeadsUp && shouldInterrupt(notification)) { + boolean isHeadsUped = mUseHeadsUp && shouldInterrupt(notification); + if (isHeadsUped) { mHeadsUpManager.showNotification(shadeEntry); } - if (notification.getNotification().fullScreenIntent != null) { + if (!isHeadsUped && notification.getNotification().fullScreenIntent != null) { // Stop screensaver if the notification has a full-screen intent. // (like an incoming phone call) awakenDreams(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java index 920a0a1..dccf2e2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java @@ -464,15 +464,21 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL public void updateEntry() { long currentTime = mClock.currentTimeMillis(); - postTime = Math.max(postTime, currentTime); - long finishTime = postTime + mHeadsUpNotificationDecay; - long removeDelay = Math.max(finishTime - currentTime, mMinimumDisplayTime); earliestRemovaltime = currentTime + mMinimumDisplayTime; + postTime = Math.max(postTime, currentTime); removeAutoCancelCallbacks(); - mHandler.postDelayed(mRemoveHeadsUpRunnable, removeDelay); + if (canEntryDecay()) { + long finishTime = postTime + mHeadsUpNotificationDecay; + long removeDelay = Math.max(finishTime - currentTime, mMinimumDisplayTime); + mHandler.postDelayed(mRemoveHeadsUpRunnable, removeDelay); + } updateSortOrder(HeadsUpEntry.this); } + private boolean canEntryDecay() { + return entry.notification.getNotification().fullScreenIntent == null; + } + @Override public int compareTo(HeadsUpEntry o) { return postTime < o.postTime ? 1 -- cgit v1.1