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

Commit 649012b8 authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "Begin Migrate NSSL" into udc-qpr-dev

parents 4222ffd0 dffc0f9c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -76,6 +76,13 @@
             android:layout_height="match_parent"
             android:visibility="invisible" />

    <!-- Shared container for the notification stack. Can be positioned by either
         the keyguard_root_view or notification_panel -->
    <com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer
        android:id="@+id/shared_notification_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <include layout="@layout/brightness_mirror_container" />

    <com.android.systemui.scrim.ScrimView
+1 −0
Original line number Diff line number Diff line
@@ -211,6 +211,7 @@
    <item type="id" name="keyguard_indication_area" />
    <item type="id" name="keyguard_indication_text" />
    <item type="id" name="keyguard_indication_text_bottom" />
    <item type="id" name="nssl_guideline" />
    <item type="id" name="lock_icon" />
    <item type="id" name="lock_icon_bg" />
</resources>
+23 −0
Original line number Diff line number Diff line
@@ -31,6 +31,9 @@ import com.android.systemui.keyguard.ui.view.layout.KeyguardLayoutManagerCommand
import com.android.systemui.keyguard.ui.viewmodel.KeyguardIndicationAreaViewModel
import com.android.systemui.shade.NotificationShadeWindowView
import com.android.systemui.statusbar.KeyguardIndicationController
import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer
import com.android.systemui.statusbar.notification.stack.ui.viewbinder.SharedNotificationContainerBinder
import com.android.systemui.statusbar.notification.stack.ui.viewmodel.SharedNotificationContainerViewModel
import javax.inject.Inject
import kotlinx.coroutines.DisposableHandle

@@ -40,7 +43,9 @@ class KeyguardViewConfigurator
@Inject
constructor(
    private val keyguardRootView: KeyguardRootView,
    private val sharedNotificationContainer: SharedNotificationContainer,
    private val keyguardIndicationAreaViewModel: KeyguardIndicationAreaViewModel,
    private val sharedNotificationContainerViewModel: SharedNotificationContainerViewModel,
    private val notificationShadeWindowView: NotificationShadeWindowView,
    private val featureFlags: FeatureFlags,
    private val indicationController: KeyguardIndicationController,
@@ -55,10 +60,28 @@ constructor(
            notificationShadeWindowView.requireViewById(R.id.notification_panel) as ViewGroup
        bindIndicationArea(notificationPanel)
        bindLockIconView(notificationPanel)
        setupNotificationStackScrollLayout(notificationPanel)

        keyguardLayoutManager.layoutViews()
        keyguardLayoutManagerCommandListener.start()
    }

    fun setupNotificationStackScrollLayout(legacyParent: ViewGroup) {
        if (featureFlags.isEnabled(Flags.MIGRATE_NSSL)) {
            // This moves the existing NSSL view to a different parent, as the controller is a
            // singleton and recreating it has other bad side effects
            val nssl =
                legacyParent.requireViewById<View>(R.id.notification_stack_scroller).also {
                    (it.getParent() as ViewGroup).removeView(it)
                }
            sharedNotificationContainer.addNotificationStackScrollLayout(nssl)
            SharedNotificationContainerBinder.bind(
                sharedNotificationContainer,
                sharedNotificationContainerViewModel
            )
        }
    }

    fun bindIndicationArea(legacyParent: ViewGroup) {
        indicationAreaHandle?.dispose()

+19 −7
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ import androidx.constraintlayout.widget.ConstraintSet.TOP
import com.android.systemui.R
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.fragments.FragmentService
import com.android.systemui.navigationbar.NavigationModeController
import com.android.systemui.plugins.qs.QS
@@ -36,6 +38,7 @@ import com.android.systemui.plugins.qs.QSContainerController
import com.android.systemui.recents.OverviewProxyService
import com.android.systemui.recents.OverviewProxyService.OverviewProxyListener
import com.android.systemui.shared.system.QuickStepContract
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController
import com.android.systemui.util.LargeScreenUtils
import com.android.systemui.util.ViewController
import com.android.systemui.util.concurrency.DelayableExecutor
@@ -54,7 +57,10 @@ class NotificationsQSContainerController @Inject constructor(
        private val shadeHeaderController: ShadeHeaderController,
        private val shadeExpansionStateManager: ShadeExpansionStateManager,
        private val fragmentService: FragmentService,
        @Main private val delayableExecutor: DelayableExecutor
        @Main private val delayableExecutor: DelayableExecutor,
        private val featureFlags: FeatureFlags,
        private val
            notificationStackScrollLayoutController: NotificationStackScrollLayoutController,
) : ViewController<NotificationsQuickSettingsContainer>(view), QSContainerController {

    private var qsExpanded = false
@@ -118,6 +124,9 @@ class NotificationsQSContainerController @Inject constructor(
            isGestureNavigation = QuickStepContract.isGesturalMode(mode)
        }
        isGestureNavigation = QuickStepContract.isGesturalMode(currentMode)

        mView.setStackScroller(notificationStackScrollLayoutController.getView())
        mView.setMigratingNSSL(featureFlags.isEnabled(Flags.MIGRATE_NSSL))
    }

    public override fun onViewAttached() {
@@ -254,14 +263,17 @@ class NotificationsQSContainerController @Inject constructor(
    }

    private fun setNotificationsConstraints(constraintSet: ConstraintSet) {
        if (featureFlags.isEnabled(Flags.MIGRATE_NSSL)) {
            return
        }
        val startConstraintId = if (splitShadeEnabled) R.id.qs_edge_guideline else PARENT_ID
        val nsslId = R.id.notification_stack_scroller
        constraintSet.apply {
            connect(R.id.notification_stack_scroller, START, startConstraintId, START)
            setMargin(R.id.notification_stack_scroller, START,
                    if (splitShadeEnabled) 0 else panelMarginHorizontal)
            setMargin(R.id.notification_stack_scroller, END, panelMarginHorizontal)
            setMargin(R.id.notification_stack_scroller, TOP, topMargin)
            setMargin(R.id.notification_stack_scroller, BOTTOM, notificationsBottomMargin)
            connect(nsslId, START, startConstraintId, START)
            setMargin(nsslId, START, if (splitShadeEnabled) 0 else panelMarginHorizontal)
            setMargin(nsslId, END, panelMarginHorizontal)
            setMargin(nsslId, TOP, topMargin)
            setMargin(nsslId, BOTTOM, notificationsBottomMargin)
        }
    }

+14 −2
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.WindowInsets;

import androidx.annotation.Nullable;
@@ -56,6 +57,7 @@ public class NotificationsQuickSettingsContainer extends ConstraintLayout
    private QS mQs;
    private View mQSContainer;
    private int mLastQSPaddingBottom;
    private boolean mIsMigratingNSSL;

    /**
     *  These are used to compute the bounding box containing the shade and the notification scrim,
@@ -75,10 +77,13 @@ public class NotificationsQuickSettingsContainer extends ConstraintLayout
    protected void onFinishInflate() {
        super.onFinishInflate();
        mQsFrame = findViewById(R.id.qs_frame);
        mStackScroller = findViewById(R.id.notification_stack_scroller);
        mKeyguardStatusBar = findViewById(R.id.keyguard_header);
    }

    void setStackScroller(View stackScroller) {
        mStackScroller = stackScroller;
    }

    @Override
    public void onFragmentViewCreated(String tag, Fragment fragment) {
        mQs = (QS) fragment;
@@ -108,7 +113,7 @@ public class NotificationsQuickSettingsContainer extends ConstraintLayout
    }

    public void setNotificationsMarginBottom(int margin) {
        LayoutParams params = (LayoutParams) mStackScroller.getLayoutParams();
        MarginLayoutParams params = (MarginLayoutParams) mStackScroller.getLayoutParams();
        params.bottomMargin = margin;
        mStackScroller.setLayoutParams(params);
    }
@@ -173,8 +178,15 @@ public class NotificationsQuickSettingsContainer extends ConstraintLayout
        super.dispatchDraw(canvas);
    }

    void setMigratingNSSL(boolean isMigrating) {
        mIsMigratingNSSL = isMigrating;
    }

    @Override
    protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
        if (mIsMigratingNSSL) {
            return super.drawChild(canvas, child, drawingTime);
        }
        int layoutIndex = mLayoutDrawingOrder.indexOf(child);
        if (layoutIndex >= 0) {
            return super.drawChild(canvas, mDrawingOrderedChildren.get(layoutIndex), drawingTime);
Loading