diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 2eb472b2f3a2a..2b96456a8be99 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -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) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index d52b3038f93da..0fe9e8361cb3a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -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);