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
This commit is contained in:
Dave Mankoff
2020-03-30 15:23:22 -04:00
committed by Steve Elliott
parent 6c12c5d980
commit 33dc1ae112
2 changed files with 22 additions and 15 deletions

View File

@@ -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) {

View File

@@ -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);