summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Selim Cinek <cinek@google.com> 2017-05-30 13:30:59 +0000
committer android-build-merger <android-build-merger@google.com> 2017-05-30 13:30:59 +0000
commite1411aa701b0307cf071daf8e3e6d043a8b1e478 (patch)
tree73ecddf136c6239d09d8bac992661d88b2a78533
parent5454bac39164081dabe7be7a60e572ade74c6e2a (diff)
parent613ac93620694d47f387e8c7fa6f4a635db7d20e (diff)
Merge "Fixed a bug where min-priority were in the middle" into oc-dev am: 7ddf54211f
am: 613ac93620 Change-Id: If2740716c8e5093176a839f880d8681109e63356
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java10
-rw-r--r--services/core/java/com/android/server/notification/RankingHelper.java4
4 files changed, 31 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index a1160de4e042..4a5f83f6b1ed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -91,6 +91,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
}
private LayoutListener mLayoutListener;
+ private boolean mLowPriorityStateUpdated;
private final NotificationInflater mNotificationInflater;
private int mIconTransformContentShift;
private int mIconTransformContentShiftNoIcon;
@@ -1135,6 +1136,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
}
}
+
+ public void setLowPriorityStateUpdated(boolean lowPriorityStateUpdated) {
+ mLowPriorityStateUpdated = lowPriorityStateUpdated;
+ }
+
+ public boolean hasLowPriorityStateUpdated() {
+ return mLowPriorityStateUpdated;
+ }
+
public boolean isLowPriority() {
return mIsLowPriority;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
index 8dab06908001..09aff1b97305 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java
@@ -38,6 +38,7 @@ public class VisualStabilityManager implements OnHeadsUpChangedListener {
private boolean mReorderingAllowed;
private VisibilityLocationProvider mVisibilityLocationProvider;
private ArraySet<View> mAllowedReorderViews = new ArraySet<>();
+ private ArraySet<View> mLowPriorityReorderingViews = new ArraySet<>();
private ArraySet<View> mAddedChildren = new ArraySet<>();
private boolean mPulsing;
@@ -115,6 +116,9 @@ public class VisualStabilityManager implements OnHeadsUpChangedListener {
if (mAddedChildren.contains(row)) {
return true;
}
+ if (mLowPriorityReorderingViews.contains(row)) {
+ return true;
+ }
if (mAllowedReorderViews.contains(row)
&& !mVisibilityLocationProvider.isInVisibleLocation(row)) {
return true;
@@ -130,6 +134,7 @@ public class VisualStabilityManager implements OnHeadsUpChangedListener {
public void onReorderingFinished() {
mAllowedReorderViews.clear();
mAddedChildren.clear();
+ mLowPriorityReorderingViews.clear();
}
@Override
@@ -141,6 +146,10 @@ public class VisualStabilityManager implements OnHeadsUpChangedListener {
}
}
+ public void onLowPriorityUpdated(NotificationData.Entry entry) {
+ mLowPriorityReorderingViews.add(entry.row);
+ }
+
/**
* Notify the visual stability manager that a new view was added and should be allowed to
* reorder next time.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index af325bd2ea87..d087ca0cf307 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -1628,9 +1628,14 @@ public class StatusBar extends SystemUI implements DemoMode,
mPendingNotifications.remove(entry.key);
// If there was an async task started after the removal, we don't want to add it back to
// the list, otherwise we might get leaks.
- if (mNotificationData.get(entry.key) == null && !entry.row.isRemoved()) {
+ boolean isNew = mNotificationData.get(entry.key) == null;
+ if (isNew && !entry.row.isRemoved()) {
addEntry(entry);
+ } else if (!isNew && entry.row.hasLowPriorityStateUpdated()) {
+ mVisualStabilityManager.onLowPriorityUpdated(entry);
+ updateNotificationShade();
}
+ entry.row.setLowPriorityStateUpdated(false);
}
private boolean shouldSuppressFullScreenIntent(String key) {
@@ -6314,7 +6319,10 @@ public class StatusBar extends SystemUI implements DemoMode,
StatusBarNotification sbn, ExpandableNotificationRow row) {
row.setNeedsRedaction(needsRedaction(entry));
boolean isLowPriority = mNotificationData.isAmbient(sbn.getKey());
+ boolean isUpdate = mNotificationData.get(entry.key) != null;
+ boolean wasLowPriority = row.isLowPriority();
row.setIsLowPriority(isLowPriority);
+ row.setLowPriorityStateUpdated(isUpdate && (wasLowPriority != isLowPriority));
// bind the click event to the content area
mNotificationClicker.register(row, sbn);
diff --git a/services/core/java/com/android/server/notification/RankingHelper.java b/services/core/java/com/android/server/notification/RankingHelper.java
index 4c3efce3be5c..2c0cc9585e9f 100644
--- a/services/core/java/com/android/server/notification/RankingHelper.java
+++ b/services/core/java/com/android/server/notification/RankingHelper.java
@@ -447,7 +447,9 @@ public class RankingHelper implements RankingConfig {
boolean isGroupSummary = record.getNotification().isGroupSummary();
record.setGlobalSortKey(
String.format("intrsv=%c:grnk=0x%04x:gsmry=%c:%s:rnk=0x%04x",
- record.isRecentlyIntrusive() ? '0' : '1',
+ record.isRecentlyIntrusive()
+ && record.getImportance() > NotificationManager.IMPORTANCE_MIN
+ ? '0' : '1',
groupProxy.getAuthoritativeRank(),
isGroupSummary ? '0' : '1',
groupSortKeyPortion,