summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-09-01 20:47:16 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-09-01 20:47:16 +0000
commit758601b8d90dba501e247ec23daee66239a4560a (patch)
treec72a648d3c4c460075332ac07bb0e1c55fc7f072
parentdd9c132f6498f9228d5fe8460cfd931bb3cb360d (diff)
parentd10413d2be77c48fd8d4c4ed7a7d2e8fadfc0ba5 (diff)
Merge "Unregister StatusBarStateListeners from notifs"
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java
index 05d9fe757dfd..1d72557c6a89 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java
@@ -145,13 +145,6 @@ public class ExpandableNotificationRowController implements NodeController {
mOnUserInteractionCallback
);
- mStatusBarStateController.addCallback(new StatusBarStateController.StateListener() {
- @Override
- public void onStateChanged(int newState) {
- mView.setOnKeyguard(newState == KEYGUARD);
- }
- });
- mView.setOnKeyguard(mStatusBarStateController.getState() == KEYGUARD);
mView.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
if (mAllowLongPress) {
mView.setLongPressListener((v, x, y, item) -> {
@@ -172,15 +165,26 @@ public class ExpandableNotificationRowController implements NodeController {
mView.getEntry().setInitializationTime(mClock.elapsedRealtime());
mPluginManager.addPluginListener(mView,
NotificationMenuRowPlugin.class, false /* Allow multiple */);
+ mView.setOnKeyguard(mStatusBarStateController.getState() == KEYGUARD);
+ mStatusBarStateController.addCallback(mStatusBarStateListener);
}
@Override
public void onViewDetachedFromWindow(View v) {
mPluginManager.removePluginListener(mView);
+ mStatusBarStateController.removeCallback(mStatusBarStateListener);
}
});
}
+ private final StatusBarStateController.StateListener mStatusBarStateListener =
+ new StatusBarStateController.StateListener() {
+ @Override
+ public void onStateChanged(int newState) {
+ mView.setOnKeyguard(newState == KEYGUARD);
+ }
+ };
+
private void logNotificationExpansion(String key, boolean userAction, boolean expanded) {
mNotificationLogger.onExpansionChanged(key, userAction, expanded);
}