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

Commit ce48a19f authored by Selim Cinek's avatar Selim Cinek Committed by Automerger Merge Worker
Browse files

Merge "Fixed an issue where a user could't go to the locked shade from dozing"...

Merge "Fixed an issue where a user could't go to the locked shade from dozing" into sc-v2-dev am: 5c3d8bc2 am: 9bbf07ee

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16631031

Change-Id: Ib0a4422d6970246db11b7c81735bdf1fc8557441
parents 4ccf5606 9bbf07ee
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@ public class WakefulnessLifecycle extends Lifecycle<WakefulnessLifecycle.Observe
        }
        setWakefulness(WAKEFULNESS_AWAKE);
        dispatch(Observer::onFinishedWakingUp);
        dispatch(Observer::onPostFinishedWakingUp);
    }

    public void dispatchStartedGoingToSleep(@PowerManager.GoToSleepReason int pmSleepReason) {
@@ -236,6 +237,12 @@ public class WakefulnessLifecycle extends Lifecycle<WakefulnessLifecycle.Observe
    public interface Observer {
        default void onStartedWakingUp() {}
        default void onFinishedWakingUp() {}

        /**
         * Called after the finished waking up call, ensuring it's after all the other listeners,
         * reacting to {@link #onFinishedWakingUp()}
         */
        default void onPostFinishedWakingUp() {}
        default void onStartedGoingToSleep() {}
        default void onFinishedGoingToSleep() {}
    }
+20 −1
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@ import android.animation.ValueAnimator
import android.content.Context
import android.content.res.Configuration
import android.os.SystemClock
import android.util.DisplayMetrics
import android.util.IndentingPrintWriter
import android.util.MathUtils
import android.view.MotionEvent
@@ -24,6 +23,7 @@ import com.android.systemui.classifier.Classifier
import com.android.systemui.classifier.FalsingCollector
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dump.DumpManager
import com.android.systemui.keyguard.WakefulnessLifecycle
import com.android.systemui.media.MediaHierarchyManager
import com.android.systemui.plugins.ActivityStarter.OnDismissAction
import com.android.systemui.plugins.FalsingManager
@@ -64,6 +64,7 @@ class LockscreenShadeTransitionController @Inject constructor(
    private val scrimController: ScrimController,
    private val depthController: NotificationShadeDepthController,
    private val context: Context,
    wakefulnessLifecycle: WakefulnessLifecycle,
    configurationController: ConfigurationController,
    falsingManager: FalsingManager,
    dumpManager: DumpManager,
@@ -119,6 +120,12 @@ class LockscreenShadeTransitionController @Inject constructor(
     */
    private var nextHideKeyguardNeedsNoAnimation = false

    /**
     * Are we currently waking up to the shade locked
     */
    var isWakingToShadeLocked: Boolean = false
        private set

    /**
     * The distance until we're showing the notifications when pulsing
     */
@@ -160,6 +167,13 @@ class LockscreenShadeTransitionController @Inject constructor(
                }
            }
        })
        wakefulnessLifecycle.addObserver(object : WakefulnessLifecycle.Observer {
            override fun onPostFinishedWakingUp() {
                // when finishing waking up, the UnlockedScreenOffAnimation has another attempt
                // to reset keyguard. Let's do it in post
                isWakingToShadeLocked = false
            }
        })
    }

    private fun updateResources() {
@@ -494,6 +508,10 @@ class LockscreenShadeTransitionController @Inject constructor(
            draggedDownEntry = entry
        } else {
            logger.logGoingToLockedShade(animationHandler != null)
            if (statusBarStateController.isDozing) {
                // Make sure we don't go back to keyguard immediately again after waking up
                isWakingToShadeLocked = true
            }
            statusBarStateController.setState(StatusBarState.SHADE_LOCKED)
            // This call needs to be after updating the shade state since otherwise
            // the scrimstate resets too early
@@ -605,6 +623,7 @@ class LockscreenShadeTransitionController @Inject constructor(
            it.println("qSDragProgress: $qSDragProgress")
            it.println("isDragDownAnywhereEnabled: $isDragDownAnywhereEnabled")
            it.println("isFalsingCheckNeeded: $isFalsingCheckNeeded")
            it.println("isWakingToShadeLocked: $isWakingToShadeLocked")
            it.println("hasPendingHandlerOnKeyguardDismiss: " +
                "${animationHandlerOnKeyguardDismiss != null}")
        }
+0 −8
Original line number Diff line number Diff line
@@ -107,8 +107,6 @@ constructor(
    private var mDraggedFarEnough: Boolean = false
    private var mStartingChild: ExpandableView? = null
    private var mPulsing: Boolean = false
    var isWakingToShadeLocked: Boolean = false
        private set

    private var velocityTracker: VelocityTracker? = null

@@ -235,7 +233,6 @@ constructor(
            mStartingChild = null
        }
        if (statusBarStateController.isDozing) {
            isWakingToShadeLocked = true
            wakeUpCoordinator.willWakeUp = true
            mPowerManager!!.wakeUp(SystemClock.uptimeMillis(), WAKE_REASON_GESTURE,
                    "com.android.systemui:PULSEDRAG")
@@ -333,10 +330,6 @@ constructor(
        mPulsing = pulsing
    }

    fun onStartedWakingUp() {
        isWakingToShadeLocked = false
    }

    override fun dump(fd: FileDescriptor, pw: PrintWriter, args: Array<out String>) {
        IndentingPrintWriter(pw, "  ").let {
            it.println("PulseExpansionHandler:")
@@ -344,7 +337,6 @@ constructor(
            it.println("isExpanding: $isExpanding")
            it.println("leavingLockscreen: $leavingLockscreen")
            it.println("mPulsing: $mPulsing")
            it.println("isWakingToShadeLocked: $isWakingToShadeLocked")
            it.println("qsExpanded: $qsExpanded")
            it.println("bouncerShowing: $bouncerShowing")
        }
+1 −2
Original line number Diff line number Diff line
@@ -2963,7 +2963,7 @@ public class StatusBar extends CoreStartable implements
        mMessageRouter.cancelMessages(MSG_LAUNCH_TRANSITION_TIMEOUT);
        if (mUserSwitcherController != null && mUserSwitcherController.useFullscreenUserSwitcher()) {
            mStatusBarStateController.setState(StatusBarState.FULLSCREEN_USER_SWITCHER);
        } else if (!mPulseExpansionHandler.isWakingToShadeLocked()) {
        } else if (!mLockscreenShadeTransitionController.isWakingToShadeLocked()) {
            mStatusBarStateController.setState(StatusBarState.KEYGUARD);
        }
        updatePanelExpansionForKeyguard();
@@ -3569,7 +3569,6 @@ public class StatusBar extends CoreStartable implements
            // once we fully woke up.
            updateRevealEffect(true /* wakingUp */);
            updateNotificationPanelTouchState();
            mPulseExpansionHandler.onStartedWakingUp();

            // If we are waking up during the screen off animation, we should undo making the
            // expanded visible (we did that so the LightRevealScrim would be visible).
+1 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ public class WakefulnessLifecycleTest extends SysuiTestCase {
        assertEquals(WakefulnessLifecycle.WAKEFULNESS_AWAKE, mWakefulness.getWakefulness());

        verify(mWakefulnessObserver).onFinishedWakingUp();
        verify(mWakefulnessObserver).onPostFinishedWakingUp();
    }

    @Test
Loading