Split keyguard dependencies out of ShadeViewController
Breaks ShadeViewController into 2 interfaces by introducing the new
interface ShadeLockscreenInteractor to handle the needs of Lockscreen.
Adds a second implementation for when the scene container flag is on.
Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT
Test: Updated and ran affected tests
Test: Manual
Bug: 303267342
Change-Id: I7fb149d5d2bdc6784e777e910e72fa15545d6629
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java
index 7a78b36..9169938 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java
@@ -36,6 +36,7 @@
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.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 @@
@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 @@
() -> mBiometricUnlockController, () -> mAssistManager, mDozeScrimController,
mKeyguardUpdateMonitor, mPulseExpansionHandler, mNotificationShadeWindowController,
mNotificationWakeUpCoordinator, mAuthController, mNotificationIconAreaController,
- mDozeInteractor);
+ mShadeLockscreenInteractor, mDozeInteractor);
mDozeServiceHost.initialize(
mCentralSurfaces,
mStatusBarKeyguardViewManager,
mNotificationShadeWindowViewController,
- mShadeViewController,
mAmbientIndicationContainer);
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java
index ce03072..c3c4239 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java
@@ -24,7 +24,7 @@
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 @@
* 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,
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 0ee924d..fefa425 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -151,7 +151,7 @@
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;
@@ -3521,14 +3521,14 @@
* @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,
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
index 2968490..de69329 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
@@ -908,7 +908,6 @@
mKeyguardBypassController = bypassController;
mUpdateMonitor = keyguardUpdateMonitor;
mLockscreenShadeTransitionController = lockscreenShadeTransitionController;
- lockscreenShadeTransitionController.setShadeViewController(this);
shadeTransitionController.setShadeViewController(this);
dynamicPrivacyController.addListener(this::onDynamicPrivacyChanged);
quickSettingsController.setExpansionHeightListener(this::onQsSetExpansionHeightCalled);
@@ -4149,8 +4148,7 @@
mFixedDuration = NO_FIXED_DURATION;
}
- @Override
- public boolean postToView(Runnable action) {
+ boolean postToView(Runnable action) {
return mView.post(action);
}
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java b/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java
index e8d9c35..ea41912 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java
@@ -66,7 +66,7 @@
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 @@
DeviceProvisionedController deviceProvisionedController,
NotificationShadeWindowController notificationShadeWindowController,
WindowManager windowManager,
- Lazy<ShadeViewController> shadeViewControllerLazy,
+ Lazy<NotificationPanelViewController> shadeViewControllerLazy,
Lazy<AssistManager> assistManagerLazy,
Lazy<NotificationGutsManager> gutsManager
) {
@@ -101,7 +101,7 @@
mCommandQueue = commandQueue;
mMainExecutor = mainExecutor;
mWindowRootViewVisibilityInteractor = windowRootViewVisibilityInteractor;
- mShadeViewControllerLazy = shadeViewControllerLazy;
+ mNpvc = shadeViewControllerLazy;
mStatusBarStateController = statusBarStateController;
mStatusBarWindowController = statusBarWindowController;
mDeviceProvisionedController = deviceProvisionedController;
@@ -122,7 +122,7 @@
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 @@
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 @@
@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 @@
@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 @@
}
private boolean collapseShadeInternal() {
- if (!getShadeViewController().isFullyCollapsed()) {
+ if (!getNpvc().isFullyCollapsed()) {
// close the shade if it was open
animateCollapseShadeForcedDelayed();
notifyVisibilityChanged(false);
@@ -237,10 +237,10 @@
@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 @@
@Override
public void instantCollapseShade() {
- getShadeViewController().instantCollapse();
+ getNpvc().instantCollapse();
runPostCollapseActions();
}
@@ -297,7 +297,7 @@
}
// 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 @@
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 @@
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() {
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeEmptyImplModule.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeEmptyImplModule.kt
index f89a9c70..d393f0d 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeEmptyImplModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeEmptyImplModule.kt
@@ -40,6 +40,12 @@
@Binds
@SysUISingleton
+ abstract fun bindsShadeLockscreenInteractor(
+ slsi: ShadeViewControllerEmptyImpl
+ ): ShadeLockscreenInteractor
+
+ @Binds
+ @SysUISingleton
abstract fun bindsShadeController(sc: ShadeControllerEmptyImpl): ShadeController
@Binds
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeLockscreenInteractor.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeLockscreenInteractor.kt
new file mode 100644
index 0000000..a9ba6f9
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeLockscreenInteractor.kt
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.systemui.shade
+
+/** Allows the lockscreen to control the shade. */
+interface ShadeLockscreenInteractor {
+
+ /**
+ * Expand shade so that notifications are visible. Non-split shade: just expanding shade or
+ * collapsing QS when they're expanded. Split shade: only expanding shade, notifications are
+ * always visible
+ *
+ * Called when `adb shell cmd statusbar expand-notifications` is executed.
+ */
+ @Deprecated("Use ShadeInteractor instead") fun expandToNotifications()
+
+ /** Returns whether the shade is expanding or collapsing itself or quick settings. */
+ val isExpandingOrCollapsing: Boolean
+
+ /**
+ * Returns whether the shade height is greater than zero (i.e. partially or fully expanded),
+ * there is a HUN, the shade is animating, or the shade is instantly expanding.
+ */
+ @Deprecated("Use ShadeInteractor instead") val isExpanded: Boolean
+
+ /** Called before animating Keyguard dismissal, i.e. the animation dismissing the bouncer. */
+ fun startBouncerPreHideAnimation()
+
+ /** Called once every minute while dozing. */
+ fun dozeTimeTick()
+
+ /**
+ * Do not let the user drag the shade up and down for the current touch session. This is
+ * necessary to avoid shade expansion while/after the bouncer is dismissed.
+ */
+ @Deprecated("Not supported by scenes") fun blockExpansionForCurrentTouch()
+
+ /** Close guts, notification menus, and QS. Set scroll and overscroll to 0. */
+ fun resetViews(animate: Boolean)
+
+ /** Sets whether the screen has temporarily woken up to display notifications. */
+ @Deprecated("Not supported by scenes") fun setPulsing(pulsing: Boolean)
+
+ /** Animate to expanded shade after a delay in ms. Used for lockscreen to shade transition. */
+ fun transitionToExpandedShade(delay: Long)
+
+ /** @see ViewGroupFadeHelper.reset */
+ @Deprecated("Not supported by scenes") fun resetViewGroupFade()
+
+ /**
+ * Set the alpha and translationY of the keyguard elements which only show on the lockscreen,
+ * but not in shade locked / shade. This is used when dragging down to the full shade.
+ */
+ @Deprecated("Not supported by scenes")
+ fun setKeyguardTransitionProgress(keyguardAlpha: Float, keyguardTranslationY: Int)
+
+ /** Sets the overstretch amount in raw pixels when dragging down. */
+ @Deprecated("Not supported by scenes") fun setOverStretchAmount(amount: Float)
+
+ /**
+ * Sets the alpha value to be set on the keyguard status bar.
+ *
+ * @param alpha value between 0 and 1. -1 if the value is to be reset.
+ */
+ @Deprecated("TODO(b/325072511) delete this") fun setKeyguardStatusBarAlpha(alpha: Float)
+}
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt
index e4d5d22..86fdcee 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt
@@ -30,6 +30,7 @@
import com.android.systemui.shade.domain.interactor.ShadeInteractorImpl
import com.android.systemui.shade.domain.interactor.ShadeInteractorLegacyImpl
import com.android.systemui.shade.domain.interactor.ShadeInteractorSceneContainerImpl
+import com.android.systemui.shade.domain.interactor.ShadeLockscreenInteractorImpl
import dagger.Binds
import dagger.Module
import dagger.Provides
@@ -94,6 +95,20 @@
sceneContainerOff.get()
}
}
+
+ @Provides
+ @SysUISingleton
+ fun provideShadeLockscreenInteractor(
+ sceneContainerFlags: SceneContainerFlags,
+ sceneContainerOn: Provider<ShadeLockscreenInteractorImpl>,
+ sceneContainerOff: Provider<NotificationPanelViewController>
+ ): ShadeLockscreenInteractor {
+ return if (sceneContainerFlags.isEnabled()) {
+ sceneContainerOn.get()
+ } else {
+ sceneContainerOff.get()
+ }
+ }
}
@Binds
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeSurface.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeSurface.kt
index 0befb61..941c6f3 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeSurface.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeSurface.kt
@@ -26,7 +26,7 @@
* this class. If any method in this class is needed outside of CentralSurfacesImpl, it must be
* pulled up into ShadeViewController.
*/
-interface ShadeSurface : ShadeViewController, ShadeBackActionInteractor {
+interface ShadeSurface : ShadeViewController, ShadeBackActionInteractor, ShadeLockscreenInteractor {
/** Initialize objects instead of injecting to avoid circular dependencies. */
fun initDependencies(
centralSurfaces: CentralSurfaces,
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt
index 74035bd..44c6a82 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt
@@ -37,25 +37,10 @@
/** Animates to an expanded shade with QS expanded. If the shade starts expanded, expands QS. */
fun expandToQs()
- /**
- * Expand shade so that notifications are visible. Non-split shade: just expanding shade or
- * collapsing QS when they're expanded. Split shade: only expanding shade, notifications are
- * always visible
- *
- * Called when `adb shell cmd statusbar expand-notifications` is executed.
- */
- fun expandToNotifications()
-
/** Returns whether the shade is expanding or collapsing itself or quick settings. */
val isExpandingOrCollapsing: Boolean
/**
- * Returns whether the shade height is greater than zero (i.e. partially or fully expanded),
- * there is a HUN, the shade is animating, or the shade is instantly expanding.
- */
- val isExpanded: Boolean
-
- /**
* Returns whether the shade height is greater than zero or the shade is expecting a synthesized
* down event.
*/
@@ -101,12 +86,6 @@
/** Returns whether status bar icons should be hidden when the shade is expanded. */
fun shouldHideStatusBarIconsWhenExpanded(): Boolean
- /**
- * Do not let the user drag the shade up and down for the current touch session. This is
- * necessary to avoid shade expansion while/after the bouncer is dismissed.
- */
- fun blockExpansionForCurrentTouch()
-
/** Sets a listener to be notified when touch tracking begins. */
fun setTrackingStartedListener(trackingStartedListener: TrackingStartedListener)
@@ -120,15 +99,6 @@
/** If the latency tracker is enabled, begins tracking expand latency. */
fun startExpandLatencyTracking()
- /** Called before animating Keyguard dismissal, i.e. the animation dismissing the bouncer. */
- fun startBouncerPreHideAnimation()
-
- /** Called once every minute while dozing. */
- fun dozeTimeTick()
-
- /** Close guts, notification menus, and QS. Set scroll and overscroll to 0. */
- fun resetViews(animate: Boolean)
-
/** Returns the StatusBarState. */
val barState: Int
@@ -145,9 +115,6 @@
*/
fun setAlphaChangeAnimationEndAction(r: Runnable)
- /** Sets whether the screen has temporarily woken up to display notifications. */
- fun setPulsing(pulsing: Boolean)
-
/** Sets Qs ScrimEnabled and updates QS state. */
fun setQsScrimEnabled(qsScrimEnabled: Boolean)
@@ -166,32 +133,6 @@
/** Removes a global layout listener. */
fun removeOnGlobalLayoutListener(listener: ViewTreeObserver.OnGlobalLayoutListener)
- /** Posts the given runnable to the view. */
- fun postToView(action: Runnable): Boolean
-
- // ******* Begin Keyguard Section *********
- /** Animate to expanded shade after a delay in ms. Used for lockscreen to shade transition. */
- fun transitionToExpandedShade(delay: Long)
-
- /** @see ViewGroupFadeHelper.reset */
- fun resetViewGroupFade()
-
- /**
- * Set the alpha and translationY of the keyguard elements which only show on the lockscreen,
- * but not in shade locked / shade. This is used when dragging down to the full shade.
- */
- fun setKeyguardTransitionProgress(keyguardAlpha: Float, keyguardTranslationY: Int)
-
- /** Sets the overstretch amount in raw pixels when dragging down. */
- fun setOverStretchAmount(amount: Float)
-
- /**
- * Sets the alpha value to be set on the keyguard status bar.
- *
- * @param alpha value between 0 and 1. -1 if the value is to be reset.
- */
- fun setKeyguardStatusBarAlpha(alpha: Float)
-
/**
* Reconfigures the shade to show the AOD UI (clock, smartspace, etc). This is called by the
* screen off animation controller in order to animate in AOD without "actually" fully switching
@@ -251,8 +192,6 @@
*/
fun performHapticFeedback(constant: Int)
- // ******* End Keyguard Section *********
-
/** Returns the ShadeHeadsUpTracker. */
val shadeHeadsUpTracker: ShadeHeadsUpTracker
diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewControllerEmptyImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewControllerEmptyImpl.kt
index 5d966ac..7a181f1 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewControllerEmptyImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewControllerEmptyImpl.kt
@@ -27,7 +27,7 @@
/** Empty implementation of ShadeViewController for variants with no shade. */
class ShadeViewControllerEmptyImpl @Inject constructor() :
- ShadeViewController, ShadeBackActionInteractor {
+ ShadeViewController, ShadeBackActionInteractor, ShadeLockscreenInteractor {
override fun expand(animate: Boolean) {}
override fun expandToQs() {}
override fun expandToNotifications() {}
@@ -70,9 +70,6 @@
override fun updateTouchableRegion() {}
override fun addOnGlobalLayoutListener(listener: ViewTreeObserver.OnGlobalLayoutListener) {}
override fun removeOnGlobalLayoutListener(listener: ViewTreeObserver.OnGlobalLayoutListener) {}
- override fun postToView(action: Runnable): Boolean {
- return false
- }
override fun transitionToExpandedShade(delay: Long) {}
override fun resetViewGroupFade() {}
diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeLockscreenInteractorImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeLockscreenInteractorImpl.kt
new file mode 100644
index 0000000..21a782e
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeLockscreenInteractorImpl.kt
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.shade.domain.interactor
+
+import com.android.keyguard.LockIconViewController
+import com.android.systemui.dagger.qualifiers.Background
+import com.android.systemui.scene.domain.interactor.SceneInteractor
+import com.android.systemui.scene.shared.model.SceneKey
+import com.android.systemui.shade.ShadeLockscreenInteractor
+import javax.inject.Inject
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.launch
+
+class ShadeLockscreenInteractorImpl
+@Inject
+constructor(
+ @Background private val scope: CoroutineScope,
+ shadeInteractor: ShadeInteractor,
+ private val sceneInteractor: SceneInteractor,
+ private val lockIconViewController: LockIconViewController,
+) : ShadeLockscreenInteractor {
+ override fun expandToNotifications() {
+ changeToShadeScene()
+ }
+
+ override val isExpandingOrCollapsing = shadeInteractor.isUserInteracting.value
+
+ override val isExpanded = shadeInteractor.isAnyExpanded.value
+
+ override fun startBouncerPreHideAnimation() {
+ // TODO("b/324280998") Implement replacement or delete
+ }
+
+ override fun dozeTimeTick() {
+ lockIconViewController.dozeTimeTick()
+ }
+
+ override fun blockExpansionForCurrentTouch() {
+ // TODO("b/324280998") Implement replacement or delete
+ }
+
+ override fun resetViews(animate: Boolean) {
+ // The existing comment to the only call to this claims it only calls it to collapse QS
+ changeToShadeScene()
+ }
+
+ override fun setPulsing(pulsing: Boolean) {
+ // Now handled elsewhere. Do nothing.
+ }
+ override fun transitionToExpandedShade(delay: Long) {
+ scope.launch {
+ delay(delay)
+ changeToShadeScene()
+ }
+ }
+
+ override fun resetViewGroupFade() {
+ // Now handled elsewhere. Do nothing.
+ }
+
+ override fun setKeyguardTransitionProgress(keyguardAlpha: Float, keyguardTranslationY: Int) {
+ // Now handled elsewhere. Do nothing.
+ }
+
+ override fun setOverStretchAmount(amount: Float) {
+ // Now handled elsewhere. Do nothing.
+ }
+
+ override fun setKeyguardStatusBarAlpha(alpha: Float) {
+ // TODO(b/325072511) delete this
+ }
+
+ private fun changeToShadeScene() {
+ sceneInteractor.changeScene(
+ SceneKey.Shade,
+ "ShadeLockscreenInteractorImpl.expandToNotifications",
+ )
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeKeyguardTransitionController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeKeyguardTransitionController.kt
index 62c9980..0b470c1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeKeyguardTransitionController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeKeyguardTransitionController.kt
@@ -3,10 +3,10 @@
import android.content.Context
import android.util.IndentingPrintWriter
import android.util.MathUtils
-import com.android.systemui.res.R
import com.android.systemui.dump.DumpManager
import com.android.systemui.media.controls.ui.MediaHierarchyManager
-import com.android.systemui.shade.ShadeViewController
+import com.android.systemui.res.R
+import com.android.systemui.shade.ShadeLockscreenInteractor
import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.statusbar.policy.SplitShadeStateController
import dagger.assisted.Assisted
@@ -18,7 +18,7 @@
@AssistedInject
constructor(
private val mediaHierarchyManager: MediaHierarchyManager,
- @Assisted private val notificationPanelController: ShadeViewController,
+ @Assisted private val shadeLockscreenInteractor: ShadeLockscreenInteractor,
context: Context,
configurationController: ConfigurationController,
dumpManager: DumpManager,
@@ -72,10 +72,10 @@
alphaProgress = MathUtils.saturate(dragDownAmount / alphaTransitionDistance)
alpha = 1f - alphaProgress
translationY = calculateKeyguardTranslationY(dragDownAmount)
- notificationPanelController.setKeyguardTransitionProgress(alpha, translationY)
+ shadeLockscreenInteractor.setKeyguardTransitionProgress(alpha, translationY)
statusBarAlpha = if (useSplitShade) alpha else -1f
- notificationPanelController.setKeyguardStatusBarAlpha(statusBarAlpha)
+ shadeLockscreenInteractor.setKeyguardStatusBarAlpha(statusBarAlpha)
}
private fun calculateKeyguardTranslationY(dragDownAmount: Float): Int {
@@ -117,7 +117,7 @@
@AssistedFactory
fun interface Factory {
fun create(
- notificationPanelController: ShadeViewController
+ shadeLockscreenInteractor: ShadeLockscreenInteractor
): LockscreenShadeKeyguardTransitionController
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt
index ef50265..a7df395 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/LockscreenShadeTransitionController.kt
@@ -31,9 +31,8 @@
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.plugins.qs.QS
import com.android.systemui.plugins.statusbar.StatusBarStateController
-import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.res.R
-import com.android.systemui.shade.ShadeViewController
+import com.android.systemui.shade.ShadeLockscreenInteractor
import com.android.systemui.shade.data.repository.ShadeRepository
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.statusbar.notification.collection.NotificationEntry
@@ -47,6 +46,7 @@
import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.statusbar.policy.SplitShadeStateController
import com.android.wm.shell.animation.Interpolators
+import dagger.Lazy
import java.io.PrintWriter
import javax.inject.Inject
@@ -81,9 +81,9 @@
qsTransitionControllerFactory: LockscreenShadeQsTransitionController.Factory,
private val shadeRepository: ShadeRepository,
private val shadeInteractor: ShadeInteractor,
- private val powerInteractor: PowerInteractor,
private val splitShadeStateController: SplitShadeStateController,
- private val naturalScrollingSettingObserver: NaturalScrollingSettingObserver,
+ private val shadeLockscreenInteractorLazy: Lazy<ShadeLockscreenInteractor>,
+ naturalScrollingSettingObserver: NaturalScrollingSettingObserver,
) : Dumpable {
private var pulseHeight: Float = 0f
@@ -92,7 +92,6 @@
private set
private var useSplitShade: Boolean = false
private lateinit var nsslController: NotificationStackScrollLayoutController
- lateinit var shadeViewController: ShadeViewController
lateinit var centralSurfaces: CentralSurfaces
lateinit var qS: QS
@@ -165,7 +164,6 @@
val touchHelper =
DragDownHelper(
falsingManager,
- falsingCollector,
this,
naturalScrollingSettingObserver,
shadeRepository,
@@ -181,7 +179,7 @@
}
private val keyguardTransitionController by lazy {
- keyguardTransitionControllerFactory.create(shadeViewController)
+ keyguardTransitionControllerFactory.create(shadeLockscreenInteractorLazy.get())
}
private val qsTransitionController = qsTransitionControllerFactory.create { qS }
@@ -320,7 +318,7 @@
true /* drag down is always an open */
)
}
- shadeViewController.transitionToExpandedShade(delay)
+ shadeLockscreenInteractorLazy.get().transitionToExpandedShade(delay)
callbacks.forEach {
it.setTransitionToFullShadeAmount(0f, /* animated= */ true, delay)
}
@@ -538,7 +536,7 @@
} else {
// Let's only animate notifications
animationHandler = { delay: Long ->
- shadeViewController.transitionToExpandedShade(delay)
+ shadeLockscreenInteractorLazy.get().transitionToExpandedShade(delay)
}
}
goToLockedShadeInternal(expandedView, animationHandler, cancelAction = null)
@@ -661,7 +659,7 @@
*/
private fun performDefaultGoToFullShadeAnimation(delay: Long) {
logger.logDefaultGoToFullShadeAnimation(delay)
- shadeViewController.transitionToExpandedShade(delay)
+ shadeLockscreenInteractorLazy.get().transitionToExpandedShade(delay)
animateAppear(delay)
}
@@ -686,7 +684,7 @@
} else {
pulseHeight = height
val overflow = nsslController.setPulseHeight(height)
- shadeViewController.setOverStretchAmount(overflow)
+ shadeLockscreenInteractorLazy.get().setOverStretchAmount(overflow)
val transitionHeight = if (keyguardBypassController.bypassEnabled) height else 0.0f
transitionToShadeAmountCommon(transitionHeight)
}
@@ -760,7 +758,6 @@
*/
class DragDownHelper(
private val falsingManager: FalsingManager,
- private val falsingCollector: FalsingCollector,
private val dragDownCallback: LockscreenShadeTransitionController,
private val naturalScrollingSettingObserver: NaturalScrollingSettingObserver,
private val shadeRepository: ShadeRepository,
@@ -852,7 +849,6 @@
if (!isDraggingDown) {
return false
}
- val x = event.x
val y = event.y
when (event.actionMasked) {
MotionEvent.ACTION_MOVE -> {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
index 4a54111..240865b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -983,7 +983,6 @@
this,
mStatusBarKeyguardViewManager,
getNotificationShadeWindowViewController(),
- mShadeSurface,
mAmbientIndicationContainer);
updateLightRevealScrimVisibility();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
index 45005cb..442e43a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java
@@ -41,7 +41,7 @@
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;
@@ -98,7 +98,7 @@
private final AuthController mAuthController;
private final NotificationIconAreaController mNotificationIconAreaController;
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
- private ShadeViewController mNotificationPanel;
+ private final ShadeLockscreenInteractor mShadeLockscreenInteractor;
private View mAmbientIndicationContainer;
private CentralSurfaces mCentralSurfaces;
private boolean mAlwaysOnSuppressed;
@@ -121,6 +121,7 @@
NotificationWakeUpCoordinator notificationWakeUpCoordinator,
AuthController authController,
NotificationIconAreaController notificationIconAreaController,
+ ShadeLockscreenInteractor shadeLockscreenInteractor,
DozeInteractor dozeInteractor) {
super();
mDozeLog = dozeLog;
@@ -141,6 +142,7 @@
mNotificationWakeUpCoordinator = notificationWakeUpCoordinator;
mAuthController = authController;
mNotificationIconAreaController = notificationIconAreaController;
+ mShadeLockscreenInteractor = shadeLockscreenInteractor;
mHeadsUpManager.addListener(mOnHeadsUpChangedListener);
mDozeInteractor = dozeInteractor;
}
@@ -154,11 +156,9 @@
CentralSurfaces centralSurfaces,
StatusBarKeyguardViewManager statusBarKeyguardViewManager,
NotificationShadeWindowViewController notificationShadeWindowViewController,
- ShadeViewController notificationPanel,
View ambientIndicationContainer) {
mCentralSurfaces = centralSurfaces;
mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
- mNotificationPanel = notificationPanel;
mNotificationShadeWindowViewController = notificationShadeWindowViewController;
mAmbientIndicationContainer = ambientIndicationContainer;
}
@@ -290,7 +290,7 @@
private void setPulsing(boolean pulsing) {
mStatusBarKeyguardViewManager.setPulsing(pulsing);
- mNotificationPanel.setPulsing(pulsing);
+ mShadeLockscreenInteractor.setPulsing(pulsing);
mStatusBarStateController.setPulsing(pulsing);
mIgnoreTouchWhilePulsing = false;
if (mKeyguardUpdateMonitor != null && passiveAuthInterrupt) {
@@ -329,7 +329,7 @@
@Override
public void dozeTimeTick() {
mDozeInteractor.dozeTimeTick();
- mNotificationPanel.dozeTimeTick();
+ mShadeLockscreenInteractor.dozeTimeTick();
mAuthController.dozeTimeTick();
if (mAmbientIndicationContainer instanceof DozeReceiver) {
((DozeReceiver) mAmbientIndicationContainer).dozeTimeTick();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index 9d70f42..29fd225 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -86,10 +86,9 @@
import com.android.systemui.shade.ShadeExpansionChangeEvent;
import com.android.systemui.shade.ShadeExpansionListener;
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.shared.system.SysUiStatsLog;
-import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.RemoteInputController;
import com.android.systemui.statusbar.StatusBarState;
@@ -269,7 +268,7 @@
protected LockPatternUtils mLockPatternUtils;
protected ViewMediatorCallback mViewMediatorCallback;
@Nullable protected CentralSurfaces mCentralSurfaces;
- private ShadeViewController mShadeViewController;
+ private ShadeLockscreenInteractor mShadeLockscreenInteractor;
private BiometricUnlockController mBiometricUnlockController;
private boolean mCentralSurfacesRegistered;
@@ -314,7 +313,6 @@
// Dismiss action to be launched when we stop dozing or the keyguard is gone.
private DismissWithActionRequest mPendingWakeupAction;
private final KeyguardStateController mKeyguardStateController;
- private final NotificationMediaManager mMediaManager;
private final SysuiStatusBarStateController mStatusBarStateController;
private final DockManager mDockManager;
private final KeyguardUpdateMonitor mKeyguardUpdateManager;
@@ -363,7 +361,6 @@
DockManager dockManager,
NotificationShadeWindowController notificationShadeWindowController,
KeyguardStateController keyguardStateController,
- NotificationMediaManager notificationMediaManager,
KeyguardMessageAreaController.Factory keyguardMessageAreaFactory,
Optional<SysUIUnfoldComponent> sysUIUnfoldComponent,
Lazy<ShadeController> shadeController,
@@ -391,7 +388,6 @@
mNotificationShadeWindowController = notificationShadeWindowController;
mDreamOverlayStateController = dreamOverlayStateController;
mKeyguardStateController = keyguardStateController;
- mMediaManager = notificationMediaManager;
mKeyguardUpdateManager = keyguardUpdateMonitor;
mStatusBarStateController = sysuiStatusBarStateController;
mDockManager = dockManager;
@@ -422,7 +418,7 @@
@Override
public void registerCentralSurfaces(CentralSurfaces centralSurfaces,
- ShadeViewController shadeViewController,
+ ShadeLockscreenInteractor shadeLockscreenInteractor,
ShadeExpansionStateManager shadeExpansionStateManager,
BiometricUnlockController biometricUnlockController,
View notificationContainer,
@@ -431,7 +427,7 @@
mBiometricUnlockController = biometricUnlockController;
mPrimaryBouncerCallbackInteractor.addBouncerExpansionCallback(mExpansionCallback);
- mShadeViewController = shadeViewController;
+ mShadeLockscreenInteractor = shadeLockscreenInteractor;
if (shadeExpansionStateManager != null) {
ShadeExpansionChangeEvent currentState =
shadeExpansionStateManager.addExpansionListener(this);
@@ -565,8 +561,8 @@
// Avoid having the shade and the bouncer open at the same time over a dream.
final boolean hideBouncerOverDream =
mDreamOverlayStateController.isOverlayActive()
- && (mShadeViewController.isExpanded()
- || mShadeViewController.isExpandingOrCollapsing());
+ && (mShadeLockscreenInteractor.isExpanded()
+ || mShadeLockscreenInteractor.isExpandingOrCollapsing());
final boolean isUserTrackingStarted =
event.getFraction() != EXPANSION_HIDDEN && event.getTracking();
@@ -834,7 +830,7 @@
if (mKeyguardStateController.isShowing() && !bouncerIsAnimatingAway()) {
final boolean isOccluded = mKeyguardStateController.isOccluded();
// Hide quick settings.
- mShadeViewController.resetViews(/* animate= */ !isOccluded);
+ mShadeLockscreenInteractor.resetViews(/* animate= */ !isOccluded);
// Hide bouncer and quick-quick settings.
if (isOccluded && !mDozing) {
mCentralSurfaces.hideKeyguard();
@@ -1008,7 +1004,7 @@
public void startPreHideAnimation(Runnable finishRunnable) {
if (primaryBouncerIsShowing()) {
mPrimaryBouncerInteractor.startDisappearAnimation(finishRunnable);
- mShadeViewController.startBouncerPreHideAnimation();
+ mShadeLockscreenInteractor.startBouncerPreHideAnimation();
// We update the state (which will show the keyguard) only if an animation will run on
// the keyguard. If there is no animation, we wait before updating the state so that we
@@ -1023,12 +1019,12 @@
} else if (finishRunnable != null) {
finishRunnable.run();
}
- mShadeViewController.blockExpansionForCurrentTouch();
+ mShadeLockscreenInteractor.blockExpansionForCurrentTouch();
}
@Override
public void blockPanelExpansionFromCurrentTouch() {
- mShadeViewController.blockExpansionForCurrentTouch();
+ mShadeLockscreenInteractor.blockExpansionForCurrentTouch();
}
@Override
@@ -1125,7 +1121,7 @@
public void onKeyguardFadedAway() {
mNotificationContainer.postDelayed(() -> mNotificationShadeWindowController
.setKeyguardFadingAway(false), 100);
- mShadeViewController.resetViewGroupFade();
+ mShadeLockscreenInteractor.resetViewGroupFade();
mCentralSurfaces.finishKeyguardFadingAway();
mBiometricUnlockController.finishKeyguardFadingAway();
}
@@ -1208,7 +1204,7 @@
if (hideImmediately) {
mStatusBarStateController.setLeaveOpenOnKeyguardHide(false);
} else {
- mShadeViewController.expandToNotifications();
+ mShadeLockscreenInteractor.expandToNotifications();
}
}
return;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java
index cc27cbd..8bb4570 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java
@@ -840,10 +840,6 @@
when(mResources.getDimensionPixelSize(R.dimen.keyguard_indication_bottom_padding))
.thenReturn(indicationPadding);
mNotificationPanelViewController.loadDimens();
-
- mNotificationPanelViewController.setAmbientIndicationTop(
- /* ambientIndicationTop= */ stackBottom - ambientPadding,
- /* ambientTextVisible= */ true);
}
protected void triggerPositionClockAndNotifications() {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt
index cc79ca4..f489937 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/ShadeControllerImplTest.kt
@@ -80,7 +80,7 @@
@Mock private lateinit var windowManager: WindowManager
@Mock private lateinit var assistManager: AssistManager
@Mock private lateinit var gutsManager: NotificationGutsManager
- @Mock private lateinit var shadeViewController: ShadeViewController
+ @Mock private lateinit var npvc: NotificationPanelViewController
@Mock private lateinit var nswvc: NotificationShadeWindowViewController
@Mock private lateinit var display: Display
@Mock private lateinit var touchLog: LogBuffer
@@ -120,7 +120,7 @@
deviceProvisionedController,
notificationShadeWindowController,
windowManager,
- Lazy { shadeViewController },
+ Lazy { npvc },
Lazy { assistManager },
Lazy { gutsManager },
)
@@ -134,9 +134,9 @@
// Trying to open it does nothing.
shadeController.animateExpandShade()
- verify(shadeViewController, never()).expandToNotifications()
+ verify(npvc, never()).expandToNotifications()
shadeController.animateExpandQs()
- verify(shadeViewController, never()).expand(ArgumentMatchers.anyBoolean())
+ verify(npvc, never()).expand(ArgumentMatchers.anyBoolean())
}
@Test
@@ -145,15 +145,15 @@
// Can now be opened.
shadeController.animateExpandShade()
- verify(shadeViewController).expandToNotifications()
+ verify(npvc).expandToNotifications()
shadeController.animateExpandQs()
- verify(shadeViewController).expandToQs()
+ verify(npvc).expandToQs()
}
@Test
fun cancelExpansionAndCollapseShade_callsCancelCurrentTouch() {
// GIVEN the shade is tracking a touch
- whenever(shadeViewController.isTracking).thenReturn(true)
+ whenever(npvc.isTracking).thenReturn(true)
// WHEN cancelExpansionAndCollapseShade is called
shadeController.cancelExpansionAndCollapseShade()
@@ -165,7 +165,7 @@
@Test
fun cancelExpansionAndCollapseShade_doesNotCallAnimateCollapseShade_whenCollapsed() {
// GIVEN the shade is tracking a touch
- whenever(shadeViewController.isTracking).thenReturn(false)
+ whenever(npvc.isTracking).thenReturn(false)
// WHEN cancelExpansionAndCollapseShade is called
shadeController.cancelExpansionAndCollapseShade()
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/DragDownHelperTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/DragDownHelperTest.kt
index ffde601..9ec9b69 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/DragDownHelperTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/DragDownHelperTest.kt
@@ -25,9 +25,9 @@
import com.android.systemui.classifier.FalsingCollector
import com.android.systemui.keyguard.domain.interactor.NaturalScrollingSettingObserver
import com.android.systemui.plugins.FalsingManager
+import com.android.systemui.shade.data.repository.FakeShadeRepository
import com.android.systemui.statusbar.notification.row.ExpandableView
import com.android.systemui.util.mockito.mock
-import com.android.systemui.shade.data.repository.FakeShadeRepository
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -58,12 +58,11 @@
whenever(naturalScrollingSettingObserver.isNaturalScrollingEnabled).thenReturn(true)
dragDownHelper = DragDownHelper(
- falsingManager,
- falsingCollector,
- dragDownloadCallback,
- naturalScrollingSettingObserver,
- FakeShadeRepository(),
- mContext,
+ falsingManager,
+ dragDownloadCallback,
+ naturalScrollingSettingObserver,
+ FakeShadeRepository(),
+ mContext,
).also {
it.expandCallback = expandCallback
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt
index 3efcf7b..0933425 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerTest.kt
@@ -5,10 +5,10 @@
import android.testing.TestableLooper
import android.testing.TestableLooper.RunWithLooper
import androidx.test.filters.SmallTest
-import com.android.systemui.SysUITestModule
-import com.android.systemui.TestMocksModule
import com.android.systemui.ExpandHelper
+import com.android.systemui.SysUITestModule
import com.android.systemui.SysuiTestCase
+import com.android.systemui.TestMocksModule
import com.android.systemui.classifier.FalsingCollectorFake
import com.android.systemui.classifier.FalsingManagerFake
import com.android.systemui.dagger.SysUISingleton
@@ -19,7 +19,7 @@
import com.android.systemui.plugins.qs.QS
import com.android.systemui.power.domain.interactor.PowerInteractor
import com.android.systemui.res.R
-import com.android.systemui.shade.ShadeViewController
+import com.android.systemui.shade.ShadeLockscreenInteractor
import com.android.systemui.shade.data.repository.FakeShadeRepository
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.statusbar.disableflags.data.model.DisableFlagsModel
@@ -60,8 +60,8 @@
import org.mockito.Mockito.never
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyZeroInteractions
-import org.mockito.Mockito.`when` as whenever
import org.mockito.junit.MockitoJUnit
+import org.mockito.Mockito.`when` as whenever
private fun <T> anyObject(): T {
return Mockito.anyObject<T>()
@@ -94,7 +94,7 @@
@Mock lateinit var qS: QS
@Mock lateinit var qsTransitionController: LockscreenShadeQsTransitionController
@Mock lateinit var scrimController: ScrimController
- @Mock lateinit var shadeViewController: ShadeViewController
+ @Mock lateinit var shadeLockscreenInteractor: ShadeLockscreenInteractor
@Mock lateinit var singleShadeOverScroller: SingleShadeLockScreenOverScroller
@Mock lateinit var splitShadeOverScroller: SplitShadeLockScreenOverScroller
@Mock lateinit var stackscroller: NotificationStackScrollLayout
@@ -167,7 +167,7 @@
keyguardTransitionControllerFactory = { notificationPanelController ->
LockscreenShadeKeyguardTransitionController(
mediaHierarchyManager = mediaHierarchyManager,
- notificationPanelController = notificationPanelController,
+ shadeLockscreenInteractor = notificationPanelController,
context = context,
configurationController = configurationController,
dumpManager = mock(),
@@ -186,13 +186,12 @@
qsTransitionControllerFactory = { qsTransitionController },
shadeRepository = testComponent.shadeRepository,
shadeInteractor = testComponent.shadeInteractor,
- powerInteractor = testComponent.powerInteractor,
splitShadeStateController = ResourcesSplitShadeStateController(),
+ shadeLockscreenInteractorLazy = {shadeLockscreenInteractor},
naturalScrollingSettingObserver = naturalScrollingSettingObserver,
)
transitionController.addCallback(transitionControllerCallback)
- transitionController.shadeViewController = shadeViewController
transitionController.centralSurfaces = centralSurfaces
transitionController.qS = qS
transitionController.setStackScroller(nsslController)
@@ -286,7 +285,7 @@
fun testGoToLockedShadeCreatesQSAnimation() {
transitionController.goToLockedShade(null)
verify(statusbarStateController).setState(StatusBarState.SHADE_LOCKED)
- verify(shadeViewController).transitionToExpandedShade(anyLong())
+ verify(shadeLockscreenInteractor).transitionToExpandedShade(anyLong())
assertNotNull(transitionController.dragDownAnimator)
}
@@ -294,7 +293,7 @@
fun testGoToLockedShadeDoesntCreateQSAnimation() {
transitionController.goToLockedShade(null, needsQSAnimation = false)
verify(statusbarStateController).setState(StatusBarState.SHADE_LOCKED)
- verify(shadeViewController).transitionToExpandedShade(anyLong())
+ verify(shadeLockscreenInteractor).transitionToExpandedShade(anyLong())
assertNull(transitionController.dragDownAnimator)
}
@@ -302,7 +301,7 @@
fun testGoToLockedShadeAlwaysCreatesQSAnimationInSplitShade() {
enableSplitShade()
transitionController.goToLockedShade(null, needsQSAnimation = true)
- verify(shadeViewController).transitionToExpandedShade(anyLong())
+ verify(shadeLockscreenInteractor).transitionToExpandedShade(anyLong())
assertNotNull(transitionController.dragDownAnimator)
}
@@ -358,7 +357,7 @@
fun setDragAmount_setsKeyguardTransitionProgress() {
transitionController.dragDownAmount = 10f
- verify(shadeViewController).setKeyguardTransitionProgress(anyFloat(), anyInt())
+ verify(shadeLockscreenInteractor).setKeyguardTransitionProgress(anyFloat(), anyInt())
}
@Test
@@ -370,7 +369,7 @@
transitionController.dragDownAmount = 10f
val expectedAlpha = 1 - 10f / alphaDistance
- verify(shadeViewController).setKeyguardTransitionProgress(eq(expectedAlpha), anyInt())
+ verify(shadeLockscreenInteractor).setKeyguardTransitionProgress(eq(expectedAlpha), anyInt())
}
@Test
@@ -383,7 +382,7 @@
transitionController.dragDownAmount = 10f
- verify(shadeViewController).setKeyguardTransitionProgress(anyFloat(), eq(0))
+ verify(shadeLockscreenInteractor).setKeyguardTransitionProgress(anyFloat(), eq(0))
}
@Test
@@ -396,7 +395,8 @@
transitionController.dragDownAmount = 10f
- verify(shadeViewController).setKeyguardTransitionProgress(anyFloat(), eq(mediaTranslationY))
+ verify(shadeLockscreenInteractor)
+ .setKeyguardTransitionProgress(anyFloat(), eq(mediaTranslationY))
}
@Test
@@ -416,7 +416,7 @@
R.dimen.lockscreen_shade_keyguard_transition_vertical_offset
)
val expectedTranslation = 10f / distance * offset
- verify(shadeViewController)
+ verify(shadeLockscreenInteractor)
.setKeyguardTransitionProgress(anyFloat(), eq(expectedTranslation.toInt()))
}
@@ -555,7 +555,7 @@
transitionController.dragDownAmount = dragDownAmount
val expectedAlpha = 1 - dragDownAmount / alphaDistance
- verify(shadeViewController).setKeyguardStatusBarAlpha(expectedAlpha)
+ verify(shadeLockscreenInteractor).setKeyguardStatusBarAlpha(expectedAlpha)
}
@Test
@@ -564,7 +564,7 @@
transitionController.dragDownAmount = 10f
- verify(shadeViewController).setKeyguardStatusBarAlpha(-1f)
+ verify(shadeLockscreenInteractor).setKeyguardStatusBarAlpha(-1f)
}
private fun enableSplitShade() {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
index 4015361..bd7406a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java
@@ -90,8 +90,7 @@
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeExpansionChangeEvent;
import com.android.systemui.shade.ShadeExpansionStateManager;
-import com.android.systemui.shade.ShadeViewController;
-import com.android.systemui.statusbar.NotificationMediaManager;
+import com.android.systemui.shade.ShadeLockscreenInteractor;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
@@ -125,7 +124,7 @@
@Mock private LockPatternUtils mLockPatternUtils;
@Mock private CentralSurfaces mCentralSurfaces;
@Mock private ViewGroup mContainer;
- @Mock private ShadeViewController mShadeViewController;
+ @Mock private ShadeLockscreenInteractor mShadeLockscreenInteractor;
@Mock private BiometricUnlockController mBiometricUnlockController;
@Mock private SysuiStatusBarStateController mStatusBarStateController;
@Mock private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@@ -206,7 +205,6 @@
mock(DockManager.class),
mNotificationShadeWindowController,
mKeyguardStateController,
- mock(NotificationMediaManager.class),
mKeyguardMessageAreaFactory,
Optional.of(mSysUiUnfoldComponent),
() -> mShadeController,
@@ -234,7 +232,7 @@
.thenReturn(mOnBackInvokedDispatcher);
mStatusBarKeyguardViewManager.registerCentralSurfaces(
mCentralSurfaces,
- mShadeViewController,
+ mShadeLockscreenInteractor,
new ShadeExpansionStateManager(),
mBiometricUnlockController,
mNotificationContainer,
@@ -715,7 +713,6 @@
mock(DockManager.class),
mock(NotificationShadeWindowController.class),
mKeyguardStateController,
- mock(NotificationMediaManager.class),
mKeyguardMessageAreaFactory,
Optional.of(mSysUiUnfoldComponent),
() -> mShadeController,
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ShadeControllerKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ShadeControllerKosmos.kt
index 82e0b8e..f4acf4d 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ShadeControllerKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ShadeControllerKosmos.kt
@@ -73,7 +73,7 @@
deviceProvisionedController,
mock<NotificationShadeWindowController>(),
mock<WindowManager>(),
- { mock<ShadeViewController>() },
+ { mock<NotificationPanelViewController>() },
{ mock<AssistManager>() },
{ mock<NotificationGutsManager>() },
)
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeLockscreenInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeLockscreenInteractorKosmos.kt
new file mode 100644
index 0000000..4221d06
--- /dev/null
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeLockscreenInteractorKosmos.kt
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.shade.domain.interactor
+
+import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.kosmos.testScope
+import com.android.systemui.scene.domain.interactor.sceneInteractor
+import com.android.systemui.util.mockito.mock
+
+val Kosmos.shadeLockscreenInteractor by
+ Kosmos.Fixture {
+ ShadeLockscreenInteractorImpl(
+ scope = testScope,
+ shadeInteractor = shadeInteractorImpl,
+ sceneInteractor = sceneInteractor,
+ lockIconViewController = mock(),
+ )
+ }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerKosmos.kt
index 1c6ce79..81888c484 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/LockscreenShadeTransitionControllerKosmos.kt
@@ -26,9 +26,9 @@
import com.android.systemui.kosmos.Kosmos.Fixture
import com.android.systemui.media.controls.ui.mediaHierarchyManager
import com.android.systemui.plugins.activityStarter
-import com.android.systemui.power.domain.interactor.powerInteractor
import com.android.systemui.shade.data.repository.shadeRepository
import com.android.systemui.shade.domain.interactor.shadeInteractor
+import com.android.systemui.shade.domain.interactor.shadeLockscreenInteractor
import com.android.systemui.statusbar.notification.stack.ambientState
import com.android.systemui.statusbar.phone.keyguardBypassController
import com.android.systemui.statusbar.phone.lsShadeTransitionLogger
@@ -58,8 +58,8 @@
qsTransitionControllerFactory = lockscreenShadeQsTransitionControllerFactory,
shadeRepository = shadeRepository,
shadeInteractor = shadeInteractor,
- powerInteractor = powerInteractor,
splitShadeStateController = splitShadeStateController,
+ shadeLockscreenInteractorLazy = { shadeLockscreenInteractor },
naturalScrollingSettingObserver = naturalScrollingSettingObserver,
)
}