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

Commit 55c6e809 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Support for passive interrupts

Bug: 111414690
Test: manual, lift, swipe down, go to shade locked
Test: adb shell setprop persist.sysui.expand_shade_on_wake_up 0
Test: adb shell setprop persist.sysui.go_to_shade_on_wake_up 0
Change-Id: I59018a72b85cfcf75344d83bbf9e3a122a66c018
parent f7994fe6
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -47,6 +47,12 @@ public interface DozeHost {

    void onIgnoreTouchWhilePulsing(boolean ignore);

    /**
     * If the device was waken up by a passive interrupt that will show the lock screen without
     * expanding the notification panel/shade.
     */
    void setPassiveInterrupt(boolean lightInterrupt);

    interface Callback {
        /**
         * Called when a high priority notification is added.
+3 −0
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@ public class DozeTriggers implements DozeMachine.Part {
                    mDozeHost.onDoubleTap(screenX, screenY);
                    mMachine.wakeUp();
                } else if (isPickup || isWakeLockScreen) {
                    mDozeHost.setPassiveInterrupt(true);
                    mMachine.wakeUp();
                } else {
                    mDozeHost.extendPulse();
@@ -210,6 +211,7 @@ public class DozeTriggers implements DozeMachine.Part {
            case INITIALIZED:
                mBroadcastReceiver.register(mContext);
                mDozeHost.addCallback(mHostCallback);
                mDozeHost.setPassiveInterrupt(false);
                checkTriggersAtInit();
                break;
            case DOZE:
@@ -219,6 +221,7 @@ public class DozeTriggers implements DozeMachine.Part {
                    mDozeSensors.reregisterAllSensors();
                }
                mDozeSensors.setListening(true);
                mDozeHost.setPassiveInterrupt(false);
                break;
            case DOZE_AOD_PAUSED:
            case DOZE_AOD_PAUSING:
+3 −6
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ public class DragDownHelper implements Gefingerpoken {
                if (!isFalseTouch() && mDragDownCallback.onDraggedDown(mStartingChild,
                        (int) (y - mInitialTouchY))) {
                    if (mStartingChild == null) {
                        mDragDownCallback.setEmptyDragAmount(0f);
                        cancelExpansion();
                    } else {
                        mCallback.setUserLockedChild(mStartingChild, false);
                        mStartingChild = null;
@@ -206,11 +206,8 @@ public class DragDownHelper implements Gefingerpoken {
        ValueAnimator anim = ValueAnimator.ofFloat(mLastHeight, 0);
        anim.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
        anim.setDuration(SPRING_BACK_ANIMATION_LENGTH_MS);
        anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
        anim.addUpdateListener(animation -> {
            mDragDownCallback.setEmptyDragAmount((Float) animation.getAnimatedValue());
            }
        });
        anim.start();
    }
+1 −1
Original line number Diff line number Diff line
@@ -793,7 +793,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
    private void setOpenedAmount(float openedAmount) {
        mNoAnimationsInThisFrame = openedAmount == 1.0f && mOpenedAmount == 0.0f;
        mOpenedAmount = openedAmount;
        if (!mAmbientState.isPanelFullWidth()) {
        if (!mAmbientState.isPanelFullWidth() || mAmbientState.isDark()) {
            // We don't do a transformation at all, lets just assume we are fully opened
            openedAmount = 1.0f;
        }
+9 −7
Original line number Diff line number Diff line
@@ -5654,19 +5654,21 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        @Override
        public boolean onDraggedDown(View startingChild, int dragLengthY) {
            if (mStatusBarState == StatusBarState.KEYGUARD
                    && hasActiveNotifications() && (!mStatusBar.isDozing()
                    || mStatusBar.isPulsing())) {
                    && hasActiveNotifications()) {
                mLockscreenGestureLogger.write(
                        MetricsEvent.ACTION_LS_SHADE,
                        (int) (dragLengthY / mDisplayMetrics.density),
                        0 /* velocityDp - N/A */);

                if (mNotificationPanel.onDraggedDown() || startingChild != null) {
                    // We have notifications, go to locked shade.
                    mStatusBar.goToLockedShade(startingChild);
                    if (startingChild instanceof ExpandableNotificationRow) {
                        ExpandableNotificationRow row = (ExpandableNotificationRow) startingChild;
                        row.onExpandedByGesture(true /* drag down is always an open */);
                    }
                }

                return true;
            } else {
                // abort gesture.
Loading