diff options
author | Selim Cinek <cinek@google.com> | 2015-06-05 13:27:47 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-05 13:27:49 +0000 |
commit | c699b8713080e73be7e479530ea38bf06d0882bb (patch) | |
tree | ea54fc73b1e6e56a0904abb92b7135f742afa197 /packages/SystemUI | |
parent | c92550e4b44da843a530dcde0ed26f221d3df0fc (diff) | |
parent | b18a20f13cc5fc36b84f19bb89a9e479bb1fb4ea (diff) | |
download | frameworks_base-c699b8713080e73be7e479530ea38bf06d0882bb.zip frameworks_base-c699b8713080e73be7e479530ea38bf06d0882bb.tar.gz frameworks_base-c699b8713080e73be7e479530ea38bf06d0882bb.tar.bz2 |
Merge "Fixed a bug with HUNS and dreams" into mnc-dev
Diffstat (limited to 'packages/SystemUI')
3 files changed, 21 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index f05ac1a..6fb4b48 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1902,7 +1902,7 @@ public abstract class BaseStatusBar extends SystemUI implements logUpdate(entry, n); } boolean applyInPlace = shouldApplyInPlace(entry, n); - boolean shouldInterrupt = shouldInterrupt(notification); + boolean shouldInterrupt = shouldInterrupt(entry); boolean alertAgain = alertAgain(entry, n); entry.notification = notification; @@ -2073,7 +2073,8 @@ public abstract class BaseStatusBar extends SystemUI implements || (newNotification.flags & Notification.FLAG_ONLY_ALERT_ONCE) == 0; } - protected boolean shouldInterrupt(StatusBarNotification sbn) { + protected boolean shouldInterrupt(Entry entry) { + StatusBarNotification sbn = entry.notification; if (mNotificationData.shouldFilterOut(sbn)) { if (DEBUG) { Log.d(TAG, "Skipping HUN check for " + sbn.getKey() + " since it's filtered out."); @@ -2098,10 +2099,12 @@ public abstract class BaseStatusBar extends SystemUI implements Notification.HEADS_UP_ALLOWED) != Notification.HEADS_UP_NEVER; boolean accessibilityForcesLaunch = isFullscreen && mAccessibilityManager.isTouchExplorationEnabled(); + boolean justLaunchedFullScreenIntent = entry.hasJustLaunchedFullScreenIntent(); boolean interrupt = (isFullscreen || (isHighPriority && (isNoisy || hasTicker))) && isAllowed && !accessibilityForcesLaunch + && !justLaunchedFullScreenIntent && mPowerManager.isScreenOn() && (!mStatusBarKeyguardViewManager.isShowing() || mStatusBarKeyguardViewManager.isOccluded()) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java index 2a8b4ac..dbabe3f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java @@ -17,6 +17,7 @@ package com.android.systemui.statusbar; import android.app.Notification; +import android.os.SystemClock; import android.service.notification.NotificationListenerService; import android.service.notification.NotificationListenerService.Ranking; import android.service.notification.NotificationListenerService.RankingMap; @@ -41,6 +42,8 @@ public class NotificationData { private HeadsUpManager mHeadsUpManager; public static final class Entry { + private static final long LAUNCH_COOLDOWN = 2000; + private static final long NOT_LAUNCHED_YET = -LAUNCH_COOLDOWN; public String key; public StatusBarNotification notification; public StatusBarIconView icon; @@ -49,6 +52,7 @@ public class NotificationData { public boolean autoRedacted; // whether the redacted notification was generated by us public boolean legacy; // whether the notification has a legacy, dark background public int targetSdk; + private long lastFullScreenIntentLaunchTime = NOT_LAUNCHED_YET; public Entry(StatusBarNotification n, StatusBarIconView ic) { this.key = n.getKey(); @@ -72,6 +76,7 @@ public class NotificationData { // We should fix this at some point. autoRedacted = false; legacy = false; + lastFullScreenIntentLaunchTime = NOT_LAUNCHED_YET; if (row != null) { row.reset(); } @@ -92,6 +97,14 @@ public class NotificationData { public View getPublicContentView() { return row.getPublicLayout().getContractedChild(); } + + public void notifyFullScreenIntentLaunched() { + lastFullScreenIntentLaunchTime = SystemClock.elapsedRealtime(); + } + + public boolean hasJustLaunchedFullScreenIntent() { + return SystemClock.elapsedRealtime() < lastFullScreenIntentLaunchTime + LAUNCH_COOLDOWN; + } } private final ArrayMap<String, Entry> mEntries = new ArrayMap<>(); 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 7c7bec9..984c201 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1153,7 +1153,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, if (shadeEntry == null) { return; } - boolean isHeadsUped = mUseHeadsUp && shouldInterrupt(notification); + boolean isHeadsUped = mUseHeadsUp && shouldInterrupt(shadeEntry); if (isHeadsUped) { mHeadsUpManager.showNotification(shadeEntry); // Mark as seen immediately @@ -1171,6 +1171,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, EventLog.writeEvent(EventLogTags.SYSUI_FULLSCREEN_NOTIFICATION, notification.getKey()); notification.getNotification().fullScreenIntent.send(); + shadeEntry.notifyFullScreenIntentLaunched(); } catch (PendingIntent.CanceledException e) { } } @@ -2045,6 +2046,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, EventLog.writeEvent(EventLogTags.SYSUI_HEADS_UP_ESCALATION, sbn.getKey()); notification.fullScreenIntent.send(); + entry.entry.notifyFullScreenIntentLaunched(); } catch (PendingIntent.CanceledException e) { } } |