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

Commit 9f29d58b authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[CS] Make StatusBarNotificationPresenter a singleton.

Bug: 277762009
Test: notifications smoke test (can tap notifs, expand & collapse
notifs, changes based on display scale, etc.)
Test: atest CentralSurfacesImplTest

Change-Id: Ib13abe19ce3495399c96be1dae41fcfa5fa10450
parent 872d54fb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ import com.android.systemui.statusbar.phone.ManagedProfileControllerImpl;
import com.android.systemui.statusbar.phone.StatusBarIconController;
import com.android.systemui.statusbar.phone.StatusBarIconControllerImpl;
import com.android.systemui.statusbar.phone.StatusBarIconList;
import com.android.systemui.statusbar.phone.StatusBarNotificationPresenterModule;
import com.android.systemui.statusbar.phone.StatusBarRemoteInputCallback;
import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallController;
import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallFlags;
@@ -96,7 +97,7 @@ import java.util.concurrent.Executor;
 * their own version of CentralSurfaces can include just dependencies, without injecting
 * CentralSurfaces itself.
 */
@Module
@Module(includes = {StatusBarNotificationPresenterModule.class})
public interface CentralSurfacesDependenciesModule {
    /** */
    @SysUISingleton
+3 −2
Original line number Diff line number Diff line
@@ -623,7 +623,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {

    private final ActivityLaunchAnimator mActivityLaunchAnimator;
    private NotificationLaunchAnimatorControllerProvider mNotificationAnimationProvider;
    protected NotificationPresenter mPresenter;
    private final NotificationPresenter mPresenter;
    private NotificationActivityStarter mNotificationActivityStarter;
    private final Lazy<NotificationShadeDepthController> mNotificationShadeDepthControllerLazy;
    private final Optional<Bubbles> mBubblesOptional;
@@ -724,6 +724,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
            Lazy<NotificationShadeWindowViewController> notificationShadeWindowViewControllerLazy,
            NotificationShelfController notificationShelfController,
            NotificationStackScrollLayoutController notificationStackScrollLayoutController,
            NotificationPresenter notificationPresenter,
            DozeParameters dozeParameters,
            ScrimController scrimController,
            Lazy<LockscreenWallpaper> lockscreenWallpaperLazy,
@@ -830,6 +831,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        mStackScrollerController = notificationStackScrollLayoutController;
        mStackScroller = mStackScrollerController.getView();
        mNotifListContainer = mStackScrollerController.getNotificationListContainer();
        mPresenter = notificationPresenter;
        mDozeServiceHost = dozeServiceHost;
        mPowerManager = powerManager;
        mDozeParameters = dozeParameters;
@@ -1604,7 +1606,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        mShadeController.setNotificationShadeWindowViewController(
                getNotificationShadeWindowViewController());
        mBackActionInteractor.setup(mQsController, mShadeSurface);
        mPresenter = mCentralSurfacesComponent.getNotificationPresenter();
        mNotificationActivityStarter = mCentralSurfacesComponent.getNotificationActivityStarter();

        mHeadsUpManager.addListener(mCentralSurfacesComponent.getStatusBarHeadsUpChangeListener());
+2 −2
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.view.View;
import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.InitController;
import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.ActivityStarter.OnDismissAction;
import com.android.systemui.power.domain.interactor.PowerInteractor;
@@ -59,12 +60,11 @@ import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
import com.android.systemui.statusbar.notification.row.NotificationGutsManager.OnSettingsClickListener;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent;
import com.android.systemui.statusbar.policy.KeyguardStateController;

import javax.inject.Inject;

@CentralSurfacesComponent.CentralSurfacesScope
@SysUISingleton
class StatusBarNotificationPresenter implements NotificationPresenter, CommandQueue.Callbacks {
    private static final String TAG = "StatusBarNotificationPresenter";

+0 −5
Original line number Diff line number Diff line
@@ -22,13 +22,11 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;

import com.android.systemui.scene.ui.view.WindowRootView;
import com.android.systemui.shade.ShadeHeaderController;
import com.android.systemui.statusbar.NotificationPresenter;
import com.android.systemui.statusbar.notification.NotificationActivityStarter;
import com.android.systemui.statusbar.phone.CentralSurfacesCommandQueueCallbacks;
import com.android.systemui.statusbar.phone.CentralSurfacesImpl;
import com.android.systemui.statusbar.phone.StatusBarHeadsUpChangeListener;
import com.android.systemui.statusbar.phone.StatusBarNotificationActivityStarterModule;
import com.android.systemui.statusbar.phone.StatusBarNotificationPresenterModule;
import com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment;

import dagger.Subcomponent;
@@ -51,7 +49,6 @@ import javax.inject.Scope;
@Subcomponent(modules = {
        StatusBarViewModule.class,
        StatusBarNotificationActivityStarterModule.class,
        StatusBarNotificationPresenterModule.class,
})
@CentralSurfacesComponent.CentralSurfacesScope
public interface CentralSurfacesComponent {
@@ -97,6 +94,4 @@ public interface CentralSurfacesComponent {
    CollapsedStatusBarFragment createCollapsedStatusBarFragment();

    NotificationActivityStarter getNotificationActivityStarter();

    NotificationPresenter getNotificationPresenter();
}
+1 −1
Original line number Diff line number Diff line
@@ -513,6 +513,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
                mNotificationShadeWindowViewControllerLazy,
                mNotificationShelfController,
                mStackScrollerController,
                mNotificationPresenter,
                mDozeParameters,
                mScrimController,
                mLockscreenWallpaperLazy,
@@ -590,7 +591,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
        // TODO(b/277764509): we should be able to call mCentralSurfaces.start() and have all the
        //  below values initialized automatically.
        mCentralSurfaces.mDozeScrimController = mDozeScrimController;
        mCentralSurfaces.mPresenter = mNotificationPresenter;
        mCentralSurfaces.mKeyguardIndicationController = mKeyguardIndicationController;
        mCentralSurfaces.mBarService = mBarService;
        mCentralSurfaces.mGestureWakeLock = mPowerManager.newWakeLock(