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

Commit 3de73c95 authored by Justin Weir's avatar Justin Weir Committed by Android (Google) Code Review
Browse files

Merge "Split keyguard dependencies out of ShadeViewController" into main

parents f17bf257 5aa1107c
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;

import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.LockIconViewController;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.assist.AssistManager;
import com.android.systemui.biometrics.AuthController;
@@ -45,7 +46,7 @@ import com.android.systemui.flags.FakeFeatureFlagsClassic;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.keyguard.domain.interactor.DozeInteractor;
import com.android.systemui.shade.NotificationShadeWindowViewController;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shade.ShadeLockscreenInteractor;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.PulseExpansionHandler;
import com.android.systemui.statusbar.StatusBarState;
@@ -91,7 +92,8 @@ public class DozeServiceHostTest extends SysuiTestCase {
    @Mock private NotificationIconAreaController mNotificationIconAreaController;
    @Mock private NotificationShadeWindowViewController mNotificationShadeWindowViewController;
    @Mock private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
    @Mock private ShadeViewController mShadeViewController;
    @Mock private ShadeLockscreenInteractor mShadeLockscreenInteractor;
    @Mock private LockIconViewController mLockIconViewController;
    @Mock private View mAmbientIndicationContainer;
    @Mock private BiometricUnlockController mBiometricUnlockController;
    @Mock private AuthController mAuthController;
@@ -109,13 +111,12 @@ public class DozeServiceHostTest extends SysuiTestCase {
                () -> mBiometricUnlockController, () -> mAssistManager, mDozeScrimController,
                mKeyguardUpdateMonitor, mPulseExpansionHandler, mNotificationShadeWindowController,
                mNotificationWakeUpCoordinator, mAuthController, mNotificationIconAreaController,
                mDozeInteractor);
                mShadeLockscreenInteractor, mDozeInteractor);

        mDozeServiceHost.initialize(
                mCentralSurfaces,
                mStatusBarKeyguardViewManager,
                mNotificationShadeWindowViewController,
                mShadeViewController,
                mAmbientIndicationContainer);
    }

+2 −2
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ import androidx.annotation.Nullable;

import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.shade.ShadeExpansionStateManager;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shade.ShadeLockscreenInteractor;
import com.android.systemui.statusbar.phone.BiometricUnlockController;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
@@ -186,7 +186,7 @@ public interface KeyguardViewController {
     * Registers the CentralSurfaces to which this Keyguard View is mounted.
     */
    void registerCentralSurfaces(CentralSurfaces centralSurfaces,
            ShadeViewController shadeViewController,
            ShadeLockscreenInteractor shadeLockscreenInteractor,
            @Nullable ShadeExpansionStateManager shadeExpansionStateManager,
            BiometricUnlockController biometricUnlockController,
            View notificationContainer,
+3 −3
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeExpansionStateManager;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shade.ShadeLockscreenInteractor;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationShadeDepthController;
@@ -3529,14 +3529,14 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
     * @return the View Controller for the Keyguard View this class is mediating.
     */
    public KeyguardViewController registerCentralSurfaces(CentralSurfaces centralSurfaces,
            ShadeViewController panelView,
            ShadeLockscreenInteractor shadeLockscreenInteractor,
            @Nullable ShadeExpansionStateManager shadeExpansionStateManager,
            BiometricUnlockController biometricUnlockController,
            View notificationContainer, KeyguardBypassController bypassController) {
        mCentralSurfaces = centralSurfaces;
        mKeyguardViewControllerLazy.get().registerCentralSurfaces(
                centralSurfaces,
                panelView,
                shadeLockscreenInteractor,
                shadeExpansionStateManager,
                biometricUnlockController,
                notificationContainer,
+1 −3
Original line number Diff line number Diff line
@@ -906,7 +906,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        mKeyguardBypassController = bypassController;
        mUpdateMonitor = keyguardUpdateMonitor;
        mLockscreenShadeTransitionController = lockscreenShadeTransitionController;
        lockscreenShadeTransitionController.setShadeViewController(this);
        shadeTransitionController.setShadeViewController(this);
        dynamicPrivacyController.addListener(this::onDynamicPrivacyChanged);
        quickSettingsController.setExpansionHeightListener(this::onQsSetExpansionHeightCalled);
@@ -4156,8 +4155,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        mFixedDuration = NO_FIXED_DURATION;
    }

    @Override
    public boolean postToView(Runnable action) {
    boolean postToView(Runnable action) {
        return mView.post(action);
    }

+24 −24
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
    private final StatusBarWindowController mStatusBarWindowController;
    private final DeviceProvisionedController mDeviceProvisionedController;

    private final Lazy<ShadeViewController> mShadeViewControllerLazy;
    private final Lazy<NotificationPanelViewController> mNpvc;
    private final Lazy<AssistManager> mAssistManagerLazy;
    private final Lazy<NotificationGutsManager> mGutsManager;

@@ -89,7 +89,7 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
            DeviceProvisionedController deviceProvisionedController,
            NotificationShadeWindowController notificationShadeWindowController,
            WindowManager windowManager,
            Lazy<ShadeViewController> shadeViewControllerLazy,
            Lazy<NotificationPanelViewController> shadeViewControllerLazy,
            Lazy<AssistManager> assistManagerLazy,
            Lazy<NotificationGutsManager> gutsManager
    ) {
@@ -101,7 +101,7 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
        mCommandQueue = commandQueue;
        mMainExecutor = mainExecutor;
        mWindowRootViewVisibilityInteractor = windowRootViewVisibilityInteractor;
        mShadeViewControllerLazy = shadeViewControllerLazy;
        mNpvc = shadeViewControllerLazy;
        mStatusBarStateController = statusBarStateController;
        mStatusBarWindowController = statusBarWindowController;
        mDeviceProvisionedController = deviceProvisionedController;
@@ -122,7 +122,7 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
    public void instantExpandShade() {
        // Make our window larger and the panel expanded.
        makeExpandedVisible(true /* force */);
        getShadeViewController().expand(false /* animate */);
        getNpvc().expand(false /* animate */);
        getCommandQueue().recomputeDisableFlags(mDisplayId, false /* animate */);
    }

@@ -134,29 +134,29 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
            return;
        }
        if (getNotificationShadeWindowView() != null
                && getShadeViewController().canBeCollapsed()
                && getNpvc().canBeCollapsed()
                && (flags & CommandQueue.FLAG_EXCLUDE_NOTIFICATION_PANEL) == 0) {
            // release focus immediately to kick off focus change transition
            mNotificationShadeWindowController.setNotificationShadeFocusable(false);

            mNotificationShadeWindowViewController.cancelExpandHelper();
            getShadeViewController().collapse(true, delayed, speedUpFactor);
            getNpvc().collapse(true, delayed, speedUpFactor);
        }
    }

    @Override
    protected void expandToNotifications() {
        getShadeViewController().expandToNotifications();
        getNpvc().expandToNotifications();
    }

    @Override
    protected void expandToQs() {
        getShadeViewController().expandToQs();
        getNpvc().expandToQs();
    }

    @Override
    public boolean closeShadeIfOpen() {
        if (!getShadeViewController().isFullyCollapsed()) {
        if (!getNpvc().isFullyCollapsed()) {
            getCommandQueue().animateCollapsePanels(
                    CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true /* force */);
            notifyVisibilityChanged(false);
@@ -167,12 +167,12 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {

    @Override
    public boolean isShadeFullyOpen() {
        return getShadeViewController().isShadeFullyExpanded();
        return getNpvc().isShadeFullyExpanded();
    }

    @Override
    public boolean isExpandingOrCollapsing() {
        return getShadeViewController().isExpandingOrCollapsing();
        return getNpvc().isExpandingOrCollapsing();
    }
    @Override
    public void postAnimateCollapseShade() {
@@ -191,13 +191,13 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {

    @Override
    public void postOnShadeExpanded(Runnable executable) {
        getShadeViewController().addOnGlobalLayoutListener(
        getNpvc().addOnGlobalLayoutListener(
                new ViewTreeObserver.OnGlobalLayoutListener() {
                    @Override
                    public void onGlobalLayout() {
                        if (getNotificationShadeWindowView().isVisibleToUser()) {
                            getShadeViewController().removeOnGlobalLayoutListener(this);
                            getShadeViewController().postToView(executable);
                            getNpvc().removeOnGlobalLayoutListener(this);
                            getNpvc().postToView(executable);
                        }
                    }
                });
@@ -209,7 +209,7 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
    }

    private boolean collapseShadeInternal() {
        if (!getShadeViewController().isFullyCollapsed()) {
        if (!getNpvc().isFullyCollapsed()) {
            // close the shade if it was open
            animateCollapseShadeForcedDelayed();
            notifyVisibilityChanged(false);
@@ -237,10 +237,10 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {

    @Override
    public void cancelExpansionAndCollapseShade() {
        if (getShadeViewController().isTracking()) {
        if (getNpvc().isTracking()) {
            mNotificationShadeWindowViewController.cancelCurrentTouch();
        }
        if (getShadeViewController().isPanelExpanded()
        if (getNpvc().isPanelExpanded()
                && mStatusBarStateController.getState() == StatusBarState.SHADE) {
            animateCollapseShade();
        }
@@ -266,7 +266,7 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {

    @Override
    public void instantCollapseShade() {
        getShadeViewController().instantCollapse();
        getNpvc().instantCollapse();
        runPostCollapseActions();
    }

@@ -297,7 +297,7 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
        }

        // Ensure the panel is fully collapsed (just in case; bug 6765842, 7260868)
        getShadeViewController().collapse(false, false, 1.0f);
        getNpvc().collapse(false, false, 1.0f);

        mExpandedVisible = false;
        notifyVisibilityChanged(false);
@@ -319,7 +319,7 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
        notifyExpandedVisibleChanged(false);
        getCommandQueue().recomputeDisableFlags(
                mDisplayId,
                getShadeViewController().shouldHideStatusBarIconsWhenExpanded());
                getNpvc().shouldHideStatusBarIconsWhenExpanded());

        // Trimming will happen later if Keyguard is showing - doing it here might cause a jank in
        // the bouncer appear animation.
@@ -368,15 +368,15 @@ public final class ShadeControllerImpl extends BaseShadeControllerImpl {
        return mNotificationShadeWindowViewController.getView();
    }

    private ShadeViewController getShadeViewController() {
        return mShadeViewControllerLazy.get();
    private NotificationPanelViewController getNpvc() {
        return mNpvc.get();
    }

    @Override
    public void start() {
        super.start();
        getShadeViewController().setTrackingStartedListener(this::runPostCollapseActions);
        getShadeViewController().setOpenCloseListener(
        getNpvc().setTrackingStartedListener(this::runPostCollapseActions);
        getNpvc().setOpenCloseListener(
                new OpenCloseListener() {
                    @Override
                    public void onClosingFinished() {
Loading