Loading packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +5 −1 Original line number Diff line number Diff line Loading @@ -165,6 +165,7 @@ import com.android.systemui.util.time.FakeSystemClock; import com.android.systemui.util.time.SystemClock; import com.android.systemui.utils.windowmanager.WindowManagerProvider; import com.android.systemui.wallpapers.ui.viewmodel.WallpaperFocalAreaViewModel; import com.android.systemui.window.domain.interactor.WindowRootViewBlurInteractor; import com.android.wm.shell.animation.FlingAnimationUtils; import dagger.Lazy; Loading Loading @@ -302,6 +303,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { protected View.OnLayoutChangeListener mLayoutChangeListener; protected ShadeRepository mShadeRepository; protected FakeMSDLPlayer mMSDLPlayer = mKosmos.getMsdlPlayer(); protected WindowRootViewBlurInteractor mWindowRootViewBlurInteractor = mKosmos.getWindowRootViewBlurInteractor(); protected BrightnessMirrorShowingRepository mBrightnessMirrorShowingRepository = mKosmos.getBrightnessMirrorShowingRepository(); Loading Loading @@ -580,7 +583,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mMSDLPlayer, mBrightnessMirrorShowingRepository, new BlurConfig(0f, 0f), () -> mKosmos.getFakeShadeDisplaysRepository()); () -> mKosmos.getFakeShadeDisplaysRepository(), mWindowRootViewBlurInteractor); mNotificationPanelViewController.initDependencies( mCentralSurfaces, null, Loading packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +14 −1 Original line number Diff line number Diff line Loading @@ -199,6 +199,7 @@ import com.android.systemui.unfold.SysUIUnfoldComponent; import com.android.systemui.util.Utils; import com.android.systemui.util.time.SystemClock; import com.android.systemui.wallpapers.ui.viewmodel.WallpaperFocalAreaViewModel; import com.android.systemui.window.domain.interactor.WindowRootViewBlurInteractor; import com.android.wm.shell.animation.FlingAnimationUtils; import dalvik.annotation.optimization.NeverCompile; Loading Loading @@ -329,6 +330,7 @@ public final class NotificationPanelViewController implements private final QuickSettingsControllerImpl mQsController; private final TouchHandler mTouchHandler = new TouchHandler(); private final BlurConfig mBlurConfig; private final WindowRootViewBlurInteractor mWindowRootViewBlurInteractor; private long mDownTime; private long mStatusBarLongPressDowntime = -1L; Loading Loading @@ -648,8 +650,10 @@ public final class NotificationPanelViewController implements MSDLPlayer msdlPlayer, BrightnessMirrorShowingRepository brightnessMirrorShowingRepository, BlurConfig blurConfig, Lazy<ShadeDisplaysRepository> shadeDisplaysRepository) { Lazy<ShadeDisplaysRepository> shadeDisplaysRepository, WindowRootViewBlurInteractor windowRootViewBlurInteractor) { mBlurConfig = blurConfig; mWindowRootViewBlurInteractor = windowRootViewBlurInteractor; SceneContainerFlag.assertInLegacyMode(); keyguardStateController.addCallback(new KeyguardStateController.Callback() { @Override Loading Loading @@ -1953,6 +1957,9 @@ public final class NotificationPanelViewController implements } private void onExpandingFinished() { if (Flags.bouncerUiRevamp()) { mWindowRootViewBlurInteractor.setTrackingShadeMotion(false); } if (!SceneContainerFlag.isEnabled()) { mNotificationStackScrollLayoutController.onExpansionStopped(); } Loading Loading @@ -2236,6 +2243,9 @@ public final class NotificationPanelViewController implements } private void onClosingFinished() { if (Flags.bouncerUiRevamp()) { mWindowRootViewBlurInteractor.setTrackingShadeMotion(false); } if (mOpenCloseListener != null) { mOpenCloseListener.onClosingFinished(); } Loading Loading @@ -2874,6 +2884,9 @@ public final class NotificationPanelViewController implements /** Called when a MotionEvent is about to trigger Shade expansion. */ private void startExpandMotion(float newX, float newY, boolean startTracking, float expandedHeight) { if (Flags.bouncerUiRevamp()) { mWindowRootViewBlurInteractor.setTrackingShadeMotion(true); } if (!mHandlingPointerUp && !mStatusBarStateController.isDozing()) { mQsController.beginJankMonitoring(isFullyCollapsed()); } Loading packages/SystemUI/src/com/android/systemui/window/data/repository/NoopWindowRootViewBlurRepository.kt +1 −0 Original line number Diff line number Diff line Loading @@ -25,4 +25,5 @@ class NoopWindowRootViewBlurRepository @Inject constructor() : WindowRootViewBlu override val scaleRequestedByShade: MutableStateFlow<Float> = MutableStateFlow(1.0f) override val isBlurSupported: StateFlow<Boolean> = MutableStateFlow(false) override var blurAppliedListener: BlurAppliedListener? = null override val trackingShadeMotion: MutableStateFlow<Boolean> = MutableStateFlow(false) } packages/SystemUI/src/com/android/systemui/window/data/repository/WindowRootViewBlurRepository.kt +9 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.window.data.repository import android.app.ActivityManager import android.os.SystemProperties import android.util.Log import android.view.CrossWindowBlurListeners import com.android.systemui.common.coroutine.ChannelExt.trySendWithFailureLogging import com.android.systemui.dagger.SysUISingleton Loading @@ -33,6 +34,7 @@ import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.stateIn typealias BlurAppliedListener = Consumer<Int> Loading @@ -48,6 +50,9 @@ interface WindowRootViewBlurRepository { var blurAppliedListener: BlurAppliedListener? /** true when tracking shade motion that might lead to a shade expansion. */ val trackingShadeMotion: MutableStateFlow<Boolean> companion object { /** * Whether the `persist.sysui.disableBlur` is set, this is used to disable blur for tests. Loading @@ -68,6 +73,9 @@ constructor( @Main private val executor: Executor, @Application private val scope: CoroutineScope, ) : WindowRootViewBlurRepository { override val trackingShadeMotion = MutableStateFlow(false) override val blurRequestedByShade = MutableStateFlow(0) override val scaleRequestedByShade = MutableStateFlow(1.0f) Loading @@ -86,6 +94,7 @@ constructor( awaitClose { crossWindowBlurListeners.removeListener(sendUpdate) } } // stateIn because this is backed by a binder call. .onEach { Log.d(TAG, "isBlurSupported changed to $it") } .stateIn(scope, SharingStarted.WhileSubscribed(), false) override var blurAppliedListener: BlurAppliedListener? = null Loading packages/SystemUI/src/com/android/systemui/window/domain/interactor/WindowRootViewBlurInteractor.kt +15 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,13 @@ constructor( /** Scale factor to apply to content underneath blurs on the window root view. */ val blurScaleRequestedByShade: StateFlow<Float> = repository.scaleRequestedByShade.asStateFlow() /** * true when tracking shade motion that might lead to a shade expansion. * * This signal need not be implemented by all shade variants. */ val isTrackingShadeMotion: StateFlow<Boolean> = repository.trackingShadeMotion.asStateFlow() /** * Requests blur to be applied on the window root view. It is applied only when other blurs are * not applied. Loading @@ -119,6 +126,14 @@ constructor( return true } /** * Set to true when shade motion is being tracked. This signal is used to make sure * surface-flinger is ready for expensive blur during shade expansion. */ fun setTrackingShadeMotion(tracking: Boolean) { repository.trackingShadeMotion.value = tracking } companion object { const val TAG = "WindowRootViewBlurInteractor" } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +5 −1 Original line number Diff line number Diff line Loading @@ -165,6 +165,7 @@ import com.android.systemui.util.time.FakeSystemClock; import com.android.systemui.util.time.SystemClock; import com.android.systemui.utils.windowmanager.WindowManagerProvider; import com.android.systemui.wallpapers.ui.viewmodel.WallpaperFocalAreaViewModel; import com.android.systemui.window.domain.interactor.WindowRootViewBlurInteractor; import com.android.wm.shell.animation.FlingAnimationUtils; import dagger.Lazy; Loading Loading @@ -302,6 +303,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { protected View.OnLayoutChangeListener mLayoutChangeListener; protected ShadeRepository mShadeRepository; protected FakeMSDLPlayer mMSDLPlayer = mKosmos.getMsdlPlayer(); protected WindowRootViewBlurInteractor mWindowRootViewBlurInteractor = mKosmos.getWindowRootViewBlurInteractor(); protected BrightnessMirrorShowingRepository mBrightnessMirrorShowingRepository = mKosmos.getBrightnessMirrorShowingRepository(); Loading Loading @@ -580,7 +583,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mMSDLPlayer, mBrightnessMirrorShowingRepository, new BlurConfig(0f, 0f), () -> mKosmos.getFakeShadeDisplaysRepository()); () -> mKosmos.getFakeShadeDisplaysRepository(), mWindowRootViewBlurInteractor); mNotificationPanelViewController.initDependencies( mCentralSurfaces, null, Loading
packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +14 −1 Original line number Diff line number Diff line Loading @@ -199,6 +199,7 @@ import com.android.systemui.unfold.SysUIUnfoldComponent; import com.android.systemui.util.Utils; import com.android.systemui.util.time.SystemClock; import com.android.systemui.wallpapers.ui.viewmodel.WallpaperFocalAreaViewModel; import com.android.systemui.window.domain.interactor.WindowRootViewBlurInteractor; import com.android.wm.shell.animation.FlingAnimationUtils; import dalvik.annotation.optimization.NeverCompile; Loading Loading @@ -329,6 +330,7 @@ public final class NotificationPanelViewController implements private final QuickSettingsControllerImpl mQsController; private final TouchHandler mTouchHandler = new TouchHandler(); private final BlurConfig mBlurConfig; private final WindowRootViewBlurInteractor mWindowRootViewBlurInteractor; private long mDownTime; private long mStatusBarLongPressDowntime = -1L; Loading Loading @@ -648,8 +650,10 @@ public final class NotificationPanelViewController implements MSDLPlayer msdlPlayer, BrightnessMirrorShowingRepository brightnessMirrorShowingRepository, BlurConfig blurConfig, Lazy<ShadeDisplaysRepository> shadeDisplaysRepository) { Lazy<ShadeDisplaysRepository> shadeDisplaysRepository, WindowRootViewBlurInteractor windowRootViewBlurInteractor) { mBlurConfig = blurConfig; mWindowRootViewBlurInteractor = windowRootViewBlurInteractor; SceneContainerFlag.assertInLegacyMode(); keyguardStateController.addCallback(new KeyguardStateController.Callback() { @Override Loading Loading @@ -1953,6 +1957,9 @@ public final class NotificationPanelViewController implements } private void onExpandingFinished() { if (Flags.bouncerUiRevamp()) { mWindowRootViewBlurInteractor.setTrackingShadeMotion(false); } if (!SceneContainerFlag.isEnabled()) { mNotificationStackScrollLayoutController.onExpansionStopped(); } Loading Loading @@ -2236,6 +2243,9 @@ public final class NotificationPanelViewController implements } private void onClosingFinished() { if (Flags.bouncerUiRevamp()) { mWindowRootViewBlurInteractor.setTrackingShadeMotion(false); } if (mOpenCloseListener != null) { mOpenCloseListener.onClosingFinished(); } Loading Loading @@ -2874,6 +2884,9 @@ public final class NotificationPanelViewController implements /** Called when a MotionEvent is about to trigger Shade expansion. */ private void startExpandMotion(float newX, float newY, boolean startTracking, float expandedHeight) { if (Flags.bouncerUiRevamp()) { mWindowRootViewBlurInteractor.setTrackingShadeMotion(true); } if (!mHandlingPointerUp && !mStatusBarStateController.isDozing()) { mQsController.beginJankMonitoring(isFullyCollapsed()); } Loading
packages/SystemUI/src/com/android/systemui/window/data/repository/NoopWindowRootViewBlurRepository.kt +1 −0 Original line number Diff line number Diff line Loading @@ -25,4 +25,5 @@ class NoopWindowRootViewBlurRepository @Inject constructor() : WindowRootViewBlu override val scaleRequestedByShade: MutableStateFlow<Float> = MutableStateFlow(1.0f) override val isBlurSupported: StateFlow<Boolean> = MutableStateFlow(false) override var blurAppliedListener: BlurAppliedListener? = null override val trackingShadeMotion: MutableStateFlow<Boolean> = MutableStateFlow(false) }
packages/SystemUI/src/com/android/systemui/window/data/repository/WindowRootViewBlurRepository.kt +9 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.window.data.repository import android.app.ActivityManager import android.os.SystemProperties import android.util.Log import android.view.CrossWindowBlurListeners import com.android.systemui.common.coroutine.ChannelExt.trySendWithFailureLogging import com.android.systemui.dagger.SysUISingleton Loading @@ -33,6 +34,7 @@ import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.stateIn typealias BlurAppliedListener = Consumer<Int> Loading @@ -48,6 +50,9 @@ interface WindowRootViewBlurRepository { var blurAppliedListener: BlurAppliedListener? /** true when tracking shade motion that might lead to a shade expansion. */ val trackingShadeMotion: MutableStateFlow<Boolean> companion object { /** * Whether the `persist.sysui.disableBlur` is set, this is used to disable blur for tests. Loading @@ -68,6 +73,9 @@ constructor( @Main private val executor: Executor, @Application private val scope: CoroutineScope, ) : WindowRootViewBlurRepository { override val trackingShadeMotion = MutableStateFlow(false) override val blurRequestedByShade = MutableStateFlow(0) override val scaleRequestedByShade = MutableStateFlow(1.0f) Loading @@ -86,6 +94,7 @@ constructor( awaitClose { crossWindowBlurListeners.removeListener(sendUpdate) } } // stateIn because this is backed by a binder call. .onEach { Log.d(TAG, "isBlurSupported changed to $it") } .stateIn(scope, SharingStarted.WhileSubscribed(), false) override var blurAppliedListener: BlurAppliedListener? = null Loading
packages/SystemUI/src/com/android/systemui/window/domain/interactor/WindowRootViewBlurInteractor.kt +15 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,13 @@ constructor( /** Scale factor to apply to content underneath blurs on the window root view. */ val blurScaleRequestedByShade: StateFlow<Float> = repository.scaleRequestedByShade.asStateFlow() /** * true when tracking shade motion that might lead to a shade expansion. * * This signal need not be implemented by all shade variants. */ val isTrackingShadeMotion: StateFlow<Boolean> = repository.trackingShadeMotion.asStateFlow() /** * Requests blur to be applied on the window root view. It is applied only when other blurs are * not applied. Loading @@ -119,6 +126,14 @@ constructor( return true } /** * Set to true when shade motion is being tracked. This signal is used to make sure * surface-flinger is ready for expensive blur during shade expansion. */ fun setTrackingShadeMotion(tracking: Boolean) { repository.trackingShadeMotion.value = tracking } companion object { const val TAG = "WindowRootViewBlurInteractor" } Loading