Loading packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java +16 −26 Original line number Diff line number Diff line Loading @@ -234,7 +234,7 @@ public abstract class AlertingNotificationManager { /** * @param key * @return true if the entry is pinned * @return true if the entry is (pinned and expanded) or (has an active remote input) */ public boolean isSticky(String key) { AlertEntry alerting = mAlertEntries.get(key); Loading @@ -256,15 +256,6 @@ public abstract class AlertingNotificationManager { return 0; } @VisibleForTesting public long getCalculatedEarliestRemovalTime(String key) { AlertEntry alerting = mAlertEntries.get(key); if (alerting != null) { return alerting.mEarliestRemovaltime; } return 0; } protected class AlertEntry implements Comparable<AlertEntry> { @Nullable public NotificationEntry mEntry; public long mPostTime; Loading @@ -285,11 +276,6 @@ public abstract class AlertingNotificationManager { updateEntry(true /* updatePostTime */); } @VisibleForTesting long getEarliestRemovaltime() { return mEarliestRemovaltime; } /** * Updates an entry's removal time. * @param updatePostTime whether or not to refresh the post time Loading @@ -305,23 +291,26 @@ public abstract class AlertingNotificationManager { } removeAutoRemovalCallbacks(); if (!isSticky()) { final long finishTime = calculateFinishTime(); final long timeRemaining = isSticky() ? finishTime - mClock.currentTimeMillis() : Math.max(finishTime - now, mMinimumDisplayTime); mHandler.postDelayed(mRemoveAlertRunnable, timeRemaining); final long timeLeft = Math.max(finishTime - now, mMinimumDisplayTime); mHandler.postDelayed(mRemoveAlertRunnable, timeLeft); } } /** * Whether or not the notification is "sticky" i.e. should stay on screen regardless * of the timer and should be removed externally. * of the timer (forever) and should be removed externally. * @return true if the notification is sticky */ public boolean isSticky() { // This implementation is overridden by HeadsUpManager HeadsUpEntry #isSticky // but we keep this here for use by unit tests. return mEntry.isStickyAndNotDemoted(); return false; } public boolean isStickyForSomeTime() { // This implementation is overridden by HeadsUpManager HeadsUpEntry #isStickyForSomeTime return false; } /** Loading Loading @@ -360,8 +349,9 @@ public abstract class AlertingNotificationManager { public void removeAsSoonAsPossible() { if (mRemoveAlertRunnable != null) { removeAutoRemovalCallbacks(); mHandler.postDelayed(mRemoveAlertRunnable, mEarliestRemovaltime - mClock.currentTimeMillis()); final long timeLeft = mEarliestRemovaltime - mClock.currentTimeMillis(); mHandler.postDelayed(mRemoveAlertRunnable, timeLeft); } } Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java +11 −8 Original line number Diff line number Diff line Loading @@ -410,11 +410,14 @@ public abstract class HeadsUpManager extends AlertingNotificationManager { @Override public boolean isSticky() { final boolean isSticky = (mEntry.isRowPinned() && expanded) return (mEntry.isRowPinned() && expanded) || remoteInputActive || hasFullScreenIntent(mEntry) || mEntry.isStickyAndNotDemoted(); return isSticky; || hasFullScreenIntent(mEntry); } @Override public boolean isStickyForSomeTime() { return mEntry.isStickyAndNotDemoted(); } @Override Loading Loading @@ -476,10 +479,10 @@ public abstract class HeadsUpManager extends AlertingNotificationManager { */ @Override protected long calculateFinishTime() { if (isSticky()) { return mEntry.mCreationElapsedRealTime + mStickyDisplayTime; } return mPostTime + getRecommendedHeadsUpTimeoutMs(mAutoDismissNotificationDecay); final long duration = getRecommendedHeadsUpTimeoutMs( isStickyForSomeTime() ? mStickyDisplayTime : mAutoDismissNotificationDecay); return mPostTime + duration; } /** Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/AlertingNotificationManager.java +16 −26 Original line number Diff line number Diff line Loading @@ -234,7 +234,7 @@ public abstract class AlertingNotificationManager { /** * @param key * @return true if the entry is pinned * @return true if the entry is (pinned and expanded) or (has an active remote input) */ public boolean isSticky(String key) { AlertEntry alerting = mAlertEntries.get(key); Loading @@ -256,15 +256,6 @@ public abstract class AlertingNotificationManager { return 0; } @VisibleForTesting public long getCalculatedEarliestRemovalTime(String key) { AlertEntry alerting = mAlertEntries.get(key); if (alerting != null) { return alerting.mEarliestRemovaltime; } return 0; } protected class AlertEntry implements Comparable<AlertEntry> { @Nullable public NotificationEntry mEntry; public long mPostTime; Loading @@ -285,11 +276,6 @@ public abstract class AlertingNotificationManager { updateEntry(true /* updatePostTime */); } @VisibleForTesting long getEarliestRemovaltime() { return mEarliestRemovaltime; } /** * Updates an entry's removal time. * @param updatePostTime whether or not to refresh the post time Loading @@ -305,23 +291,26 @@ public abstract class AlertingNotificationManager { } removeAutoRemovalCallbacks(); if (!isSticky()) { final long finishTime = calculateFinishTime(); final long timeRemaining = isSticky() ? finishTime - mClock.currentTimeMillis() : Math.max(finishTime - now, mMinimumDisplayTime); mHandler.postDelayed(mRemoveAlertRunnable, timeRemaining); final long timeLeft = Math.max(finishTime - now, mMinimumDisplayTime); mHandler.postDelayed(mRemoveAlertRunnable, timeLeft); } } /** * Whether or not the notification is "sticky" i.e. should stay on screen regardless * of the timer and should be removed externally. * of the timer (forever) and should be removed externally. * @return true if the notification is sticky */ public boolean isSticky() { // This implementation is overridden by HeadsUpManager HeadsUpEntry #isSticky // but we keep this here for use by unit tests. return mEntry.isStickyAndNotDemoted(); return false; } public boolean isStickyForSomeTime() { // This implementation is overridden by HeadsUpManager HeadsUpEntry #isStickyForSomeTime return false; } /** Loading Loading @@ -360,8 +349,9 @@ public abstract class AlertingNotificationManager { public void removeAsSoonAsPossible() { if (mRemoveAlertRunnable != null) { removeAutoRemovalCallbacks(); mHandler.postDelayed(mRemoveAlertRunnable, mEarliestRemovaltime - mClock.currentTimeMillis()); final long timeLeft = mEarliestRemovaltime - mClock.currentTimeMillis(); mHandler.postDelayed(mRemoveAlertRunnable, timeLeft); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java +11 −8 Original line number Diff line number Diff line Loading @@ -410,11 +410,14 @@ public abstract class HeadsUpManager extends AlertingNotificationManager { @Override public boolean isSticky() { final boolean isSticky = (mEntry.isRowPinned() && expanded) return (mEntry.isRowPinned() && expanded) || remoteInputActive || hasFullScreenIntent(mEntry) || mEntry.isStickyAndNotDemoted(); return isSticky; || hasFullScreenIntent(mEntry); } @Override public boolean isStickyForSomeTime() { return mEntry.isStickyAndNotDemoted(); } @Override Loading Loading @@ -476,10 +479,10 @@ public abstract class HeadsUpManager extends AlertingNotificationManager { */ @Override protected long calculateFinishTime() { if (isSticky()) { return mEntry.mCreationElapsedRealTime + mStickyDisplayTime; } return mPostTime + getRecommendedHeadsUpTimeoutMs(mAutoDismissNotificationDecay); final long duration = getRecommendedHeadsUpTimeoutMs( isStickyForSomeTime() ? mStickyDisplayTime : mAutoDismissNotificationDecay); return mPostTime + duration; } /** Loading