diff options
25 files changed, 334 insertions, 190 deletions
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 7a78b366dd7f..91699381ae7a 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.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); } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java index ce03072e2f0b..c3c42399f1f7 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java @@ -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, diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 641b9677c2e5..c6b99528b2ba 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -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, diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 9a03393be979..40f0132d5cf5 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -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); } diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java b/packages/SystemUI/src/com/android/systemui/shade/ShadeControllerImpl.java index e8d9c35a893b..ea419127d7c1 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 @@ 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() { diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeEmptyImplModule.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeEmptyImplModule.kt index f89a9c701047..d393f0d0b72b 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 @@ abstract class ShadeEmptyImplModule { @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 000000000000..a9ba6f96b7d2 --- /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 e4d5d22c602c..86fdceea57ef 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.ShadeInteractor 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 @@ abstract class ShadeModule { 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 0befb61ff814..941c6f33bc16 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 @@ import com.android.systemui.statusbar.policy.HeadsUpManager * 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 74035bd442db..44c6a82d93ca 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 @@ interface ShadeViewController { /** 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 @@ interface ShadeViewController { /** 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 @@ interface ShadeViewController { /** 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 @@ interface ShadeViewController { */ 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 @@ interface ShadeViewController { /** 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 @@ interface ShadeViewController { */ 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 5d966ac51bc8..7a181f106514 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 @@ import javax.inject.Inject /** 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 @@ class ShadeViewControllerEmptyImpl @Inject constructor() : 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 000000000000..21a782e43b78 --- /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 62c9980c336c..0b470c179dbf 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 @@ package com.android.systemui.statusbar 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 @@ class LockscreenShadeKeyguardTransitionController @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 @@ constructor( 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 @@ constructor( @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 2e7110381b91..1dbd87e0aa97 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.ActivityStarter.OnDismissAction 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.phone.LSShadeTransitionLogger 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 @@ constructor( 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 @@ constructor( 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 @@ constructor( val touchHelper = DragDownHelper( falsingManager, - falsingCollector, this, naturalScrollingSettingObserver, shadeRepository, @@ -181,7 +179,7 @@ constructor( } private val keyguardTransitionController by lazy { - keyguardTransitionControllerFactory.create(shadeViewController) + keyguardTransitionControllerFactory.create(shadeLockscreenInteractorLazy.get()) } private val qsTransitionController = qsTransitionControllerFactory.create { qS } @@ -320,7 +318,7 @@ constructor( 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 @@ constructor( } 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 @@ constructor( */ private fun performDefaultGoToFullShadeAnimation(delay: Long) { logger.logDefaultGoToFullShadeAnimation(delay) - shadeViewController.transitionToExpandedShade(delay) + shadeLockscreenInteractorLazy.get().transitionToExpandedShade(delay) animateAppear(delay) } @@ -686,7 +684,7 @@ constructor( } 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 @@ constructor( */ 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 @@ class DragDownHelper( 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 b0fefdd36012..b772158b0825 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -982,7 +982,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { 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 45005cbc28a5..442e43a9dae2 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.flags.FeatureFlagsClassic; 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 @@ public final class DozeServiceHost implements DozeHost { 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 @@ public final class DozeServiceHost implements DozeHost { NotificationWakeUpCoordinator notificationWakeUpCoordinator, AuthController authController, NotificationIconAreaController notificationIconAreaController, + ShadeLockscreenInteractor shadeLockscreenInteractor, DozeInteractor dozeInteractor) { super(); mDozeLog = dozeLog; @@ -141,6 +142,7 @@ public final class DozeServiceHost implements DozeHost { mNotificationWakeUpCoordinator = notificationWakeUpCoordinator; mAuthController = authController; mNotificationIconAreaController = notificationIconAreaController; + mShadeLockscreenInteractor = shadeLockscreenInteractor; mHeadsUpManager.addListener(mOnHeadsUpChangedListener); mDozeInteractor = dozeInteractor; } @@ -154,11 +156,9 @@ public final class DozeServiceHost implements DozeHost { CentralSurfaces centralSurfaces, StatusBarKeyguardViewManager statusBarKeyguardViewManager, NotificationShadeWindowViewController notificationShadeWindowViewController, - ShadeViewController notificationPanel, View ambientIndicationContainer) { mCentralSurfaces = centralSurfaces; mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; - mNotificationPanel = notificationPanel; mNotificationShadeWindowViewController = notificationShadeWindowViewController; mAmbientIndicationContainer = ambientIndicationContainer; } @@ -290,7 +290,7 @@ public final class DozeServiceHost implements DozeHost { 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 @@ public final class DozeServiceHost implements DozeHost { @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 9d70f4221e3a..29fd2258b40c 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.ShadeController; 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 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb 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 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb // 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 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb DockManager dockManager, NotificationShadeWindowController notificationShadeWindowController, KeyguardStateController keyguardStateController, - NotificationMediaManager notificationMediaManager, KeyguardMessageAreaController.Factory keyguardMessageAreaFactory, Optional<SysUIUnfoldComponent> sysUIUnfoldComponent, Lazy<ShadeController> shadeController, @@ -391,7 +388,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mNotificationShadeWindowController = notificationShadeWindowController; mDreamOverlayStateController = dreamOverlayStateController; mKeyguardStateController = keyguardStateController; - mMediaManager = notificationMediaManager; mKeyguardUpdateManager = keyguardUpdateMonitor; mStatusBarStateController = sysuiStatusBarStateController; mDockManager = dockManager; @@ -422,7 +418,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb @Override public void registerCentralSurfaces(CentralSurfaces centralSurfaces, - ShadeViewController shadeViewController, + ShadeLockscreenInteractor shadeLockscreenInteractor, ShadeExpansionStateManager shadeExpansionStateManager, BiometricUnlockController biometricUnlockController, View notificationContainer, @@ -431,7 +427,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mBiometricUnlockController = biometricUnlockController; mPrimaryBouncerCallbackInteractor.addBouncerExpansionCallback(mExpansionCallback); - mShadeViewController = shadeViewController; + mShadeLockscreenInteractor = shadeLockscreenInteractor; if (shadeExpansionStateManager != null) { ShadeExpansionChangeEvent currentState = shadeExpansionStateManager.addExpansionListener(this); @@ -565,8 +561,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb // 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 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb 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 class StatusBarKeyguardViewManager implements RemoteInputController.Callb 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 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } else if (finishRunnable != null) { finishRunnable.run(); } - mShadeViewController.blockExpansionForCurrentTouch(); + mShadeLockscreenInteractor.blockExpansionForCurrentTouch(); } @Override public void blockPanelExpansionFromCurrentTouch() { - mShadeViewController.blockExpansionForCurrentTouch(); + mShadeLockscreenInteractor.blockExpansionForCurrentTouch(); } @Override @@ -1125,7 +1121,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public void onKeyguardFadedAway() { mNotificationContainer.postDelayed(() -> mNotificationShadeWindowController .setKeyguardFadingAway(false), 100); - mShadeViewController.resetViewGroupFade(); + mShadeLockscreenInteractor.resetViewGroupFade(); mCentralSurfaces.finishKeyguardFadingAway(); mBiometricUnlockController.finishKeyguardFadingAway(); } @@ -1208,7 +1204,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb 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 44b897447759..dddd4246f07c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java @@ -838,10 +838,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { 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 cc79ca4efaa1..f48993754e63 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 @@ class ShadeControllerImplTest : SysuiTestCase() { @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 @@ class ShadeControllerImplTest : SysuiTestCase() { deviceProvisionedController, notificationShadeWindowController, windowManager, - Lazy { shadeViewController }, + Lazy { npvc }, Lazy { assistManager }, Lazy { gutsManager }, ) @@ -134,9 +134,9 @@ class ShadeControllerImplTest : SysuiTestCase() { // 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 @@ class ShadeControllerImplTest : SysuiTestCase() { // 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 @@ class ShadeControllerImplTest : SysuiTestCase() { @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 ffde6015c127..9ec9b69d44c0 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.SysuiTestCase 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 @@ class DragDownHelperTest : SysuiTestCase() { 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 3efcf7b7c26b..0933425d2405 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.AndroidTestingRunner 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.media.controls.ui.MediaHierarchyManager 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.clearInvocations 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 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { @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 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { keyguardTransitionControllerFactory = { notificationPanelController -> LockscreenShadeKeyguardTransitionController( mediaHierarchyManager = mediaHierarchyManager, - notificationPanelController = notificationPanelController, + shadeLockscreenInteractor = notificationPanelController, context = context, configurationController = configurationController, dumpManager = mock(), @@ -186,13 +186,12 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { 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 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { 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 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { 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 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { fun testGoToLockedShadeAlwaysCreatesQSAnimationInSplitShade() { enableSplitShade() transitionController.goToLockedShade(null, needsQSAnimation = true) - verify(shadeViewController).transitionToExpandedShade(anyLong()) + verify(shadeLockscreenInteractor).transitionToExpandedShade(anyLong()) assertNotNull(transitionController.dragDownAnimator) } @@ -358,7 +357,7 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { fun setDragAmount_setsKeyguardTransitionProgress() { transitionController.dragDownAmount = 10f - verify(shadeViewController).setKeyguardTransitionProgress(anyFloat(), anyInt()) + verify(shadeLockscreenInteractor).setKeyguardTransitionProgress(anyFloat(), anyInt()) } @Test @@ -370,7 +369,7 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { 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 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { transitionController.dragDownAmount = 10f - verify(shadeViewController).setKeyguardTransitionProgress(anyFloat(), eq(0)) + verify(shadeLockscreenInteractor).setKeyguardTransitionProgress(anyFloat(), eq(0)) } @Test @@ -396,7 +395,8 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { transitionController.dragDownAmount = 10f - verify(shadeViewController).setKeyguardTransitionProgress(anyFloat(), eq(mediaTranslationY)) + verify(shadeLockscreenInteractor) + .setKeyguardTransitionProgress(anyFloat(), eq(mediaTranslationY)) } @Test @@ -416,7 +416,7 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { 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 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { transitionController.dragDownAmount = dragDownAmount val expectedAlpha = 1 - dragDownAmount / alphaDistance - verify(shadeViewController).setKeyguardStatusBarAlpha(expectedAlpha) + verify(shadeLockscreenInteractor).setKeyguardStatusBarAlpha(expectedAlpha) } @Test @@ -564,7 +564,7 @@ class LockscreenShadeTransitionControllerTest : SysuiTestCase() { 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 4015361dc277..bd7406ad004b 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.NotificationShadeWindowView; 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 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { @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 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { mock(DockManager.class), mNotificationShadeWindowController, mKeyguardStateController, - mock(NotificationMediaManager.class), mKeyguardMessageAreaFactory, Optional.of(mSysUiUnfoldComponent), () -> mShadeController, @@ -234,7 +232,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { .thenReturn(mOnBackInvokedDispatcher); mStatusBarKeyguardViewManager.registerCentralSurfaces( mCentralSurfaces, - mShadeViewController, + mShadeLockscreenInteractor, new ShadeExpansionStateManager(), mBiometricUnlockController, mNotificationContainer, @@ -715,7 +713,6 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { 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 82e0b8e83f24..f4acf4d8fb53 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 @@ val Kosmos.shadeControllerImpl by 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 000000000000..4221d06e27ed --- /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 1c6ce7987cd5..81888c48488a 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 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 @@ val Kosmos.lockscreenShadeTransitionController by Fixture { qsTransitionControllerFactory = lockscreenShadeQsTransitionControllerFactory, shadeRepository = shadeRepository, shadeInteractor = shadeInteractor, - powerInteractor = powerInteractor, splitShadeStateController = splitShadeStateController, + shadeLockscreenInteractorLazy = { shadeLockscreenInteractor }, naturalScrollingSettingObserver = naturalScrollingSettingObserver, ) } |