diff options
author | Selim Cinek <cinek@google.com> | 2015-04-17 10:39:11 -0700 |
---|---|---|
committer | Selim Cinek <cinek@google.com> | 2015-04-17 11:02:33 -0700 |
commit | 29fa89b41e15ee61a1ec13307596fe5f5f4c376c (patch) | |
tree | a84b35810687669bab1ee3f37e0fb6208bec873f /packages | |
parent | 31d9ef7a402b58b10758da1d71ff5e2181abe8a4 (diff) | |
download | frameworks_base-29fa89b41e15ee61a1ec13307596fe5f5f4c376c.zip frameworks_base-29fa89b41e15ee61a1ec13307596fe5f5f4c376c.tar.gz frameworks_base-29fa89b41e15ee61a1ec13307596fe5f5f4c376c.tar.bz2 |
Fixed a crash on android tv with the new heads-up manager
Bug: 20282768
Change-Id: Ibb3dc879a2529c12f4d8ab6b031711363da93d37
Diffstat (limited to 'packages')
3 files changed, 49 insertions, 25 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 9f86475..de4874f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -687,13 +687,7 @@ public abstract class BaseStatusBar extends SystemUI implements setHeadsUpUser(newUserId); } - private void setHeadsUpUser(int newUserId) { - mHeadsUpManager.setUser(newUserId); - } - - public boolean isHeadsUp(String key) { - return mHeadsUpManager.isHeadsUp(key); - } + protected abstract void setHeadsUpUser(int newUserId); @Override // NotificationData.Environment public boolean isNotificationForCurrentProfiles(StatusBarNotification n) { @@ -1578,7 +1572,7 @@ public abstract class BaseStatusBar extends SystemUI implements mCurrentUserId); dismissKeyguardThenExecute(new OnDismissAction() { public boolean onDismiss() { - if (mHeadsUpManager.isHeadsUp(mNotificationKey)) { + if (mHeadsUpManager != null && mHeadsUpManager.isHeadsUp(mNotificationKey)) { // Release the HUN notification to the shade. // // In most cases, when FLAG_AUTO_CANCEL is set, the notification will @@ -1941,20 +1935,8 @@ public abstract class BaseStatusBar extends SystemUI implements setAreThereNotifications(); } - private void updateHeadsUp(String key, Entry entry, boolean shouldInterrupt, - boolean alertAgain) { - final boolean wasHeadsUp = isHeadsUp(key); - if (wasHeadsUp) { - mHeadsUpManager.updateNotification(entry, alertAgain); - if (!shouldInterrupt) { - // We don't want this to be interrupting anymore, lets remove it - mHeadsUpManager.removeNotification(key); - } - } else if (shouldInterrupt && alertAgain) { - // This notification was updated to be a heads-up, show it! - mHeadsUpManager.showNotification(entry); - } - } + protected abstract void updateHeadsUp(String key, Entry entry, boolean shouldInterrupt, + boolean alertAgain); private void logUpdate(Entry oldEntry, Notification n) { StatusBarNotification oldNotification = oldEntry.notification; @@ -2075,7 +2057,7 @@ public abstract class BaseStatusBar extends SystemUI implements return false; } - if (mHeadsUpManager.isSnoozed(sbn.getPackageName())) { + if (isSnoozedPackage(sbn)) { return false; } @@ -2109,6 +2091,8 @@ public abstract class BaseStatusBar extends SystemUI implements return interrupt; } + protected abstract boolean isSnoozedPackage(StatusBarNotification sbn); + public void setInteracting(int barWindow, boolean interacting) { // hook for subclasses } 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 a5dad92..7f65f73 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1867,6 +1867,35 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } + protected void updateHeadsUp(String key, Entry entry, boolean shouldInterrupt, + boolean alertAgain) { + final boolean wasHeadsUp = isHeadsUp(key); + if (wasHeadsUp) { + mHeadsUpManager.updateNotification(entry, alertAgain); + if (!shouldInterrupt) { + // We don't want this to be interrupting anymore, lets remove it + mHeadsUpManager.removeNotification(key); + } + } else if (shouldInterrupt && alertAgain) { + // This notification was updated to be a heads-up, show it! + mHeadsUpManager.showNotification(entry); + } + } + + protected void setHeadsUpUser(int newUserId) { + if (mHeadsUpManager != null) { + mHeadsUpManager.setUser(newUserId); + } + } + + public boolean isHeadsUp(String key) { + return mHeadsUpManager.isHeadsUp(key); + } + + protected boolean isSnoozedPackage(StatusBarNotification sbn) { + return mHeadsUpManager.isSnoozed(sbn.getPackageName()); + } + /** * All changes to the status bar and notifications funnel through here and are batched. */ 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 78122d6..dce695d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java @@ -20,8 +20,6 @@ import android.os.IBinder; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; import android.view.View; -import android.view.ViewGroup.LayoutParams; -import android.view.WindowManager; import com.android.internal.statusbar.StatusBarIcon; import com.android.systemui.statusbar.ActivatableNotificationView; @@ -166,4 +164,17 @@ public class TvStatusBar extends BaseStatusBar { @Override public void appTransitionStarting(long startTime, long duration) { } + + @Override + protected void updateHeadsUp(String key, NotificationData.Entry entry, boolean shouldInterrupt, + boolean alertAgain) { + } + + @Override + protected void setHeadsUpUser(int newUserId) { + } + + protected boolean isSnoozedPackage(StatusBarNotification sbn) { + return false; + } } |