Skip to content

Commit e9e3772

Browse files
cwrenAndroid (Google) Code Review
authored andcommitted
Update both views for rich notifications.
Bug: 6475141 Change-Id: I24a87285e6385673c4a08cfa66b211228982a62e
1 parent 855f540 commit e9e3772

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ protected boolean inflateViews(NotificationData.Entry entry, ViewGroup parent)
528528
content.setOnClickListener(null);
529529
}
530530

531+
// TODO(cwren) normalize variable names with those in updateNotification
531532
View expandedOneU = null;
532533
View expandedLarge = null;
533534
Exception exception = null;
@@ -781,32 +782,41 @@ public void updateNotification(IBinder key, StatusBarNotification notification)
781782
final StatusBarNotification oldNotification = oldEntry.notification;
782783

783784
// XXX: modify when we do something more intelligent with the two content views
784-
final RemoteViews oldContentView = (oldNotification.notification.bigContentView != null)
785-
? oldNotification.notification.bigContentView
786-
: oldNotification.notification.contentView;
787-
final RemoteViews contentView = (notification.notification.bigContentView != null)
788-
? notification.notification.bigContentView
789-
: notification.notification.contentView;
785+
final RemoteViews oldContentView = oldNotification.notification.contentView;
786+
final RemoteViews contentView = notification.notification.contentView;
787+
final RemoteViews oldBigContentView = oldNotification.notification.bigContentView;
788+
final RemoteViews bigContentView = notification.notification.bigContentView;
790789

791790
if (DEBUG) {
792791
Slog.d(TAG, "old notification: when=" + oldNotification.notification.when
793792
+ " ongoing=" + oldNotification.isOngoing()
794793
+ " expanded=" + oldEntry.expanded
795794
+ " contentView=" + oldContentView
795+
+ " bigContentView=" + oldBigContentView
796796
+ " rowParent=" + oldEntry.row.getParent());
797797
Slog.d(TAG, "new notification: when=" + notification.notification.when
798798
+ " ongoing=" + oldNotification.isOngoing()
799-
+ " contentView=" + contentView);
799+
+ " contentView=" + contentView
800+
+ " bigContentView=" + bigContentView);
800801
}
801802

802803
// Can we just reapply the RemoteViews in place? If when didn't change, the order
803804
// didn't change.
805+
806+
// 1U is never null
804807
boolean contentsUnchanged = oldEntry.expanded != null
805-
&& contentView != null && oldContentView != null
806808
&& contentView.getPackage() != null
807809
&& oldContentView.getPackage() != null
808810
&& oldContentView.getPackage().equals(contentView.getPackage())
809811
&& oldContentView.getLayoutId() == contentView.getLayoutId();
812+
// large view may be null
813+
boolean bigContentsUnchanged =
814+
(oldEntry.getLargeView() == null && bigContentView == null)
815+
|| ((oldEntry.getLargeView() != null && bigContentView != null)
816+
&& bigContentView.getPackage() != null
817+
&& oldBigContentView.getPackage() != null
818+
&& oldBigContentView.getPackage().equals(bigContentView.getPackage())
819+
&& oldBigContentView.getLayoutId() == bigContentView.getLayoutId());
810820
ViewGroup rowParent = (ViewGroup) oldEntry.row.getParent();
811821
boolean orderUnchanged = notification.notification.when==oldNotification.notification.when
812822
&& notification.score == oldNotification.score;
@@ -816,12 +826,15 @@ public void updateNotification(IBinder key, StatusBarNotification notification)
816826
&& !TextUtils.equals(notification.notification.tickerText,
817827
oldEntry.notification.notification.tickerText);
818828
boolean isTopAnyway = isTopNotification(rowParent, oldEntry);
819-
if (contentsUnchanged && (orderUnchanged || isTopAnyway)) {
829+
if (contentsUnchanged && bigContentsUnchanged && (orderUnchanged || isTopAnyway)) {
820830
if (DEBUG) Slog.d(TAG, "reusing notification for key: " + key);
821831
oldEntry.notification = notification;
822832
try {
823833
// Reapply the RemoteViews
824-
contentView.reapply(mContext, oldEntry.content);
834+
contentView.reapply(mContext, oldEntry.expanded);
835+
if (bigContentView != null && oldEntry.getLargeView() != null) {
836+
bigContentView.reapply(mContext, oldEntry.getLargeView());
837+
}
825838
// update the contentIntent
826839
final PendingIntent contentIntent = notification.notification.contentIntent;
827840
if (contentIntent != null) {

0 commit comments

Comments
 (0)