Loading packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java +7 −1 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import com.android.systemui.statusbar.NotificationInsetsController; import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.notification.data.repository.NotificationExpansionRepository; import com.android.systemui.statusbar.notification.stack.AmbientState; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; Loading Loading @@ -157,6 +158,7 @@ public class NotificationShadeWindowViewController { KeyguardMessageAreaController.Factory messageAreaControllerFactory, KeyguardTransitionInteractor keyguardTransitionInteractor, PrimaryBouncerToGoneTransitionViewModel primaryBouncerToGoneTransitionViewModel, NotificationExpansionRepository notificationExpansionRepository, FeatureFlags featureFlags, SystemClock clock, BouncerMessageInteractor bouncerMessageInteractor, Loading Loading @@ -201,6 +203,10 @@ public class NotificationShadeWindowViewController { collectFlow(mView, keyguardTransitionInteractor.getLockscreenToDreamingTransition(), mLockscreenToDreamingTransition); collectFlow( mView, notificationExpansionRepository.isExpandAnimationRunning(), this::setExpandAnimationRunning); mClock = clock; if (featureFlags.isEnabled(Flags.SPLIT_SHADE_SUBPIXEL_OPTIMIZATION)) { Loading Loading @@ -518,7 +524,7 @@ public class NotificationShadeWindowViewController { pw.println(mTouchActive); } public void setExpandAnimationRunning(boolean running) { private void setExpandAnimationRunning(boolean running) { if (mExpandAnimationRunning != running) { mExpandAnimationRunning = running; mNotificationShadeWindowController.setLaunchingActivity(mExpandAnimationRunning); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorController.kt +23 −7 Original line number Diff line number Diff line /* * Copyright (C) 2021 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.statusbar.notification import android.view.ViewGroup import com.android.internal.jank.InteractionJankMonitor import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.animation.LaunchAnimator import com.android.systemui.shade.NotificationShadeWindowViewController import com.android.systemui.statusbar.notification.data.repository.NotificationExpansionRepository import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.stack.NotificationListContainer import com.android.systemui.statusbar.phone.HeadsUpManagerPhone Loading @@ -17,7 +33,7 @@ import kotlin.math.max /** A provider of [NotificationLaunchAnimatorController]. */ @CentralSurfacesComponent.CentralSurfacesScope class NotificationLaunchAnimatorControllerProvider @Inject constructor( private val notificationShadeWindowViewController: NotificationShadeWindowViewController, private val notificationExpansionRepository: NotificationExpansionRepository, private val notificationListContainer: NotificationListContainer, private val headsUpManager: HeadsUpManagerPhone, private val jankMonitor: InteractionJankMonitor Loading @@ -28,7 +44,7 @@ class NotificationLaunchAnimatorControllerProvider @Inject constructor( onFinishAnimationCallback: Runnable? = null ): NotificationLaunchAnimatorController { return NotificationLaunchAnimatorController( notificationShadeWindowViewController, notificationExpansionRepository, notificationListContainer, headsUpManager, notification, Loading @@ -44,7 +60,7 @@ class NotificationLaunchAnimatorControllerProvider @Inject constructor( * notification expanding into an opening window. */ class NotificationLaunchAnimatorController( private val notificationShadeWindowViewController: NotificationShadeWindowViewController, private val notificationExpansionRepository: NotificationExpansionRepository, private val notificationListContainer: NotificationListContainer, private val headsUpManager: HeadsUpManagerPhone, private val notification: ExpandableNotificationRow, Loading Loading @@ -119,7 +135,7 @@ class NotificationLaunchAnimatorController( } override fun onIntentStarted(willAnimate: Boolean) { notificationShadeWindowViewController.setExpandAnimationRunning(willAnimate) notificationExpansionRepository.setIsExpandAnimationRunning(willAnimate) notificationEntry.isExpandAnimationRunning = willAnimate if (!willAnimate) { Loading @@ -140,7 +156,7 @@ class NotificationLaunchAnimatorController( override fun onLaunchAnimationCancelled(newKeyguardOccludedState: Boolean?) { // TODO(b/184121838): Should we call InteractionJankMonitor.cancel if the animation started // here? notificationShadeWindowViewController.setExpandAnimationRunning(false) notificationExpansionRepository.setIsExpandAnimationRunning(false) notificationEntry.isExpandAnimationRunning = false removeHun(animate = true) onFinishAnimationCallback?.run() Loading @@ -158,7 +174,7 @@ class NotificationLaunchAnimatorController( jankMonitor.end(InteractionJankMonitor.CUJ_NOTIFICATION_APP_START) notification.isExpandAnimationRunning = false notificationShadeWindowViewController.setExpandAnimationRunning(false) notificationExpansionRepository.setIsExpandAnimationRunning(false) notificationEntry.isExpandAnimationRunning = false notificationListContainer.setExpandingNotification(null) applyParams(null) Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/data/repository/NotificationExpansionRepository.kt 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * 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. * 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.statusbar.notification.data.repository import com.android.systemui.dagger.SysUISingleton import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow /** A repository tracking the status of notification expansion animations. */ @SysUISingleton class NotificationExpansionRepository @Inject constructor() { private val _isExpandAnimationRunning = MutableStateFlow(false) /** * Emits true if an animation that expands a notification object into an opening window is * running and false otherwise. * * See [com.android.systemui.statusbar.notification.NotificationLaunchAnimatorController]. */ val isExpandAnimationRunning: Flow<Boolean> = _isExpandAnimationRunning.asStateFlow() /** Sets whether the notification expansion animation is currently running. */ fun setIsExpandAnimationRunning(running: Boolean) { _isExpandAnimationRunning.value = running } } packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +5 −1 Original line number Diff line number Diff line Loading @@ -220,6 +220,7 @@ import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.NotificationActivityStarter; import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorControllerProvider; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.data.repository.NotificationExpansionRepository; import com.android.systemui.statusbar.notification.init.NotificationsController; import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProvider; import com.android.systemui.statusbar.notification.logging.NotificationLogger; Loading Loading @@ -312,6 +313,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { private CentralSurfacesCommandQueueCallbacks mCommandQueueCallbacks; private float mTransitionToFullShadeProgress = 0f; private final NotificationListContainer mNotifListContainer; private final NotificationExpansionRepository mNotificationExpansionRepository; private boolean mIsShortcutListSearchEnabled; private final KeyguardStateController.Callback mKeyguardStateControllerCallback = Loading Loading @@ -725,6 +727,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { NotificationShelfController notificationShelfController, NotificationStackScrollLayoutController notificationStackScrollLayoutController, NotificationPresenter notificationPresenter, NotificationExpansionRepository notificationExpansionRepository, DozeParameters dozeParameters, ScrimController scrimController, Lazy<LockscreenWallpaper> lockscreenWallpaperLazy, Loading Loading @@ -832,6 +835,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mStackScroller = mStackScrollerController.getView(); mNotifListContainer = mStackScrollerController.getNotificationListContainer(); mPresenter = notificationPresenter; mNotificationExpansionRepository = notificationExpansionRepository; mDozeServiceHost = dozeServiceHost; mPowerManager = powerManager; mDozeParameters = dozeParameters; Loading Loading @@ -1546,7 +1550,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mActivityLaunchAnimator.setCallback(mActivityLaunchAnimatorCallback); mActivityLaunchAnimator.addListener(mActivityLaunchAnimatorListener); mNotificationAnimationProvider = new NotificationLaunchAnimatorControllerProvider( getNotificationShadeWindowViewController(), mNotificationExpansionRepository, mNotifListContainer, mHeadsUpManager, mJankMonitor); Loading packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt +3 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import com.android.systemui.statusbar.NotificationInsetsController import com.android.systemui.statusbar.NotificationShadeDepthController import com.android.systemui.statusbar.NotificationShadeWindowController import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.notification.data.repository.NotificationExpansionRepository import com.android.systemui.statusbar.notification.stack.AmbientState import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController import com.android.systemui.statusbar.phone.CentralSurfaces Loading Loading @@ -117,6 +118,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() { @Mock lateinit var keyguardTransitionInteractor: KeyguardTransitionInteractor @Mock lateinit var primaryBouncerToGoneTransitionViewModel: PrimaryBouncerToGoneTransitionViewModel private val notificationExpansionRepository = NotificationExpansionRepository() private lateinit var interactionEventHandlerCaptor: ArgumentCaptor<InteractionEventHandler> private lateinit var interactionEventHandler: InteractionEventHandler Loading Loading @@ -175,6 +177,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() { mock(KeyguardMessageAreaController.Factory::class.java), keyguardTransitionInteractor, primaryBouncerToGoneTransitionViewModel, notificationExpansionRepository, featureFlags, FakeSystemClock(), BouncerMessageInteractor( Loading Loading
packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java +7 −1 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import com.android.systemui.statusbar.NotificationInsetsController; import com.android.systemui.statusbar.NotificationShadeDepthController; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.notification.data.repository.NotificationExpansionRepository; import com.android.systemui.statusbar.notification.stack.AmbientState; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; Loading Loading @@ -157,6 +158,7 @@ public class NotificationShadeWindowViewController { KeyguardMessageAreaController.Factory messageAreaControllerFactory, KeyguardTransitionInteractor keyguardTransitionInteractor, PrimaryBouncerToGoneTransitionViewModel primaryBouncerToGoneTransitionViewModel, NotificationExpansionRepository notificationExpansionRepository, FeatureFlags featureFlags, SystemClock clock, BouncerMessageInteractor bouncerMessageInteractor, Loading Loading @@ -201,6 +203,10 @@ public class NotificationShadeWindowViewController { collectFlow(mView, keyguardTransitionInteractor.getLockscreenToDreamingTransition(), mLockscreenToDreamingTransition); collectFlow( mView, notificationExpansionRepository.isExpandAnimationRunning(), this::setExpandAnimationRunning); mClock = clock; if (featureFlags.isEnabled(Flags.SPLIT_SHADE_SUBPIXEL_OPTIMIZATION)) { Loading Loading @@ -518,7 +524,7 @@ public class NotificationShadeWindowViewController { pw.println(mTouchActive); } public void setExpandAnimationRunning(boolean running) { private void setExpandAnimationRunning(boolean running) { if (mExpandAnimationRunning != running) { mExpandAnimationRunning = running; mNotificationShadeWindowController.setLaunchingActivity(mExpandAnimationRunning); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationLaunchAnimatorController.kt +23 −7 Original line number Diff line number Diff line /* * Copyright (C) 2021 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.statusbar.notification import android.view.ViewGroup import com.android.internal.jank.InteractionJankMonitor import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.animation.LaunchAnimator import com.android.systemui.shade.NotificationShadeWindowViewController import com.android.systemui.statusbar.notification.data.repository.NotificationExpansionRepository import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.stack.NotificationListContainer import com.android.systemui.statusbar.phone.HeadsUpManagerPhone Loading @@ -17,7 +33,7 @@ import kotlin.math.max /** A provider of [NotificationLaunchAnimatorController]. */ @CentralSurfacesComponent.CentralSurfacesScope class NotificationLaunchAnimatorControllerProvider @Inject constructor( private val notificationShadeWindowViewController: NotificationShadeWindowViewController, private val notificationExpansionRepository: NotificationExpansionRepository, private val notificationListContainer: NotificationListContainer, private val headsUpManager: HeadsUpManagerPhone, private val jankMonitor: InteractionJankMonitor Loading @@ -28,7 +44,7 @@ class NotificationLaunchAnimatorControllerProvider @Inject constructor( onFinishAnimationCallback: Runnable? = null ): NotificationLaunchAnimatorController { return NotificationLaunchAnimatorController( notificationShadeWindowViewController, notificationExpansionRepository, notificationListContainer, headsUpManager, notification, Loading @@ -44,7 +60,7 @@ class NotificationLaunchAnimatorControllerProvider @Inject constructor( * notification expanding into an opening window. */ class NotificationLaunchAnimatorController( private val notificationShadeWindowViewController: NotificationShadeWindowViewController, private val notificationExpansionRepository: NotificationExpansionRepository, private val notificationListContainer: NotificationListContainer, private val headsUpManager: HeadsUpManagerPhone, private val notification: ExpandableNotificationRow, Loading Loading @@ -119,7 +135,7 @@ class NotificationLaunchAnimatorController( } override fun onIntentStarted(willAnimate: Boolean) { notificationShadeWindowViewController.setExpandAnimationRunning(willAnimate) notificationExpansionRepository.setIsExpandAnimationRunning(willAnimate) notificationEntry.isExpandAnimationRunning = willAnimate if (!willAnimate) { Loading @@ -140,7 +156,7 @@ class NotificationLaunchAnimatorController( override fun onLaunchAnimationCancelled(newKeyguardOccludedState: Boolean?) { // TODO(b/184121838): Should we call InteractionJankMonitor.cancel if the animation started // here? notificationShadeWindowViewController.setExpandAnimationRunning(false) notificationExpansionRepository.setIsExpandAnimationRunning(false) notificationEntry.isExpandAnimationRunning = false removeHun(animate = true) onFinishAnimationCallback?.run() Loading @@ -158,7 +174,7 @@ class NotificationLaunchAnimatorController( jankMonitor.end(InteractionJankMonitor.CUJ_NOTIFICATION_APP_START) notification.isExpandAnimationRunning = false notificationShadeWindowViewController.setExpandAnimationRunning(false) notificationExpansionRepository.setIsExpandAnimationRunning(false) notificationEntry.isExpandAnimationRunning = false notificationListContainer.setExpandingNotification(null) applyParams(null) Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/data/repository/NotificationExpansionRepository.kt 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * 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. * 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.statusbar.notification.data.repository import com.android.systemui.dagger.SysUISingleton import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow /** A repository tracking the status of notification expansion animations. */ @SysUISingleton class NotificationExpansionRepository @Inject constructor() { private val _isExpandAnimationRunning = MutableStateFlow(false) /** * Emits true if an animation that expands a notification object into an opening window is * running and false otherwise. * * See [com.android.systemui.statusbar.notification.NotificationLaunchAnimatorController]. */ val isExpandAnimationRunning: Flow<Boolean> = _isExpandAnimationRunning.asStateFlow() /** Sets whether the notification expansion animation is currently running. */ fun setIsExpandAnimationRunning(running: Boolean) { _isExpandAnimationRunning.value = running } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +5 −1 Original line number Diff line number Diff line Loading @@ -220,6 +220,7 @@ import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.NotificationActivityStarter; import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorControllerProvider; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.data.repository.NotificationExpansionRepository; import com.android.systemui.statusbar.notification.init.NotificationsController; import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProvider; import com.android.systemui.statusbar.notification.logging.NotificationLogger; Loading Loading @@ -312,6 +313,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { private CentralSurfacesCommandQueueCallbacks mCommandQueueCallbacks; private float mTransitionToFullShadeProgress = 0f; private final NotificationListContainer mNotifListContainer; private final NotificationExpansionRepository mNotificationExpansionRepository; private boolean mIsShortcutListSearchEnabled; private final KeyguardStateController.Callback mKeyguardStateControllerCallback = Loading Loading @@ -725,6 +727,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { NotificationShelfController notificationShelfController, NotificationStackScrollLayoutController notificationStackScrollLayoutController, NotificationPresenter notificationPresenter, NotificationExpansionRepository notificationExpansionRepository, DozeParameters dozeParameters, ScrimController scrimController, Lazy<LockscreenWallpaper> lockscreenWallpaperLazy, Loading Loading @@ -832,6 +835,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mStackScroller = mStackScrollerController.getView(); mNotifListContainer = mStackScrollerController.getNotificationListContainer(); mPresenter = notificationPresenter; mNotificationExpansionRepository = notificationExpansionRepository; mDozeServiceHost = dozeServiceHost; mPowerManager = powerManager; mDozeParameters = dozeParameters; Loading Loading @@ -1546,7 +1550,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mActivityLaunchAnimator.setCallback(mActivityLaunchAnimatorCallback); mActivityLaunchAnimator.addListener(mActivityLaunchAnimatorListener); mNotificationAnimationProvider = new NotificationLaunchAnimatorControllerProvider( getNotificationShadeWindowViewController(), mNotificationExpansionRepository, mNotifListContainer, mHeadsUpManager, mJankMonitor); Loading
packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt +3 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import com.android.systemui.statusbar.NotificationInsetsController import com.android.systemui.statusbar.NotificationShadeDepthController import com.android.systemui.statusbar.NotificationShadeWindowController import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.notification.data.repository.NotificationExpansionRepository import com.android.systemui.statusbar.notification.stack.AmbientState import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController import com.android.systemui.statusbar.phone.CentralSurfaces Loading Loading @@ -117,6 +118,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() { @Mock lateinit var keyguardTransitionInteractor: KeyguardTransitionInteractor @Mock lateinit var primaryBouncerToGoneTransitionViewModel: PrimaryBouncerToGoneTransitionViewModel private val notificationExpansionRepository = NotificationExpansionRepository() private lateinit var interactionEventHandlerCaptor: ArgumentCaptor<InteractionEventHandler> private lateinit var interactionEventHandler: InteractionEventHandler Loading Loading @@ -175,6 +177,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() { mock(KeyguardMessageAreaController.Factory::class.java), keyguardTransitionInteractor, primaryBouncerToGoneTransitionViewModel, notificationExpansionRepository, featureFlags, FakeSystemClock(), BouncerMessageInteractor( Loading