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

Commit e33987cc authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[CS] Make NSSLC and NotificationListContainer singletons.

Note on the Dagger module changes: Previously, NSSLC and its
dependencies were part of CentralSurfacesComponent, so the submodules
that included NSSLC's dependencies only needed to be in
CentralSurfacesComponent. Now that NSSLC is a singleton, those
dependencies need to be available *outside* of CentralSurfacesComponent.
NotificationsModule is the logical place for them, because they're
notifications-related.

Now, when NSSLC is injected into CentralSurfacesImpl, it can pull its
dependencies from any modules that SysUI has, which includes
NotificationsModule.

Bug: 277762009
Test: compiles
Test: notifications smoke test (posting new notifs, expanding &
collapsing notifs, swiping notifs away, changing font size &
display scale)
Test: atest CentralSurfacesImplTest
Test: `m
out/soong/.intermediates/vendor/google_arc/packages/system/ArcSystemUI/ArcSystemUI-tests/android_common/kapt/kapt-sources.jar`
succeeds

Change-Id: Ia9c629c7dab06204568a4f04ab1a092db28be467
parent 80c14a30
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -140,7 +140,6 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
                                        .expandableNotificationRow(row)
                                        .notificationEntry(entry)
                                        .onExpandClickListener(mPresenter)
                                        .listContainer(mListContainer)
                                        .build();
                        ExpandableNotificationRowController rowController =
                                component.getExpandableNotificationRowController();
+14 −0
Original line number Diff line number Diff line
@@ -63,8 +63,12 @@ import com.android.systemui.statusbar.notification.logging.NotificationPanelLogg
import com.android.systemui.statusbar.notification.logging.NotificationPanelLoggerImpl;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.notification.row.OnUserInteractionCallback;
import com.android.systemui.statusbar.notification.row.ui.viewmodel.ActivatableNotificationViewModelModule;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.notification.stack.NotificationSectionsManager;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
import com.android.systemui.statusbar.notification.stack.StackScrollAlgorithm;
import com.android.systemui.statusbar.notification.stack.ui.viewmodel.NotificationListViewModelModule;
import com.android.systemui.statusbar.phone.KeyguardBypassController;

import dagger.Binds;
@@ -85,6 +89,8 @@ import javax.inject.Provider;
        ShadeEventsModule.class,
        NotifPipelineChoreographerModule.class,
        NotificationSectionHeadersModule.class,
        NotificationListViewModelModule.class,
        ActivatableNotificationViewModelModule.class,
})
public interface NotificationsModule {
    @Binds
@@ -159,6 +165,14 @@ public interface NotificationsModule {
        }
    }

    /** Provides the container for the notification list. */
    @Provides
    @SysUISingleton
    static NotificationListContainer provideListContainer(
            NotificationStackScrollLayoutController nsslController) {
        return nsslController.getNotificationListContainer();
    }

    /**
     * Provide the active notification collection managing the notifications to render.
     */
+0 −3
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRowController;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.phone.CentralSurfaces;

import dagger.Binds;
@@ -59,8 +58,6 @@ public interface ExpandableNotificationRowComponent {
        Builder notificationEntry(NotificationEntry entry);
        @BindsInstance
        Builder onExpandClickListener(ExpandableNotificationRow.OnExpandClickListener presenter);
        @BindsInstance
        Builder listContainer(NotificationListContainer listContainer);
        ExpandableNotificationRowComponent build();
    }

+2 −2
Original line number Diff line number Diff line
@@ -16,16 +16,16 @@

package com.android.systemui.statusbar.notification.shelf.ui.viewmodel

import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.statusbar.NotificationShelf
import com.android.systemui.statusbar.notification.row.ui.viewmodel.ActivatableNotificationViewModel
import com.android.systemui.statusbar.notification.shelf.domain.interactor.NotificationShelfInteractor
import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent.CentralSurfacesScope
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map

/** ViewModel for [NotificationShelf]. */
@CentralSurfacesScope
@SysUISingleton
class NotificationShelfViewModel
@Inject
constructor(
+3 −3
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import com.android.systemui.Gefingerpoken;
import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor;
import com.android.systemui.classifier.Classifier;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
@@ -118,7 +119,6 @@ import com.android.systemui.statusbar.phone.HeadsUpTouchHelper;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.NotificationIconAreaController;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
@@ -141,7 +141,7 @@ import javax.inject.Named;
/**
 * Controller for {@link NotificationStackScrollLayout}.
 */
@CentralSurfacesComponent.CentralSurfacesScope
@SysUISingleton
public class NotificationStackScrollLayoutController {
    private static final String TAG = "StackScrollerController";
    private static final boolean DEBUG = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.DEBUG);
@@ -1462,7 +1462,7 @@ public class NotificationStackScrollLayoutController {
        return mNotificationRoundnessManager;
    }

    NotificationListContainer getNotificationListContainer() {
    public NotificationListContainer getNotificationListContainer() {
        return mNotificationListContainer;
    }

Loading