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

Commit e12ad235 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Automerger Merge Worker
Browse files

Merge changes from topic "caitlinshk-cs-wakeupfromtouch" into udc-qpr-dev am: 31e69820

parents abe3169d 31e69820
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -23,9 +23,12 @@ enum class WakeSleepReason {
    /** The physical power button was pressed to wake up or sleep the device. */
    POWER_BUTTON,

    /** The user has taped or double tapped to wake the screen */
    /** The user has tapped or double tapped to wake the screen. */
    TAP,

    /** The user performed some sort of gesture to wake the screen. */
    GESTURE,

    /** Something else happened to wake up or sleep the device. */
    OTHER;

@@ -34,6 +37,7 @@ enum class WakeSleepReason {
            return when (reason) {
                PowerManager.WAKE_REASON_POWER_BUTTON -> POWER_BUTTON
                PowerManager.WAKE_REASON_TAP -> TAP
                PowerManager.WAKE_REASON_GESTURE -> GESTURE
                else -> OTHER
            }
        }
+10 −1
Original line number Diff line number Diff line
@@ -27,7 +27,11 @@ data class WakefulnessModel(

    fun isStartingToSleep() = state == WakefulnessState.STARTING_TO_SLEEP

    fun isStartingToSleepOrAsleep() = isStartingToSleep() || state == WakefulnessState.ASLEEP
    private fun isAsleep() = state == WakefulnessState.ASLEEP

    fun isStartingToSleepOrAsleep() = isStartingToSleep() || isAsleep()

    fun isDeviceInteractive() = !isAsleep()

    fun isStartingToSleepFromPowerButton() =
        isStartingToSleep() && lastWakeReason == WakeSleepReason.POWER_BUTTON
@@ -41,6 +45,11 @@ data class WakefulnessModel(
    fun isAwakeFromTap() =
        state == WakefulnessState.STARTING_TO_WAKE && lastWakeReason == WakeSleepReason.TAP

    fun isDeviceInteractiveFromTapOrGesture(): Boolean {
        return isDeviceInteractive() &&
            (lastWakeReason == WakeSleepReason.TAP || lastWakeReason == WakeSleepReason.GESTURE)
    }

    companion object {
        fun fromWakefulnessLifecycle(wakefulnessLifecycle: WakefulnessLifecycle): WakefulnessModel {
            return WakefulnessModel(
+10 −3
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInterac
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants;
import com.android.systemui.keyguard.shared.model.TransitionState;
import com.android.systemui.keyguard.shared.model.TransitionStep;
import com.android.systemui.keyguard.shared.model.WakefulnessModel;
import com.android.systemui.keyguard.ui.binder.KeyguardLongPressViewBinder;
import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel;
import com.android.systemui.keyguard.ui.viewmodel.GoneToDreamingTransitionViewModel;
@@ -2150,10 +2151,14 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    }

    int getFalsingThreshold() {
        float factor = mCentralSurfaces.isWakeUpComingFromTouch() ? 1.5f : 1.0f;
        float factor = ShadeViewController.getFalsingThresholdFactor(getWakefulness());
        return (int) (mQsController.getFalsingThreshold() * factor);
    }

    private WakefulnessModel getWakefulness() {
        return mKeyguardInteractor.getWakefulnessModel().getValue();
    }

    private void maybeAnimateBottomAreaAlpha() {
        mBottomAreaShadeAlphaAnimator.cancel();
        if (mBarState == StatusBarState.SHADE_LOCKED) {
@@ -3587,8 +3592,10 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
                expand = flingExpands(vel, vectorVel, x, y);
            }

            mDozeLog.traceFling(expand, mTouchAboveFalsingThreshold,
                    mCentralSurfaces.isWakeUpComingFromTouch());
            mDozeLog.traceFling(
                    expand,
                    mTouchAboveFalsingThreshold,
                    /* screenOnFromTouch=*/ getWakefulness().isDeviceInteractiveFromTapOrGesture());
            // Log collapse gesture if on lock screen.
            if (!expand && onKeyguard) {
                float displayDensity = mCentralSurfaces.getDisplayDensity();
+11 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.systemui.shade

import android.view.MotionEvent
import android.view.ViewGroup
import com.android.systemui.keyguard.shared.model.WakefulnessModel
import com.android.systemui.statusbar.RemoteInputController
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController
@@ -218,6 +219,16 @@ interface ShadeViewController {
    val shadeNotificationPresenter: ShadeNotificationPresenter

    companion object {
        /**
         * Returns a multiplicative factor to use when determining the falsing threshold for touches
         * on the shade. The factor will be larger when the device is waking up due to a touch or
         * gesture.
         */
        @JvmStatic
        fun getFalsingThresholdFactor(wakefulness: WakefulnessModel): Float {
            return if (wakefulness.isDeviceInteractiveFromTapOrGesture()) 1.5f else 1.0f
        }

        const val WAKEUP_ANIMATION_DELAY_MS = 250
        const val FLING_MAX_LENGTH_SECONDS = 0.6f
        const val FLING_SPEED_UP_FACTOR = 0.6f
+7 −1
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.systemui.media.controls.ui.KeyguardMediaController;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.FalsingManager;
@@ -69,6 +70,7 @@ import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.OnMenuEv
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationLockscreenUserManager.UserChangedListener;
@@ -170,6 +172,7 @@ public class NotificationStackScrollLayoutController {
    private final KeyguardMediaController mKeyguardMediaController;
    private final SysuiStatusBarStateController mStatusBarStateController;
    private final KeyguardBypassController mKeyguardBypassController;
    private final KeyguardInteractor mKeyguardInteractor;
    private final NotificationLockscreenUserManager mLockscreenUserManager;
    // TODO: CentralSurfaces should be encapsulated behind a Controller
    private final CentralSurfaces mCentralSurfaces;
@@ -558,7 +561,8 @@ public class NotificationStackScrollLayoutController {

                @Override
                public float getFalsingThresholdFactor() {
                    return mCentralSurfaces.isWakeUpComingFromTouch() ? 1.5f : 1.0f;
                    return ShadeViewController.getFalsingThresholdFactor(
                            mKeyguardInteractor.getWakefulnessModel().getValue());
                }

                @Override
@@ -622,6 +626,7 @@ public class NotificationStackScrollLayoutController {
            SysuiStatusBarStateController statusBarStateController,
            KeyguardMediaController keyguardMediaController,
            KeyguardBypassController keyguardBypassController,
            KeyguardInteractor keyguardInteractor,
            ZenModeController zenModeController,
            NotificationLockscreenUserManager lockscreenUserManager,
            Optional<NotificationListViewModel> nsslViewModel,
@@ -669,6 +674,7 @@ public class NotificationStackScrollLayoutController {
        mStatusBarStateController = statusBarStateController;
        mKeyguardMediaController = keyguardMediaController;
        mKeyguardBypassController = keyguardBypassController;
        mKeyguardInteractor = keyguardInteractor;
        mZenModeController = zenModeController;
        mLockscreenUserManager = lockscreenUserManager;
        mViewModel = nsslViewModel;
Loading