Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 758601b8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Unregister StatusBarStateListeners from notifs"

parents dd9c132f d10413d2
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -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);
    }