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

Commit 33dc1ae1 authored by Dave Mankoff's avatar Dave Mankoff Committed by Steve Elliott
Browse files

Move DynamicPrivacyController.Listener off of NSSL

Move DynamicPrivacyController.Listener off of
NotificationStackScrollLayout and onto a field on
its Controller.

Bug: 149989572
Test: atest SystemUITests
Change-Id: Ic165d47af829dc062b89ea10245b950033a3bae5
parent 6c12c5d9
Loading
Loading
Loading
Loading
+3 −13
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ import javax.inject.Named;
 * A layout which handles a dynamic amount of notifications and presents them in a scrollable stack.
 */
public class NotificationStackScrollLayout extends ViewGroup implements ScrollAdapter,
        ConfigurationListener, Dumpable, DynamicPrivacyController.Listener {
        ConfigurationListener, Dumpable {

    public static final float BACKGROUND_ALPHA_DIMMED = 0.7f;
    private static final String TAG = "StackScroller";
@@ -667,7 +667,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
            });
        }

        dynamicPrivacyController.addListener(this);
        mDynamicPrivacyController = dynamicPrivacyController;
        mStatusbarStateController = statusBarStateController;
        initializeForegroundServiceSection(fgsFeatureController);
@@ -5841,17 +5840,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        mDimmedNeedsAnimation = true;
    }

    @Override
    public void onDynamicPrivacyChanged() {
        if (mIsExpanded) {
            // The bottom might change because we're using the final actual height of the view
            mAnimateBottomOnLayout = true;
        }
        // Let's update the footer once the notifications have been updated (in the next frame)
        post(() -> {
            updateFooter();
            updateSectionBoundaries("dynamic privacy changed");
        });
    void setAnimateBottomOnLayout(boolean animateBottomOnLayout) {
        mAnimateBottomOnLayout = animateBottomOnLayout;
    }

    public void setOnPulseHeightChangedListener(Runnable listener) {
+19 −2
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.systemui.statusbar.notification.stack;

import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME;
import static com.android.systemui.statusbar.phone.NotificationIconAreaController.HIGH_PRIORITY;

import android.graphics.PointF;
import android.provider.Settings;
@@ -31,6 +30,7 @@ import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.statusbar.NotificationShelfController;
import com.android.systemui.statusbar.RemoteInputController;
import com.android.systemui.statusbar.notification.ActivityLaunchAnimator;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationActivityStarter;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
@@ -63,22 +63,37 @@ public class NotificationStackScrollLayoutController {
    private final HeadsUpManagerPhone mHeadsUpManager;
    private final NotificationRoundnessManager mNotificationRoundnessManager;
    private final TunerService mTunerService;
    private final DynamicPrivacyController mDynamicPrivacyController;
    private final NotificationListContainerImpl mNotificationListContainer =
            new NotificationListContainerImpl();
    private NotificationStackScrollLayout mView;

    private final DynamicPrivacyController.Listener mDynamicPrivacyControllerListener = () -> {
        if (mView.isExpanded()) {
            // The bottom might change because we're using the final actual height of the view
            mView.setAnimateBottomOnLayout(true);
        }
        // Let's update the footer once the notifications have been updated (in the next frame)
        mView.post(() -> {
            updateFooter();
            updateSectionBoundaries("dynamic privacy changed");
        });
    };

    @Inject
    public NotificationStackScrollLayoutController(
            @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) boolean allowLongPress,
            NotificationGutsManager notificationGutsManager,
            HeadsUpManagerPhone headsUpManager,
            NotificationRoundnessManager notificationRoundnessManager,
            TunerService tunerService) {
            TunerService tunerService,
            DynamicPrivacyController dynamicPrivacyController) {
        mAllowLongPress = allowLongPress;
        mNotificationGutsManager = notificationGutsManager;
        mHeadsUpManager = headsUpManager;
        mNotificationRoundnessManager = notificationRoundnessManager;
        mTunerService = tunerService;
        mDynamicPrivacyController = dynamicPrivacyController;
    }

    public void attach(NotificationStackScrollLayout view) {
@@ -91,6 +106,8 @@ public class NotificationStackScrollLayoutController {

        mHeadsUpManager.addListener(mNotificationRoundnessManager); // TODO: why is this here?

        mDynamicPrivacyController.addListener(mDynamicPrivacyControllerListener);

        mNotificationRoundnessManager.setOnRoundingChangedCallback(mView::invalidate);
        mView.addOnExpandedHeightChangedListener(mNotificationRoundnessManager::setExpanded);