Merge "Fix NPE when ranking update causes reinflation" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-04-16 17:49:29 +00:00
committed by Android (Google) Code Review
3 changed files with 11 additions and 6 deletions

View File

@@ -699,7 +699,8 @@ public class NotificationEntryManager implements
entry, entry,
oldImportances.get(entry.getKey()), oldImportances.get(entry.getKey()),
oldAdjustments.get(entry.getKey()), oldAdjustments.get(entry.getKey()),
NotificationUiAdjustment.extractFromNotificationEntry(entry)); NotificationUiAdjustment.extractFromNotificationEntry(entry),
mInflationCallback);
} }
updateNotifications("updateNotificationRanking"); updateNotifications("updateNotificationRanking");

View File

@@ -51,5 +51,6 @@ public interface NotificationRowBinder {
NotificationEntry entry, NotificationEntry entry,
@Nullable Integer oldImportance, @Nullable Integer oldImportance,
NotificationUiAdjustment oldAdjustment, NotificationUiAdjustment oldAdjustment,
NotificationUiAdjustment newAdjustment); NotificationUiAdjustment newAdjustment,
NotificationRowContentBinder.InflationCallback callback);
} }

View File

@@ -180,13 +180,14 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
NotificationEntry entry, NotificationEntry entry,
@Nullable Integer oldImportance, @Nullable Integer oldImportance,
NotificationUiAdjustment oldAdjustment, NotificationUiAdjustment oldAdjustment,
NotificationUiAdjustment newAdjustment) { NotificationUiAdjustment newAdjustment,
NotificationRowContentBinder.InflationCallback callback) {
if (NotificationUiAdjustment.needReinflate(oldAdjustment, newAdjustment)) { if (NotificationUiAdjustment.needReinflate(oldAdjustment, newAdjustment)) {
if (entry.rowExists()) { if (entry.rowExists()) {
ExpandableNotificationRow row = entry.getRow(); ExpandableNotificationRow row = entry.getRow();
row.reset(); row.reset();
updateRow(entry, row); updateRow(entry, row);
inflateContentViews(entry, row, null /* callback */); inflateContentViews(entry, row, callback);
} else { } else {
// Once the RowInflaterTask is done, it will pick up the updated entry, so // Once the RowInflaterTask is done, it will pick up the updated entry, so
// no-op here. // no-op here.
@@ -221,7 +222,7 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
private void inflateContentViews( private void inflateContentViews(
NotificationEntry entry, NotificationEntry entry,
ExpandableNotificationRow row, ExpandableNotificationRow row,
NotificationRowContentBinder.InflationCallback inflationCallback) { @Nullable NotificationRowContentBinder.InflationCallback inflationCallback) {
final boolean useIncreasedCollapsedHeight = final boolean useIncreasedCollapsedHeight =
mMessagingUtil.isImportantMessaging(entry.getSbn(), entry.getImportance()); mMessagingUtil.isImportantMessaging(entry.getSbn(), entry.getImportance());
final boolean isLowPriority = entry.isAmbient(); final boolean isLowPriority = entry.isAmbient();
@@ -238,7 +239,9 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
mRowContentBindStage.requestRebind(entry, en -> { mRowContentBindStage.requestRebind(entry, en -> {
row.setUsesIncreasedCollapsedHeight(useIncreasedCollapsedHeight); row.setUsesIncreasedCollapsedHeight(useIncreasedCollapsedHeight);
row.setIsLowPriority(isLowPriority); row.setIsLowPriority(isLowPriority);
if (inflationCallback != null) {
inflationCallback.onAsyncInflationFinished(en); inflationCallback.onAsyncInflationFinished(en);
}
}); });
} }