summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-05-20 00:54:42 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-05-20 00:54:42 +0000
commite39c2e7e61ebcab215af5bd7c9c6525bd4b76f35 (patch)
tree680cd36bf9393b2b4e773e8d789db2cf3ce4a7f4
parent4acc0902c6d6ad1aac3834b2a14ae421ee8d8f81 (diff)
parentc12d38f0b36ba095398d93b9c1198cd8dcb2f997 (diff)
Merge "Fix NPE when content visibility changes" into rvc-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
index e9849ec84987..9925909c3e16 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
@@ -64,6 +64,7 @@ import com.android.systemui.statusbar.policy.SmartReplyView;
import java.io.FileDescriptor;
import java.io.PrintWriter;
+import java.util.ArrayList;
/**
* A frame layout containing the actual payload of the notification, including the contracted,
@@ -518,9 +519,12 @@ public class NotificationContentView extends FrameLayout {
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
updateVisibility();
- if (visibility != VISIBLE) {
+ if (visibility != VISIBLE && !mOnContentViewInactiveListeners.isEmpty()) {
// View is no longer visible so all content views are inactive.
- for (Runnable r : mOnContentViewInactiveListeners.values()) {
+ // Clone list as runnables may modify the list of listeners
+ ArrayList<Runnable> listeners = new ArrayList<>(
+ mOnContentViewInactiveListeners.values());
+ for (Runnable r : listeners) {
r.run();
}
mOnContentViewInactiveListeners.clear();