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

Commit 820ba2d9 authored by Selim Cinek's avatar Selim Cinek
Browse files

Continued the bypass experience

The lock icon now hides as soon as the notifications are showing
to avoid the overlap introduced in the previous CL.
We're also introducing a new listener that one can listen to
for when the notifications are fully hidden.
That same listener is now used to hide and show the aod icons

Bug: 130327302
Change-Id: I5694a38e542b82bf2738d66bdff28d122a9f89e7
parent b0fada6c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ android_library {
        "--extra-packages",
        "com.android.keyguard",
    ],
    kotlincflags: ["-Xjvm-default=enable"],

    plugins: ["dagger2-compiler-2.19"],
}
@@ -128,6 +129,7 @@ android_library {
        "telephony-common",
        "android.test.base",
    ],
    kotlincflags: ["-Xjvm-default=enable"],
    aaptflags: [
        "--extra-packages",
        "com.android.keyguard:com.android.systemui",
@@ -155,6 +157,8 @@ android_app {
        "telephony-common",
    ],

    kotlincflags: ["-Xjvm-default=enable"],

    dxflags: ["--multi-dex"],
    aaptflags: [
        "--extra-packages",
@@ -191,6 +195,8 @@ android_app {
        "telephony-common",
    ],

    kotlincflags: ["-Xjvm-default=enable"],

    srcs: [
        "legacy/recents/src/**/*.java",
        "legacy/recents/src/**/I*.aidl",
+8 −2
Original line number Diff line number Diff line
@@ -48,9 +48,11 @@ import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.ScrimView;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
import com.android.systemui.statusbar.notification.collection.NotificationData;
import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.statusbar.phone.KeyguardBouncer;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl;
import com.android.systemui.statusbar.phone.LockIcon;
import com.android.systemui.statusbar.phone.LockscreenWallpaper;
@@ -145,10 +147,14 @@ public class SystemUIFactory {
    }

    public NotificationIconAreaController createNotificationIconAreaController(Context context,
            StatusBar statusBar, StatusBarStateController statusBarStateController,
            StatusBar statusBar,
            NotificationWakeUpCoordinator wakeUpCoordinator,
            KeyguardBypassController keyguardBypassController,
            StatusBarStateController statusBarStateController,
            NotificationListener listener) {
        return new NotificationIconAreaController(context, statusBar, statusBarStateController,
                listener, Dependency.get(NotificationMediaManager.class));
                wakeUpCoordinator, keyguardBypassController, listener,
                Dependency.get(NotificationMediaManager.class));
    }

    public KeyguardIndicationController createKeyguardIndicationController(Context context,
+3 −1
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ constructor(context: Context,
        get() = mFalsingManager.isFalseTouch
    var qsExpanded: Boolean = false
    var pulseExpandAbortListener: Runnable? = null
    var bouncerShowing: Boolean = false

    init {
        mMinDragDistance = context.resources.getDimensionPixelSize(
@@ -107,7 +108,8 @@ constructor(context: Context,
    }

    private fun maybeStartExpansion(event: MotionEvent): Boolean {
        if (!wakeUpCoordinator.canShowPulsingHuns || qsExpanded) {
        if (!wakeUpCoordinator.canShowPulsingHuns || qsExpanded
                || bouncerShowing) {
            return false
        }
        if (velocityTracker == null) {
+46 −3
Original line number Diff line number Diff line
@@ -66,7 +66,9 @@ class NotificationWakeUpCoordinator @Inject constructor(
    private var mLinearVisibilityAmount = 0.0f
    private var mWakingUp = false
    private val mEntrySetToClearWhenFinished = mutableSetOf<NotificationEntry>()
    private val mDozeParameters: DozeParameters;
    private val mDozeParameters: DozeParameters
    private var pulseExpanding: Boolean = false
    private val wakeUpListeners = arrayListOf<WakeUpListener>()
    var fullyAwake: Boolean = false

    var willWakeUp = false
@@ -89,6 +91,16 @@ class NotificationWakeUpCoordinator @Inject constructor(
            }
        }

    var notificationsFullyHidden: Boolean = false
        private set(value) {
            if (field != value) {
                field = value
                for (listener in wakeUpListeners) {
                    listener.onFullyHiddenChanged(value)
                }
            }
        }

    /**
     * True if we can show pulsing heads up notifications
     */
@@ -104,7 +116,6 @@ class NotificationWakeUpCoordinator @Inject constructor(
            return canShow
        }


    init {
        mHeadsUpManagerPhone.addListener(this)
        mStatusBarStateController.addCallback(this)
@@ -113,8 +124,19 @@ class NotificationWakeUpCoordinator @Inject constructor(

    fun setStackScroller(stackScroller: NotificationStackScrollLayout) {
        mStackScroller = stackScroller
        pulseExpanding = stackScroller.isPulseExpanding
        stackScroller.setOnPulseHeightChangedListener {
            val nowExpanding = isPulseExpanding()
            val changed = nowExpanding != pulseExpanding
            pulseExpanding = nowExpanding
            for (listener in wakeUpListeners) {
                listener.onPulseExpansionChanged(changed)
            }
        }
    }

    fun isPulseExpanding(): Boolean = mStackScroller.isPulseExpanding

    /**
     * @param visible should notifications be visible
     * @param animate should this change be animated
@@ -132,6 +154,14 @@ class NotificationWakeUpCoordinator @Inject constructor(
        }
    }

    fun addListener(listener: WakeUpListener) {
        wakeUpListeners.add(listener);
    }

    fun removeFullyHiddenChangedListener(listener: WakeUpListener) {
        wakeUpListeners.remove(listener);
    }

    private fun updateNotificationVisibility(animate: Boolean, increaseSpeed: Boolean) {
        // TODO: handle Lockscreen wakeup for bypass when we're not pulsing anymore
        var visible = mNotificationsVisibleForExpansion || mHeadsUpManagerPhone.hasNotifications()
@@ -244,7 +274,7 @@ class NotificationWakeUpCoordinator @Inject constructor(
        val linearAmount = Math.min(1.0f - mLinearVisibilityAmount, mLinearDozeAmount)
        val amount = Math.min(1.0f - mVisibilityAmount, mDozeAmount)
        mStackScroller.setHideAmount(linearAmount, amount)
        iconAreaController.setFullyHidden(linearAmount == 1.0f);
        notificationsFullyHidden = linearAmount == 1.0f;
    }

    private fun notifyAnimationStart(awake: Boolean) {
@@ -300,4 +330,17 @@ class NotificationWakeUpCoordinator @Inject constructor(

    private fun shouldAnimateVisibility() =
            mDozeParameters.getAlwaysOn() && !mDozeParameters.getDisplayNeedsBlanking()

    interface WakeUpListener {
        /**
         * Called whenever the notifications are fully hidden or shown
         */
        @JvmDefault fun onFullyHiddenChanged(isFullyHidden: Boolean) {}

        /**
         * Called whenever the pulseExpansion changes
         * @param expandingChanged if the user has started or stopped expanding
         */
        @JvmDefault fun onPulseExpansionChanged(expandingChanged: Boolean) {}
    }
}
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -3278,7 +3278,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
    @Override
    @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
    public void generateAddAnimation(ExpandableView child, boolean fromMoreCard) {
        if (mIsExpanded && mAnimationsEnabled && !mChangePositionInProgress) {
        if (mIsExpanded && mAnimationsEnabled && !mChangePositionInProgress && !isFullyHidden()) {
            // Generate Animations
            mChildrenToAddAnimated.add(child);
            if (fromMoreCard) {
@@ -3286,7 +3286,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
            }
            mNeedsAnimation = true;
        }
        if (isHeadsUp(child) && mAnimationsEnabled && !mChangePositionInProgress) {
        if (isHeadsUp(child) && mAnimationsEnabled && !mChangePositionInProgress
                && !isFullyHidden()) {
            mAddedHeadsUpChildren.add(child);
            mChildrenToAddAnimated.remove(child);
        }
Loading