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

Commit 4042e2fa authored by Adrian Roos's avatar Adrian Roos
Browse files

AOD: Finish pulse when notification is removed

Change-Id: I346e7ef77cc3c9bb2c72bd028953f0e5ff757502
Fixes: 38174509
Test: receive notification while phone off (with or without AOD). Swipe away notification. Verify that it goes back to the base state immediately
parent 1d8d34fa
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ public class DozeScrimController {
    private float mBehindTarget;
    private boolean mDozingAborted;
    private boolean mWakeAndUnlocking;
    private boolean mFullyPulsing;

    public DozeScrimController(ScrimController scrimController, Context context) {
        mContext = context;
@@ -136,6 +137,12 @@ public class DozeScrimController {
        abortPulsing();
    }

    public void pulseOutNow() {
        if (mPulseCallback != null && mFullyPulsing) {
            mPulseOut.run();
        }
    }

    public void onScreenTurnedOn() {
        if (isPulsing()) {
            final boolean pickupOrDoubleTap = mPulseReason == DozeLog.PULSE_REASON_SENSOR_PICKUP
@@ -163,6 +170,7 @@ public class DozeScrimController {
        if (DEBUG) Log.d(TAG, "Cancel pulsing");

        if (mPulseCallback != null) {
            mFullyPulsing = false;
            mHandler.removeCallbacks(mPulseIn);
            mHandler.removeCallbacks(mPulseOut);
            mHandler.removeCallbacks(mPulseOutExtended);
@@ -297,6 +305,7 @@ public class DozeScrimController {
            mHandler.postDelayed(mPulseOut, mDozeParameters.getPulseVisibleDuration());
            mHandler.postDelayed(mPulseOutExtended,
                    mDozeParameters.getPulseVisibleDurationExtended());
            mFullyPulsing = true;
        }
    };

@@ -311,6 +320,8 @@ public class DozeScrimController {
    private final Runnable mPulseOut = new Runnable() {
        @Override
        public void run() {
            mFullyPulsing = false;
            mHandler.removeCallbacks(mPulseOut);
            mHandler.removeCallbacks(mPulseOutExtended);
            if (DEBUG) Log.d(TAG, "Pulse out, mDozing=" + mDozing);
            if (!mDozing) return;
+5 −0
Original line number Diff line number Diff line
@@ -1871,6 +1871,11 @@ public class StatusBar extends SystemUI implements DemoMode,
        } catch (RemoteException ex) {
            // system process is dead if we're here.
        }
        if (mStackScroller.hasPulsingNotifications() && mHeadsUpManager.getAllEntries().isEmpty()) {
            // We were showing a pulse for a notification, but no notifications are pulsing anymore.
            // Finish the pulse.
            mDozeScrimController.pulseOutNow();
        }
        // end old BaseStatusBar.performRemoveNotification.
    }