diff options
22 files changed, 117 insertions, 126 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 0b36920f603f..bbbef04db2fc 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -61,7 +61,6 @@ import android.graphics.Rect; import android.graphics.Region; import android.os.Bundle; import android.os.Handler; -import android.os.PowerManager; import android.os.Trace; import android.os.UserManager; import android.os.VibrationEffect; @@ -164,6 +163,7 @@ import com.android.systemui.power.domain.interactor.PowerInteractor; import com.android.systemui.power.shared.model.WakefulnessModel; import com.android.systemui.res.R; import com.android.systemui.shade.data.repository.ShadeRepository; +import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractor; import com.android.systemui.shade.transition.ShadeTransitionController; import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.statusbar.CommandQueue; @@ -352,6 +352,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private final NotificationShadeWindowController mNotificationShadeWindowController; private final ShadeExpansionStateManager mShadeExpansionStateManager; private final ShadeRepository mShadeRepository; + private final ShadeAnimationInteractor mShadeAnimationInteractor; private final FalsingTapListener mFalsingTapListener = this::falsingAdditionalTapRequired; private final AccessibilityDelegate mAccessibilityDelegate = new ShadeAccessibilityDelegate(); private final NotificationGutsManager mGutsManager; @@ -362,7 +363,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private long mDownTime; private boolean mTouchSlopExceededBeforeDown; - private boolean mIsLaunchAnimationRunning; private float mOverExpansion; private CentralSurfaces mCentralSurfaces; private HeadsUpManager mHeadsUpManager; @@ -707,7 +707,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump CommandQueue commandQueue, VibratorHelper vibratorHelper, LatencyTracker latencyTracker, - PowerManager powerManager, AccessibilityManager accessibilityManager, @DisplayId int displayId, KeyguardUpdateMonitor keyguardUpdateMonitor, @@ -776,6 +775,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump ActivityStarter activityStarter, SharedNotificationContainerInteractor sharedNotificationContainerInteractor, ActiveNotificationsInteractor activeNotificationsInteractor, + ShadeAnimationInteractor shadeAnimationInteractor, KeyguardViewConfigurator keyguardViewConfigurator, KeyguardFaceAuthInteractor keyguardFaceAuthInteractor, SplitShadeStateController splitShadeStateController, @@ -794,6 +794,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mLockscreenGestureLogger = lockscreenGestureLogger; mShadeExpansionStateManager = shadeExpansionStateManager; mShadeRepository = shadeRepository; + mShadeAnimationInteractor = shadeAnimationInteractor; mShadeLog = shadeLogger; mGutsManager = gutsManager; mDreamingToLockscreenTransitionViewModel = dreamingToLockscreenTransitionViewModel; @@ -2923,13 +2924,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } } - @Override - public void setIsLaunchAnimationRunning(boolean running) { - boolean wasRunning = mIsLaunchAnimationRunning; - mIsLaunchAnimationRunning = running; - if (wasRunning != mIsLaunchAnimationRunning) { - mShadeExpansionStateManager.notifyLaunchingActivityChanged(running); - } + private boolean isLaunchingActivity() { + return mShadeAnimationInteractor.isLaunchingActivity().getValue(); } @VisibleForTesting @@ -3117,7 +3113,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump @Override public boolean shouldHideStatusBarIconsWhenExpanded() { - if (mIsLaunchAnimationRunning) { + if (isLaunchingActivity()) { return mHideIconsDuringLaunchAnimation; } if (mHeadsUpAppearanceController != null @@ -3383,7 +3379,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump ipw.print("mDownTime="); ipw.println(mDownTime); ipw.print("mTouchSlopExceededBeforeDown="); ipw.println(mTouchSlopExceededBeforeDown); - ipw.print("mIsLaunchAnimationRunning="); ipw.println(mIsLaunchAnimationRunning); + ipw.print("mIsLaunchAnimationRunning="); ipw.println(isLaunchingActivity()); ipw.print("mOverExpansion="); ipw.println(mOverExpansion); ipw.print("mExpandedHeight="); ipw.println(mExpandedHeight); ipw.print("isTracking()="); ipw.println(isTracking()); @@ -3999,7 +3995,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump @Override public boolean isCollapsing() { - return isClosing() || mIsLaunchAnimationRunning; + return isClosing() || isLaunchingActivity(); } public boolean isTracking() { diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeEmptyImplModule.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeEmptyImplModule.kt index 832fefc33ae0..67bb8144af96 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeEmptyImplModule.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeEmptyImplModule.kt @@ -17,6 +17,8 @@ package com.android.systemui.shade import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.shade.data.repository.ShadeRepository +import com.android.systemui.shade.data.repository.ShadeRepositoryImpl import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractor import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractorEmptyImpl import com.android.systemui.shade.domain.interactor.ShadeInteractor @@ -41,6 +43,10 @@ abstract class ShadeEmptyImplModule { @Binds @SysUISingleton + abstract fun bindsShadeRepository(impl: ShadeRepositoryImpl): ShadeRepository + + @Binds + @SysUISingleton abstract fun bindsShadeAnimationInteractor( sai: ShadeAnimationInteractorEmptyImpl ): ShadeAnimationInteractor diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeExpansionStateManager.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeExpansionStateManager.kt index d6db19e507a6..8a93ef65b4bf 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeExpansionStateManager.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeExpansionStateManager.kt @@ -22,7 +22,6 @@ import android.os.Trace.TRACE_TAG_APP as TRACE_TAG import android.util.Log import androidx.annotation.FloatRange import com.android.systemui.dagger.SysUISingleton -import com.android.systemui.shade.ShadeStateEvents.ShadeStateEventsListener import com.android.systemui.util.Compile import java.util.concurrent.CopyOnWriteArrayList import javax.inject.Inject @@ -33,11 +32,10 @@ import javax.inject.Inject * TODO(b/200063118): Make this class the one source of truth for the state of panel expansion. */ @SysUISingleton -class ShadeExpansionStateManager @Inject constructor() : ShadeStateEvents { +class ShadeExpansionStateManager @Inject constructor() { private val expansionListeners = CopyOnWriteArrayList<ShadeExpansionListener>() private val stateListeners = CopyOnWriteArrayList<ShadeStateListener>() - private val shadeStateEventsListeners = CopyOnWriteArrayList<ShadeStateEventsListener>() @PanelState private var state: Int = STATE_CLOSED @FloatRange(from = 0.0, to = 1.0) private var fraction: Float = 0f @@ -66,14 +64,6 @@ class ShadeExpansionStateManager @Inject constructor() : ShadeStateEvents { stateListeners.add(listener) } - override fun addShadeStateEventsListener(listener: ShadeStateEventsListener) { - shadeStateEventsListeners.addIfAbsent(listener) - } - - override fun removeShadeStateEventsListener(listener: ShadeStateEventsListener) { - shadeStateEventsListeners.remove(listener) - } - /** Returns true if the panel is currently closed and false otherwise. */ fun isClosed(): Boolean = state == STATE_CLOSED @@ -157,12 +147,6 @@ class ShadeExpansionStateManager @Inject constructor() : ShadeStateEvents { stateListeners.forEach { it.onPanelStateChanged(state) } } - fun notifyLaunchingActivityChanged(isLaunchingActivity: Boolean) { - for (cb in shadeStateEventsListeners) { - cb.onLaunchingActivityChanged(isLaunchingActivity) - } - } - private fun debugLog(msg: String) { if (!DEBUG) return Log.v(TAG, msg) diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt index d9b298d0dfa9..c057147b022a 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt @@ -18,6 +18,8 @@ package com.android.systemui.shade import com.android.systemui.dagger.SysUISingleton import com.android.systemui.scene.shared.flag.SceneContainerFlags +import com.android.systemui.shade.data.repository.ShadeRepository +import com.android.systemui.shade.data.repository.ShadeRepositoryImpl import com.android.systemui.shade.domain.interactor.BaseShadeInteractor import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractor import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractorLegacyImpl @@ -66,6 +68,10 @@ abstract class ShadeModule { @Binds @SysUISingleton + abstract fun bindsShadeRepository(impl: ShadeRepositoryImpl): ShadeRepository + + @Binds + @SysUISingleton abstract fun bindsShadeInteractor(si: ShadeInteractorImpl): ShadeInteractor @Binds diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeStateEvents.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeStateEvents.kt deleted file mode 100644 index ff96ca3caeea..000000000000 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeStateEvents.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2022 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 - -/** Provides certain notification panel events. */ -interface ShadeStateEvents { - - /** Registers callbacks to be invoked when notification panel events occur. */ - fun addShadeStateEventsListener(listener: ShadeStateEventsListener) - - /** Unregisters callbacks previously registered via [addShadeStateEventsListener] */ - fun removeShadeStateEventsListener(listener: ShadeStateEventsListener) - - /** Callbacks for certain notification panel events. */ - interface ShadeStateEventsListener { - /** - * Invoked when the notification panel starts or stops launching an [android.app.Activity]. - */ - fun onLaunchingActivityChanged(isLaunchingActivity: Boolean) {} - } -} diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt index 637cf968e336..3430eedd4ed6 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewController.kt @@ -158,9 +158,6 @@ interface ShadeViewController { /** Sets progress of the predictive back animation. */ fun onBackProgressed(progressFraction: Float) - /** Sets whether the status bar launch animation is currently running. */ - fun setIsLaunchAnimationRunning(running: Boolean) - /** Sets the alpha value of the shade to a value between 0 and 255. */ fun setAlpha(alpha: Int, animate: Boolean) diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewControllerEmptyImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewControllerEmptyImpl.kt index 2ed62dd00337..1240c6e3262b 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeViewControllerEmptyImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeViewControllerEmptyImpl.kt @@ -59,7 +59,6 @@ class ShadeViewControllerEmptyImpl @Inject constructor() : ShadeViewController { } override fun onBackPressed() {} override fun onBackProgressed(progressFraction: Float) {} - override fun setIsLaunchAnimationRunning(running: Boolean) {} override fun setAlpha(alpha: Int, animate: Boolean) {} override fun setAlphaChangeAnimationEndAction(r: Runnable) {} override fun setPulsing(pulsing: Boolean) {} diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeEventsModule.java b/packages/SystemUI/src/com/android/systemui/shade/data/repository/ShadeAnimationRepository.kt index f87a1ed57d15..b99a170f3c2e 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeEventsModule.java +++ b/packages/SystemUI/src/com/android/systemui/shade/data/repository/ShadeAnimationRepository.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2023 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. @@ -14,19 +14,14 @@ * limitations under the License. */ -package com.android.systemui.shade; +package com.android.systemui.shade.data.repository -import com.android.systemui.shade.data.repository.ShadeRepository; -import com.android.systemui.shade.data.repository.ShadeRepositoryImpl; +import com.android.systemui.dagger.SysUISingleton +import javax.inject.Inject +import kotlinx.coroutines.flow.MutableStateFlow -import dagger.Binds; -import dagger.Module; - -/** Provides Shade-related events and information. */ -@Module -public abstract class ShadeEventsModule { - @Binds - abstract ShadeStateEvents bindShadeEvents(ShadeExpansionStateManager impl); - - @Binds abstract ShadeRepository shadeRepository(ShadeRepositoryImpl impl); +/** Data related to programmatic shade animations. */ +@SysUISingleton +class ShadeAnimationRepository @Inject constructor() { + val isLaunchingActivity = MutableStateFlow(false) } diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractor.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractor.kt index ff422b72c694..5a777e8574d6 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractor.kt @@ -16,15 +16,27 @@ package com.android.systemui.shade.domain.interactor +import com.android.systemui.shade.data.repository.ShadeAnimationRepository import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow /** Business logic related to shade animations and transitions. */ -interface ShadeAnimationInteractor { +abstract class ShadeAnimationInteractor( + private val shadeAnimationRepository: ShadeAnimationRepository, +) { + val isLaunchingActivity: StateFlow<Boolean> = + shadeAnimationRepository.isLaunchingActivity.asStateFlow() + + fun setIsLaunchingActivity(launching: Boolean) { + shadeAnimationRepository.isLaunchingActivity.value = launching + } + /** * Whether a short animation to close the shade or QS is running. This will be false if the user * is manually closing the shade or QS but true if they lift their finger and an animation * completes the close. Important: if QS is collapsing back to shade, this will be false because * that is not considered "closing". */ - val isAnyCloseAnimationRunning: Flow<Boolean> + abstract val isAnyCloseAnimationRunning: Flow<Boolean> } diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorEmptyImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorEmptyImpl.kt index b4a134fd1910..2a7658a8eed7 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorEmptyImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorEmptyImpl.kt @@ -17,11 +17,16 @@ package com.android.systemui.shade.domain.interactor import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.shade.data.repository.ShadeAnimationRepository import javax.inject.Inject import kotlinx.coroutines.flow.flowOf /** Implementation of ShadeAnimationInteractor for shadeless SysUI variants. */ @SysUISingleton -class ShadeAnimationInteractorEmptyImpl @Inject constructor() : ShadeAnimationInteractor { +class ShadeAnimationInteractorEmptyImpl +@Inject +constructor( + shadeAnimationRepository: ShadeAnimationRepository, +) : ShadeAnimationInteractor(shadeAnimationRepository) { override val isAnyCloseAnimationRunning = flowOf(false) } diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorLegacyImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorLegacyImpl.kt index d51409365014..c4f41346eab7 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorLegacyImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorLegacyImpl.kt @@ -17,6 +17,7 @@ package com.android.systemui.shade.domain.interactor import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.shade.data.repository.ShadeAnimationRepository import com.android.systemui.shade.data.repository.ShadeRepository import javax.inject.Inject @@ -25,7 +26,8 @@ import javax.inject.Inject class ShadeAnimationInteractorLegacyImpl @Inject constructor( + shadeAnimationRepository: ShadeAnimationRepository, shadeRepository: ShadeRepository, -) : ShadeAnimationInteractor { +) : ShadeAnimationInteractor(shadeAnimationRepository) { override val isAnyCloseAnimationRunning = shadeRepository.legacyIsClosing } diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorSceneContainerImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorSceneContainerImpl.kt index 7c0762d755de..1ee6d3845553 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorSceneContainerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorSceneContainerImpl.kt @@ -20,6 +20,7 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.model.ObservableTransitionState import com.android.systemui.scene.shared.model.SceneKey +import com.android.systemui.shade.data.repository.ShadeAnimationRepository import javax.inject.Inject import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.distinctUntilChanged @@ -32,8 +33,9 @@ import kotlinx.coroutines.flow.map class ShadeAnimationInteractorSceneContainerImpl @Inject constructor( + shadeAnimationRepository: ShadeAnimationRepository, sceneInteractor: SceneInteractor, -) : ShadeAnimationInteractor { +) : ShadeAnimationInteractor(shadeAnimationRepository) { @OptIn(ExperimentalCoroutinesApi::class) override val isAnyCloseAnimationRunning = sceneInteractor.transitionState diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinator.java index 46e2391c87e8..a0129ff5cd90 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinator.java @@ -28,7 +28,6 @@ import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.plugins.statusbar.StatusBarStateController; -import com.android.systemui.shade.ShadeStateEvents; import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractor; import com.android.systemui.statusbar.notification.VisibilityLocationProvider; import com.android.systemui.statusbar.notification.collection.GroupEntry; @@ -57,13 +56,11 @@ import javax.inject.Inject; */ // TODO(b/204468557): Move to @CoordinatorScope @SysUISingleton -public class VisualStabilityCoordinator implements Coordinator, Dumpable, - ShadeStateEvents.ShadeStateEventsListener { +public class VisualStabilityCoordinator implements Coordinator, Dumpable { public static final String TAG = "VisualStability"; public static final boolean DEBUG = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.VERBOSE); private final DelayableExecutor mDelayableExecutor; private final HeadsUpManager mHeadsUpManager; - private final ShadeStateEvents mShadeStateEvents; private final ShadeAnimationInteractor mShadeAnimationInteractor; private final StatusBarStateController mStatusBarStateController; private final JavaAdapter mJavaAdapter; @@ -98,7 +95,6 @@ public class VisualStabilityCoordinator implements Coordinator, Dumpable, DelayableExecutor delayableExecutor, DumpManager dumpManager, HeadsUpManager headsUpManager, - ShadeStateEvents shadeStateEvents, ShadeAnimationInteractor shadeAnimationInteractor, JavaAdapter javaAdapter, StatusBarStateController statusBarStateController, @@ -113,7 +109,6 @@ public class VisualStabilityCoordinator implements Coordinator, Dumpable, mWakefulnessLifecycle = wakefulnessLifecycle; mStatusBarStateController = statusBarStateController; mDelayableExecutor = delayableExecutor; - mShadeStateEvents = shadeStateEvents; dumpManager.registerDumpable(this); } @@ -126,9 +121,10 @@ public class VisualStabilityCoordinator implements Coordinator, Dumpable, mStatusBarStateController.addCallback(mStatusBarStateControllerListener); mPulsing = mStatusBarStateController.isPulsing(); - mShadeStateEvents.addShadeStateEventsListener(this); mJavaAdapter.alwaysCollectFlow(mShadeAnimationInteractor.isAnyCloseAnimationRunning(), this::onShadeOrQsClosingChanged); + mJavaAdapter.alwaysCollectFlow(mShadeAnimationInteractor.isLaunchingActivity(), + this::onLaunchingActivityChanged); pipeline.setVisualStabilityManager(mNotifStabilityManager); } @@ -337,8 +333,7 @@ public class VisualStabilityCoordinator implements Coordinator, Dumpable, updateAllowedStates("notifPanelCollapsing", isClosing); } - @Override - public void onLaunchingActivityChanged(boolean isLaunchingActivity) { + private void onLaunchingActivityChanged(boolean isLaunchingActivity) { mNotifPanelLaunchingActivity = isLaunchingActivity; updateAllowedStates("notifPanelLaunchingActivity", isLaunchingActivity); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java index 0f14135f1d4c..3a722050dab2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/dagger/NotificationsModule.java @@ -25,7 +25,6 @@ import com.android.systemui.dagger.qualifiers.UiBackground; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.res.R; import com.android.systemui.scene.domain.interactor.WindowRootViewVisibilityInteractor; -import com.android.systemui.shade.ShadeEventsModule; import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.notification.NotificationActivityStarter; import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorControllerProvider; @@ -100,7 +99,6 @@ import javax.inject.Provider; CoordinatorsModule.class, FooterViewModelModule.class, KeyguardNotificationVisibilityProviderModule.class, - ShadeEventsModule.class, NotificationDataLayerModule.class, NotifPipelineChoreographerModule.class, NotificationSectionHeadersModule.class, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt index 7aa7976b8f92..63194c37bbe1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt @@ -46,6 +46,7 @@ import com.android.systemui.res.R import com.android.systemui.settings.UserTracker import com.android.systemui.shade.ShadeController import com.android.systemui.shade.ShadeViewController +import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractor import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.NotificationShadeWindowController import com.android.systemui.statusbar.SysuiStatusBarStateController @@ -71,6 +72,7 @@ constructor( private val keyguardViewMediatorLazy: Lazy<KeyguardViewMediator>, private val shadeControllerLazy: Lazy<ShadeController>, private val shadeViewControllerLazy: Lazy<ShadeViewController>, + private val shadeAnimationInteractor: ShadeAnimationInteractor, private val statusBarKeyguardViewManagerLazy: Lazy<StatusBarKeyguardViewManager>, private val notifShadeWindowControllerLazy: Lazy<NotificationShadeWindowController>, private val activityLaunchAnimator: ActivityLaunchAnimator, @@ -863,6 +865,7 @@ constructor( return StatusBarLaunchAnimatorController( animationController, shadeViewControllerLazy.get(), + shadeAnimationInteractor, shadeControllerLazy.get(), notifShadeWindowControllerLazy.get(), isLaunchForActivity diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarLaunchAnimatorController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarLaunchAnimatorController.kt index b67ec581f8a2..8ca5bfc519fc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarLaunchAnimatorController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarLaunchAnimatorController.kt @@ -5,6 +5,7 @@ import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.animation.LaunchAnimator import com.android.systemui.shade.ShadeController import com.android.systemui.shade.ShadeViewController +import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractor import com.android.systemui.statusbar.NotificationShadeWindowController /** @@ -14,6 +15,7 @@ import com.android.systemui.statusbar.NotificationShadeWindowController class StatusBarLaunchAnimatorController( private val delegate: ActivityLaunchAnimator.Controller, private val shadeViewController: ShadeViewController, + private val shadeAnimationInteractor: ShadeAnimationInteractor, private val shadeController: ShadeController, private val notificationShadeWindowController: NotificationShadeWindowController, private val isLaunchForActivity: Boolean = true @@ -26,7 +28,7 @@ class StatusBarLaunchAnimatorController( override fun onIntentStarted(willAnimate: Boolean) { delegate.onIntentStarted(willAnimate) if (willAnimate) { - shadeViewController.setIsLaunchAnimationRunning(true) + shadeAnimationInteractor.setIsLaunchingActivity(true) } else { shadeController.collapseOnMainThread() } @@ -34,7 +36,7 @@ class StatusBarLaunchAnimatorController( override fun onLaunchAnimationStart(isExpandingFullyAbove: Boolean) { delegate.onLaunchAnimationStart(isExpandingFullyAbove) - shadeViewController.setIsLaunchAnimationRunning(true) + shadeAnimationInteractor.setIsLaunchingActivity(true) if (!isExpandingFullyAbove) { shadeViewController.collapseWithDuration( ActivityLaunchAnimator.TIMINGS.totalDuration.toInt()) @@ -43,7 +45,7 @@ class StatusBarLaunchAnimatorController( override fun onLaunchAnimationEnd(isExpandingFullyAbove: Boolean) { delegate.onLaunchAnimationEnd(isExpandingFullyAbove) - shadeViewController.setIsLaunchAnimationRunning(false) + shadeAnimationInteractor.setIsLaunchingActivity(false) shadeController.onLaunchAnimationEnd(isExpandingFullyAbove) } @@ -58,7 +60,7 @@ class StatusBarLaunchAnimatorController( override fun onLaunchAnimationCancelled(newKeyguardOccludedState: Boolean?) { delegate.onLaunchAnimationCancelled() - shadeViewController.setIsLaunchAnimationRunning(false) + shadeAnimationInteractor.setIsLaunchingActivity(false) shadeController.onLaunchAnimationCancelled(isLaunchForActivity) } }
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java index 2e1a0770757b..9da61112fd0c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java @@ -56,12 +56,12 @@ import com.android.systemui.animation.ActivityLaunchAnimator; import com.android.systemui.assist.AssistManager; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.DisplayId; -import com.android.systemui.flags.FeatureFlags; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.power.domain.interactor.PowerInteractor; import com.android.systemui.settings.UserTracker; import com.android.systemui.shade.ShadeController; import com.android.systemui.shade.ShadeViewController; +import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractor; import com.android.systemui.statusbar.NotificationClickNotifier; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationPresenter; @@ -117,7 +117,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit private final LockPatternUtils mLockPatternUtils; private final StatusBarRemoteInputCallback mStatusBarRemoteInputCallback; private final ActivityIntentHelper mActivityIntentHelper; - private final FeatureFlags mFeatureFlags; + private final ShadeAnimationInteractor mShadeAnimationInteractor; private final MetricsLogger mMetricsLogger; private final StatusBarNotificationActivityStarterLogger mLogger; @@ -162,10 +162,10 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit ShadeViewController shadeViewController, NotificationShadeWindowController notificationShadeWindowController, ActivityLaunchAnimator activityLaunchAnimator, + ShadeAnimationInteractor shadeAnimationInteractor, NotificationLaunchAnimatorControllerProvider notificationAnimationProvider, LaunchFullScreenIntentProvider launchFullScreenIntentProvider, PowerInteractor powerInteractor, - FeatureFlags featureFlags, UserTracker userTracker) { mContext = context; mDisplayId = displayId; @@ -188,7 +188,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit mStatusBarRemoteInputCallback = remoteInputCallback; mActivityIntentHelper = activityIntentHelper; mNotificationShadeWindowController = notificationShadeWindowController; - mFeatureFlags = featureFlags; + mShadeAnimationInteractor = shadeAnimationInteractor; mMetricsLogger = metricsLogger; mLogger = logger; mOnUserInteractionCallback = onUserInteractionCallback; @@ -444,6 +444,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit new StatusBarLaunchAnimatorController( mNotificationAnimationProvider.getAnimatorController(row, null), mShadeViewController, + mShadeAnimationInteractor, mShadeController, mNotificationShadeWindowController, isActivityIntent); @@ -485,6 +486,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit new StatusBarLaunchAnimatorController( mNotificationAnimationProvider.getAnimatorController(row), mShadeViewController, + mShadeAnimationInteractor, mShadeController, mNotificationShadeWindowController, true /* isActivityIntent */); @@ -535,6 +537,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit : new StatusBarLaunchAnimatorController( viewController, mShadeViewController, + mShadeAnimationInteractor, mShadeController, mNotificationShadeWindowController, true /* isActivityIntent */); 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 03878b7bcf45..a618cd8f914b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java @@ -126,7 +126,10 @@ import com.android.systemui.res.R; import com.android.systemui.scene.SceneTestUtils; import com.android.systemui.screenrecord.RecordingController; import com.android.systemui.shade.data.repository.FakeShadeRepository; +import com.android.systemui.shade.data.repository.ShadeAnimationRepository; import com.android.systemui.shade.data.repository.ShadeRepository; +import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractor; +import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractorLegacyImpl; import com.android.systemui.shade.domain.interactor.ShadeInteractor; import com.android.systemui.shade.domain.interactor.ShadeInteractorImpl; import com.android.systemui.shade.domain.interactor.ShadeInteractorLegacyImpl; @@ -345,6 +348,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { protected KeyguardBottomAreaInteractor mKeyguardBottomAreaInteractor; protected FakeKeyguardRepository mFakeKeyguardRepository; protected KeyguardInteractor mKeyguardInteractor; + protected ShadeAnimationInteractor mShadeAnimationInteractor; protected SceneTestUtils mUtils = new SceneTestUtils(this); protected TestScope mTestScope = mUtils.getTestScope(); protected ShadeInteractor mShadeInteractor; @@ -391,6 +395,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mKeyguardBottomAreaInteractor = new KeyguardBottomAreaInteractor(mFakeKeyguardRepository); mKeyguardInteractor = keyguardInteractorDeps.getKeyguardInteractor(); mShadeRepository = new FakeShadeRepository(); + mShadeAnimationInteractor = new ShadeAnimationInteractorLegacyImpl( + new ShadeAnimationRepository(), mShadeRepository); mPowerInteractor = keyguardInteractorDeps.getPowerInteractor(); when(mKeyguardTransitionInteractor.isInTransitionToStateWhere(any())).thenReturn( StateFlowKt.MutableStateFlow(false)); @@ -649,7 +655,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mStatusBarWindowStateController, mNotificationShadeWindowController, mDozeLog, mDozeParameters, mCommandQueue, mVibratorHelper, - mLatencyTracker, mPowerManager, mAccessibilityManager, 0, mUpdateMonitor, + mLatencyTracker, mAccessibilityManager, 0, mUpdateMonitor, mMetricsLogger, mShadeLog, mConfigurationController, @@ -712,6 +718,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mActivityStarter, mSharedNotificationContainerInteractor, mActiveNotificationsInteractor, + mShadeAnimationInteractor, mKeyguardViewConfigurator, mKeyguardFaceAuthInteractor, new ResourcesSplitShadeStateController(), diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorSceneContainerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorSceneContainerImplTest.kt index 40006ba8dd82..6bbe900c8779 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorSceneContainerImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/domain/interactor/ShadeAnimationInteractorSceneContainerImplTest.kt @@ -146,4 +146,13 @@ class ShadeAnimationInteractorSceneContainerImplTest : SysuiTestCase() { // THEN qs is not animating closed Truth.assertThat(actual).isFalse() } + + @Test + fun updateIsLaunchingActivity() = + testComponent.runTest { + Truth.assertThat(underTest.isLaunchingActivity.value).isEqualTo(false) + + underTest.setIsLaunchingActivity(true) + Truth.assertThat(underTest.isLaunchingActivity.value).isEqualTo(true) + } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinatorTest.java index bd4647431ab9..2e74d119849e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinatorTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/VisualStabilityCoordinatorTest.java @@ -39,9 +39,11 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.plugins.statusbar.StatusBarStateController; -import com.android.systemui.shade.ShadeStateEvents; -import com.android.systemui.shade.ShadeStateEvents.ShadeStateEventsListener; +import com.android.systemui.shade.data.repository.FakeShadeRepository; +import com.android.systemui.shade.data.repository.ShadeAnimationRepository; +import com.android.systemui.shade.data.repository.ShadeRepository; import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractor; +import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractorLegacyImpl; import com.android.systemui.statusbar.notification.VisibilityLocationProvider; import com.android.systemui.statusbar.notification.collection.GroupEntry; import com.android.systemui.statusbar.notification.collection.GroupEntryBuilder; @@ -65,8 +67,6 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.verification.VerificationMode; -import kotlinx.coroutines.flow.MutableStateFlow; -import kotlinx.coroutines.flow.StateFlowKt; import kotlinx.coroutines.test.TestScope; @SmallTest @@ -82,25 +82,22 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase { @Mock private StatusBarStateController mStatusBarStateController; @Mock private Pluggable.PluggableListener<NotifStabilityManager> mInvalidateListener; @Mock private HeadsUpManager mHeadsUpManager; - @Mock private ShadeStateEvents mShadeStateEvents; @Mock private VisibilityLocationProvider mVisibilityLocationProvider; @Mock private VisualStabilityProvider mVisualStabilityProvider; - @Mock private ShadeAnimationInteractor mShadeAnimationInteractor; @Captor private ArgumentCaptor<WakefulnessLifecycle.Observer> mWakefulnessObserverCaptor; @Captor private ArgumentCaptor<StatusBarStateController.StateListener> mSBStateListenerCaptor; - @Captor private ArgumentCaptor<ShadeStateEventsListener> mNotifPanelEventsCallbackCaptor; @Captor private ArgumentCaptor<NotifStabilityManager> mNotifStabilityManagerCaptor; private FakeSystemClock mFakeSystemClock = new FakeSystemClock(); private FakeExecutor mFakeExecutor = new FakeExecutor(mFakeSystemClock); private final TestScope mTestScope = TestScopeProvider.getTestScope(); private final JavaAdapter mJavaAdapter = new JavaAdapter(mTestScope.getBackgroundScope()); - private final MutableStateFlow<Boolean> mShadeClosing = StateFlowKt.MutableStateFlow(false); + private ShadeAnimationInteractor mShadeAnimationInteractor; + private ShadeRepository mShadeRepository; private WakefulnessLifecycle.Observer mWakefulnessObserver; private StatusBarStateController.StateListener mStatusBarStateListener; - private ShadeStateEvents.ShadeStateEventsListener mNotifPanelEventsCallback; private NotifStabilityManager mNotifStabilityManager; private NotificationEntry mEntry; private GroupEntry mGroupEntry; @@ -109,18 +106,19 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase { public void setUp() { MockitoAnnotations.initMocks(this); + mShadeRepository = new FakeShadeRepository(); + mShadeAnimationInteractor = new ShadeAnimationInteractorLegacyImpl( + new ShadeAnimationRepository(), mShadeRepository); mCoordinator = new VisualStabilityCoordinator( mFakeExecutor, mDumpManager, mHeadsUpManager, - mShadeStateEvents, mShadeAnimationInteractor, mJavaAdapter, mStatusBarStateController, mVisibilityLocationProvider, mVisualStabilityProvider, mWakefulnessLifecycle); - when(mShadeAnimationInteractor.isAnyCloseAnimationRunning()).thenReturn(mShadeClosing); mCoordinator.attach(mNotifPipeline); // capture arguments: @@ -130,10 +128,6 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase { verify(mStatusBarStateController).addCallback(mSBStateListenerCaptor.capture()); mStatusBarStateListener = mSBStateListenerCaptor.getValue(); - verify(mShadeStateEvents).addShadeStateEventsListener( - mNotifPanelEventsCallbackCaptor.capture()); - mNotifPanelEventsCallback = mNotifPanelEventsCallbackCaptor.getValue(); - verify(mNotifPipeline).setVisualStabilityManager(mNotifStabilityManagerCaptor.capture()); mNotifStabilityManager = mNotifStabilityManagerCaptor.getValue(); mNotifStabilityManager.setInvalidationListener(mInvalidateListener); @@ -558,11 +552,12 @@ public class VisualStabilityCoordinatorTest extends SysuiTestCase { } private void setActivityLaunching(boolean activityLaunching) { - mNotifPanelEventsCallback.onLaunchingActivityChanged(activityLaunching); + mShadeAnimationInteractor.setIsLaunchingActivity(activityLaunching); + mTestScope.getTestScheduler().runCurrent(); } private void setPanelCollapsing(boolean collapsing) { - mShadeClosing.setValue(collapsing); + mShadeRepository.setLegacyIsClosing(collapsing); mTestScope.getTestScheduler().runCurrent(); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ActivityStarterImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ActivityStarterImplTest.kt index 7de05add2884..00a86ffc5a8f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ActivityStarterImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ActivityStarterImplTest.kt @@ -34,6 +34,9 @@ import com.android.systemui.plugins.ActivityStarter.OnDismissAction import com.android.systemui.settings.UserTracker import com.android.systemui.shade.ShadeController import com.android.systemui.shade.ShadeViewController +import com.android.systemui.shade.data.repository.FakeShadeRepository +import com.android.systemui.shade.data.repository.ShadeAnimationRepository +import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractorLegacyImpl import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.NotificationShadeWindowController import com.android.systemui.statusbar.SysuiStatusBarStateController @@ -86,6 +89,8 @@ class ActivityStarterImplTest : SysuiTestCase() { @Mock private lateinit var activityIntentHelper: ActivityIntentHelper private lateinit var underTest: ActivityStarterImpl private val mainExecutor = FakeExecutor(FakeSystemClock()) + private val shadeAnimationInteractor = + ShadeAnimationInteractorLegacyImpl(ShadeAnimationRepository(), FakeShadeRepository()) @Before fun setUp() { @@ -99,6 +104,7 @@ class ActivityStarterImplTest : SysuiTestCase() { Lazy { keyguardViewMediator }, Lazy { shadeController }, Lazy { shadeViewController }, + shadeAnimationInteractor, Lazy { statusBarKeyguardViewManager }, Lazy { notifShadeWindowController }, activityLaunchAnimator, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java index 6cc4e44116ec..592c78fe2b81 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterTest.java @@ -76,6 +76,9 @@ import com.android.systemui.power.domain.interactor.PowerInteractorFactory; import com.android.systemui.settings.UserTracker; import com.android.systemui.shade.ShadeControllerImpl; import com.android.systemui.shade.ShadeViewController; +import com.android.systemui.shade.data.repository.FakeShadeRepository; +import com.android.systemui.shade.data.repository.ShadeAnimationRepository; +import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractorLegacyImpl; import com.android.systemui.statusbar.NotificationClickNotifier; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationPresenter; @@ -253,10 +256,11 @@ public class StatusBarNotificationActivityStarterTest extends SysuiTestCase { mock(ShadeViewController.class), mock(NotificationShadeWindowController.class), mActivityLaunchAnimator, + new ShadeAnimationInteractorLegacyImpl( + new ShadeAnimationRepository(), new FakeShadeRepository()), notificationAnimationProvider, mock(LaunchFullScreenIntentProvider.class), mPowerInteractor, - mFeatureFlags, mUserTracker ); |