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

Commit d10413d2 authored by Beverly's avatar Beverly
Browse files

Unregister StatusBarStateListeners from notifs

Test: manual
Fixes: 167384190
Change-Id: Id10865b779170ed7f21c589eaabbf692594b2b20
parent 6da60c5e
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);
    }