Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1b5a24b authored by Chandru S's avatar Chandru S
Browse files

Use shade motion events from NotificationPanelViewController as an early...

Use shade motion events from NotificationPanelViewController as an early signal for shade expansion.

Improves the early signal timing in the following CUJs:
 1. Swipe down from top of screen (from status bar)
 2. Long press status bar (previous signal was not getting triggered for this)

CUJs that still have the same timing:
 1. Swipe down while on launcher from the center of the screen
 2. Swipe down from a HUN

Note: all of these are non-lockscreen CUJs. early wakeup flag is always true while on the lockscreen.

See bug comment for trace screenshots: b/408379996#comment26

Bug: 392209635
Bug: 408379996
Bug: 415563164
Bug: 416225534
Flag: com.android.systemui.bouncer_ui_revamp
Test: verified above scenarios.
Change-Id: Idd7e1f4077991b32c3d254f0a960bc36c11195f8
parent e9d11d05
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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;
@@ -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();
@@ -579,7 +582,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase {
                mMSDLPlayer,
                mBrightnessMirrorShowingRepository,
                new BlurConfig(0f, 0f),
                () -> mKosmos.getFakeShadeDisplaysRepository());
                () -> mKosmos.getFakeShadeDisplaysRepository(),
                mWindowRootViewBlurInteractor);
        mNotificationPanelViewController.initDependencies(
                mCentralSurfaces,
                null,
+15 −1
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.dagger.KeyguardStatusBarViewComponent;
import com.android.systemui.DejankUtils;
import com.android.systemui.Dumpable;
import com.android.systemui.Flags;
import com.android.systemui.Gefingerpoken;
import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor;
import com.android.systemui.classifier.Classifier;
@@ -199,6 +200,7 @@ import com.android.systemui.util.Compile;
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;
@@ -329,6 +331,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;
@@ -648,8 +651,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
@@ -1951,6 +1956,9 @@ public final class NotificationPanelViewController implements
    }

    private void onExpandingFinished() {
        if (Flags.bouncerUiRevamp()) {
            mWindowRootViewBlurInteractor.setTrackingShadeMotion(false);
        }
        if (!SceneContainerFlag.isEnabled()) {
            mNotificationStackScrollLayoutController.onExpansionStopped();
        }
@@ -2234,6 +2242,9 @@ public final class NotificationPanelViewController implements
    }

    private void onClosingFinished() {
        if (Flags.bouncerUiRevamp()) {
            mWindowRootViewBlurInteractor.setTrackingShadeMotion(false);
        }
        if (mOpenCloseListener != null) {
            mOpenCloseListener.onClosingFinished();
        }
@@ -2871,6 +2882,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());
        }
+1 −0
Original line number Diff line number Diff line
@@ -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)
}
+9 −0
Original line number Diff line number Diff line
@@ -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
@@ -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>
@@ -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.
@@ -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)
@@ -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
+15 −0
Original line number Diff line number Diff line
@@ -98,6 +98,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.
@@ -123,6 +130,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