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

Commit c1fd94a4 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Automerger Merge Worker
Browse files

Merge "[Central Surfaces] Make NotificationShelf & classes singletons." into...

Merge "[Central Surfaces] Make NotificationShelf & classes singletons." into udc-qpr-dev am: 267665ed

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23599429



Change-Id: I678e6fc7d5209cf5230063c6c5a00ef672602098
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c5d423cb 267665ed
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -37,6 +37,10 @@ import com.android.systemui.privacy.OngoingPrivacyChip
import com.android.systemui.scene.ui.view.WindowRootView
import com.android.systemui.settings.UserTracker
import com.android.systemui.statusbar.LightRevealScrim
import com.android.systemui.statusbar.NotificationShelf
import com.android.systemui.statusbar.NotificationShelfController
import com.android.systemui.statusbar.notification.row.dagger.NotificationShelfComponent
import com.android.systemui.statusbar.notification.shelf.ui.viewbinder.NotificationShelfViewBinderWrapperControllerImpl
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
import com.android.systemui.statusbar.phone.StatusIconContainer
import com.android.systemui.statusbar.phone.TapAgainView
@@ -49,6 +53,7 @@ import dagger.Provides
import dagger.multibindings.ClassKey
import dagger.multibindings.IntoMap
import javax.inject.Named
import javax.inject.Provider

/** Module for classes related to the notification shade. */
@Module
@@ -102,6 +107,32 @@ abstract class ShadeModule {
            return notificationShadeWindowView.findViewById(R.id.notification_stack_scroller)
        }

        @Provides
        @SysUISingleton
        fun providesNotificationShelfController(
            featureFlags: FeatureFlags,
            newImpl: Provider<NotificationShelfViewBinderWrapperControllerImpl>,
            notificationShelfComponentBuilder: NotificationShelfComponent.Builder,
            layoutInflater: LayoutInflater,
            notificationStackScrollLayout: NotificationStackScrollLayout,
        ): NotificationShelfController {
            return if (featureFlags.isEnabled(Flags.NOTIFICATION_SHELF_REFACTOR)) {
                newImpl.get()
            } else {
                val shelfView =
                    layoutInflater.inflate(
                        R.layout.status_bar_notification_shelf,
                        notificationStackScrollLayout,
                        false
                    ) as NotificationShelf
                val component =
                    notificationShelfComponentBuilder.notificationShelf(shelfView).build()
                val notificationShelfController = component.notificationShelfController
                notificationShelfController.init()
                notificationShelfController
            }
        }

        // TODO(b/277762009): Only allow this view's controller to inject the view. See above.
        @Provides
        @SysUISingleton
+2 −2
Original line number Diff line number Diff line
@@ -17,19 +17,19 @@
package com.android.systemui.statusbar.notification.shelf.domain.interactor

import android.os.PowerManager
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.data.repository.DeviceEntryFaceAuthRepository
import com.android.systemui.keyguard.data.repository.KeyguardRepository
import com.android.systemui.statusbar.LockscreenShadeTransitionController
import com.android.systemui.statusbar.NotificationShelf
import com.android.systemui.statusbar.phone.CentralSurfaces
import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent
import com.android.systemui.util.time.SystemClock
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine

/** Interactor for the [NotificationShelf] */
@CentralSurfacesComponent.CentralSurfacesScope
@SysUISingleton
class NotificationShelfInteractor
@Inject
constructor(
+2 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification.shelf.ui.viewbinder
import android.view.View
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.lifecycle.repeatWhenAttached
@@ -32,7 +33,6 @@ import com.android.systemui.statusbar.notification.stack.AmbientState
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController
import com.android.systemui.statusbar.phone.NotificationIconAreaController
import com.android.systemui.statusbar.phone.NotificationIconContainer
import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent.CentralSurfacesScope
import javax.inject.Inject
import kotlinx.coroutines.awaitCancellation
import kotlinx.coroutines.launch
@@ -43,7 +43,7 @@ import kotlinx.coroutines.launch
 * [NotificationShelfController] interface. Once the [LegacyNotificationShelfControllerImpl] is
 * removed, this class can go away and the ViewBinder can be used directly.
 */
@CentralSurfacesScope
@SysUISingleton
class NotificationShelfViewBinderWrapperControllerImpl @Inject constructor() :
    NotificationShelfController {

+3 −2
Original line number Diff line number Diff line
@@ -746,6 +746,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
            Lazy<AssistManager> assistManagerLazy,
            ConfigurationController configurationController,
            NotificationShadeWindowController notificationShadeWindowController,
            NotificationShelfController notificationShelfController,
            DozeParameters dozeParameters,
            ScrimController scrimController,
            Lazy<LockscreenWallpaper> lockscreenWallpaperLazy,
@@ -842,6 +843,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        mAssistManagerLazy = assistManagerLazy;
        mConfigurationController = configurationController;
        mNotificationShadeWindowController = notificationShadeWindowController;
        mNotificationShelfController = notificationShelfController;
        mDozeServiceHost = dozeServiceHost;
        mPowerManager = powerManager;
        mDozeParameters = dozeParameters;
@@ -1652,7 +1654,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        mNotifListContainer = mCentralSurfacesComponent.getNotificationListContainer();
        mPresenter = mCentralSurfacesComponent.getNotificationPresenter();
        mNotificationActivityStarter = mCentralSurfacesComponent.getNotificationActivityStarter();
        mNotificationShelfController = mCentralSurfacesComponent.getNotificationShelfController();

        mHeadsUpManager.addListener(mCentralSurfacesComponent.getStatusBarHeadsUpChangeListener());

@@ -3410,7 +3411,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
    protected Display mDisplay;
    private int mDisplayId;

    protected NotificationShelfController mNotificationShelfController;
    private final NotificationShelfController mNotificationShelfController;

    private final Lazy<AssistManager> mAssistManagerLazy;

+0 −4
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import com.android.systemui.shade.NotificationShadeWindowViewController;
import com.android.systemui.shade.QuickSettingsController;
import com.android.systemui.shade.ShadeHeaderController;
import com.android.systemui.statusbar.NotificationPresenter;
import com.android.systemui.statusbar.NotificationShelfController;
import com.android.systemui.statusbar.notification.NotificationActivityStarter;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
@@ -88,9 +87,6 @@ public interface CentralSurfacesComponent {
     */
    NotificationShadeWindowView getNotificationShadeWindowView();

    /** */
    NotificationShelfController getNotificationShelfController();

    /** */
    NotificationStackScrollLayoutController getNotificationStackScrollLayoutController();

Loading