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

Commit b00611cf authored by Dave Mankoff's avatar Dave Mankoff
Browse files

2/3 Remove SuperStatusBarViewFactory#getNotificationShelfController

Refactor its code to live in the StatusBarComponent and
StatusBarViewModule.

Bug: 190746471
Test: atest SystemUITests && manual
Change-Id: Id851da5accd9931d5646886f739c83f67e87179e
parent 0e2230c8
Loading
Loading
Loading
Loading
+1 −39
Original line number Diff line number Diff line
@@ -18,11 +18,9 @@ package com.android.systemui.statusbar;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.statusbar.notification.row.dagger.NotificationShelfComponent;
import com.android.systemui.statusbar.phone.StatusBarWindowView;
import com.android.systemui.util.InjectionInflationController;

@@ -37,18 +35,14 @@ public class SuperStatusBarViewFactory {

    private final Context mContext;
    private final InjectionInflationController mInjectionInflationController;
    private final NotificationShelfComponent.Builder mNotificationShelfComponentBuilder;

    private StatusBarWindowView mStatusBarWindowView;
    private NotificationShelfController mNotificationShelfController;

    @Inject
    public SuperStatusBarViewFactory(Context context,
            InjectionInflationController injectionInflationController,
            NotificationShelfComponent.Builder notificationShelfComponentBuilder) {
            InjectionInflationController injectionInflationController) {
        mContext = context;
        mInjectionInflationController = injectionInflationController;
        mNotificationShelfComponentBuilder = notificationShelfComponentBuilder;
    }

    /**
@@ -70,36 +64,4 @@ public class SuperStatusBarViewFactory {
        }
        return mStatusBarWindowView;
    }

    /**
     * Gets the inflated {@link NotificationShelf} from
     * {@link R.layout#status_bar_notification_shelf}.
     * Returns a cached instance, if it has already been inflated.
     *
     * @param container the expected container to hold the {@link NotificationShelf}. The view
     *                  isn't immediately attached, but the layout params of this view is used
     *                  during inflation.
     */
    public NotificationShelfController getNotificationShelfController(ViewGroup container) {
        if (mNotificationShelfController != null) {
            return mNotificationShelfController;
        }

        NotificationShelf view = (NotificationShelf) LayoutInflater.from(mContext)
                .inflate(R.layout.status_bar_notification_shelf, container, /* attachToRoot= */
                        false);

        if (view == null) {
            throw new IllegalStateException(
                    "R.layout.status_bar_notification_shelf could not be properly inflated");
        }

        NotificationShelfComponent component = mNotificationShelfComponentBuilder
                .notificationShelf(view)
                .build();
        mNotificationShelfController = component.getNotificationShelfController();
        mNotificationShelfController.init();

        return mNotificationShelfController;
    }
}
+3 −9
Original line number Diff line number Diff line
@@ -1107,14 +1107,10 @@ public class StatusBar extends SystemUI implements

        // TODO: Deal with the ugliness that comes from having some of the statusbar broken out
        // into fragments, but the rest here, it leaves some awkward lifecycle and whatnot.
        mStackScrollerController =
                mNotificationPanelViewController.getNotificationStackScrollLayoutController();
        mStackScroller = mStackScrollerController.getView();
        NotificationListContainer notifListContainer =
                mStackScrollerController.getNotificationListContainer();
        mNotificationLogger.setUpWithContainer(notifListContainer);

        inflateShelf();
        mNotificationIconAreaController.setupShelf(mNotificationShelfController);
        mNotificationPanelViewController.addExpansionListener(mWakeUpCoordinator);
        mNotificationPanelViewController.addExpansionListener(
@@ -1526,11 +1522,6 @@ public class StatusBar extends SystemUI implements
        };
    }

    private void inflateShelf() {
        mNotificationShelfController = mSuperStatusBarViewFactory
                .getNotificationShelfController(mStackScroller);
    }

    private void inflateStatusBarWindow() {
        StatusBarComponent statusBarComponent = mStatusBarComponentFactory.create();
        mNotificationShadeWindowView = statusBarComponent.getNotificationShadeWindowView();
@@ -1542,7 +1533,10 @@ public class StatusBar extends SystemUI implements
        mPhoneStatusBarWindow = mSuperStatusBarViewFactory.getStatusBarWindowView();
        mNotificationPanelViewController = statusBarComponent.getNotificationPanelViewController();
        statusBarComponent.getLockIconViewController().init();
        mStackScrollerController = statusBarComponent.getNotificationStackScrollLayoutController();
        mStackScroller = mStackScrollerController.getView();

        mNotificationShelfController = statusBarComponent.getNotificationShelfController();
        mAuthRippleController = statusBarComponent.getAuthRippleController();
        mAuthRippleController.init();

+10 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;

import com.android.keyguard.LockIconViewController;
import com.android.systemui.biometrics.AuthRippleController;
import com.android.systemui.statusbar.NotificationShelfController;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
import com.android.systemui.statusbar.phone.NotificationPanelViewController;
import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
import com.android.systemui.statusbar.phone.NotificationShadeWindowViewController;
@@ -65,6 +67,14 @@ public interface StatusBarComponent {
    @StatusBarScope
    NotificationShadeWindowView getNotificationShadeWindowView();

    /** */
    @StatusBarScope
    NotificationShelfController getNotificationShelfController();

    /** */
    @StatusBarScope
    NotificationStackScrollLayoutController getNotificationStackScrollLayoutController();

    /**
     * Creates a NotificationShadeWindowViewController.
     */
+44 −0
Original line number Diff line number Diff line
@@ -25,6 +25,11 @@ import com.android.keyguard.LockIconView;
import com.android.systemui.R;
import com.android.systemui.battery.BatteryMeterView;
import com.android.systemui.biometrics.AuthRippleView;
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.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
import com.android.systemui.statusbar.phone.NotificationPanelView;
import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
import com.android.systemui.statusbar.phone.TapAgainView;
@@ -58,6 +63,45 @@ public abstract class StatusBarViewModule {
        return notificationShadeWindowView;
    }

    /** */
    @Provides
    @StatusBarComponent.StatusBarScope
    public static NotificationStackScrollLayout providesNotificationStackScrollLayout(
            NotificationStackScrollLayoutController notificationStackScrollLayoutController) {
        return notificationStackScrollLayoutController.getView();
    }

    /** */
    @Provides
    @StatusBarComponent.StatusBarScope
    public static NotificationShelf providesNotificationShelf(LayoutInflater layoutInflater,
            NotificationStackScrollLayout notificationStackScrollLayout) {
        NotificationShelf view = (NotificationShelf) layoutInflater.inflate(
                R.layout.status_bar_notification_shelf, notificationStackScrollLayout, false);

        if (view == null) {
            throw new IllegalStateException(
                    "R.layout.status_bar_notification_shelf could not be properly inflated");
        }
        return view;
    }

    /** */
    @Provides
    @StatusBarComponent.StatusBarScope
    public static NotificationShelfController providesStatusBarWindowView(
            NotificationShelfComponent.Builder notificationShelfComponentBuilder,
            NotificationShelf notificationShelf) {
        NotificationShelfComponent component = notificationShelfComponentBuilder
                .notificationShelf(notificationShelf)
                .build();
        NotificationShelfController notificationShelfController =
                component.getNotificationShelfController();
        notificationShelfController.init();

        return notificationShelfController;
    }

    /** */
    @Provides
    @StatusBarComponent.StatusBarScope