summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2018-01-18 19:10:28 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-01-18 19:10:28 +0000
commit8ed2c7f2674b83da26a7a6a7847d2edf43c53d1e (patch)
tree621c417d870ee895447781b675be8abd83b253de
parent3a7684ccf28febb3736cbb2b6f76db399f55ff59 (diff)
parent472f01cf348cdd3f2823f350ea6f110754fe6fa4 (diff)
Merge changes Iaeb8d9c2,Ifa83ce1d
* changes: Fix notification sorting. Remove all caps style
-rw-r--r--packages/SystemUI/res/values/styles.xml1
-rw-r--r--services/core/java/com/android/server/notification/NotificationComparator.java2
-rw-r--r--services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java26
3 files changed, 25 insertions, 4 deletions
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 90c5977e2a67..4837fefd04b2 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -476,7 +476,6 @@
<style name="TextAppearance.NotificationInfo.Button">
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textSize">14sp</item>
- <item name="android:textAllCaps">true</item>
<item name="android:textColor">?android:attr/colorAccent</item>
<item name="android:background">@drawable/btn_borderless_rect</item>
<item name="android:gravity">center</item>
diff --git a/services/core/java/com/android/server/notification/NotificationComparator.java b/services/core/java/com/android/server/notification/NotificationComparator.java
index 4c0092144da9..2584187fffe6 100644
--- a/services/core/java/com/android/server/notification/NotificationComparator.java
+++ b/services/core/java/com/android/server/notification/NotificationComparator.java
@@ -160,7 +160,7 @@ public class NotificationComparator
}
private boolean isCall(NotificationRecord record) {
- return record.getNotification().category == Notification.CATEGORY_CALL
+ return record.isCategory(Notification.CATEGORY_CALL)
&& isDefaultPhoneApp(record.sbn.getPackageName());
}
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java
index 3dcd5b9829da..30fae01f3036 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java
@@ -78,6 +78,8 @@ public class NotificationComparatorTest extends UiServiceTestCase {
private NotificationRecord mRecordCheater;
private NotificationRecord mRecordCheaterColorized;
private NotificationRecord mNoMediaSessionMedia;
+ private NotificationRecord mRecordColorized;
+ private NotificationRecord mRecordColorizedCall;
@Before
public void setUp() {
@@ -113,7 +115,6 @@ public class NotificationComparatorTest extends UiServiceTestCase {
Notification n2 = new Notification.Builder(mContext, TEST_CHANNEL_ID)
.setCategory(Notification.CATEGORY_CALL)
.setFlag(Notification.FLAG_FOREGROUND_SERVICE, true)
- .setColorized(true /* colorized */)
.build();
mRecordHighCall = new NotificationRecord(mContext, new StatusBarNotification(callPkg,
callPkg, 1, "highcall", callUid, callUid, n2,
@@ -200,13 +201,34 @@ public class NotificationComparatorTest extends UiServiceTestCase {
pkg2, pkg2, 1, "cheater", uid2, uid2, n12, new UserHandle(userId),
"", 9258), getDefaultChannel());
mNoMediaSessionMedia.setUserImportance(NotificationManager.IMPORTANCE_DEFAULT);
+
+ Notification n13 = new Notification.Builder(mContext, TEST_CHANNEL_ID)
+ .setFlag(Notification.FLAG_FOREGROUND_SERVICE, true)
+ .setColorized(true /* colorized */)
+ .build();
+ mRecordColorized = new NotificationRecord(mContext, new StatusBarNotification(pkg2,
+ pkg2, 1, "colorized", uid2, uid2, n13,
+ new UserHandle(userId), "", 1999), getDefaultChannel());
+ mRecordHighCall.setUserImportance(NotificationManager.IMPORTANCE_HIGH);
+
+ Notification n14 = new Notification.Builder(mContext, TEST_CHANNEL_ID)
+ .setCategory(Notification.CATEGORY_CALL)
+ .setColorized(true)
+ .setFlag(Notification.FLAG_FOREGROUND_SERVICE, true)
+ .build();
+ mRecordColorizedCall = new NotificationRecord(mContext, new StatusBarNotification(callPkg,
+ callPkg, 1, "colorizedCall", callUid, callUid, n14,
+ new UserHandle(userId), "", 1999), getDefaultChannel());
+ mRecordColorizedCall.setUserImportance(NotificationManager.IMPORTANCE_HIGH);
}
@Test
public void testOrdering() throws Exception {
final List<NotificationRecord> expected = new ArrayList<>();
- expected.add(mRecordHighCall);
+ expected.add(mRecordColorizedCall);
expected.add(mRecordDefaultMedia);
+ expected.add(mRecordColorized);
+ expected.add(mRecordHighCall);
expected.add(mRecordInlineReply);
expected.add(mRecordSms);
expected.add(mRecordStarredContact);