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

Commit 06f549c6 authored by Ats Jenk's avatar Ats Jenk Committed by Automerger Merge Worker
Browse files

Merge "Bubbles ignore gestures when notif expanded" into tm-qpr-dev am: d59f2ed6 am: 9a34bf69

parents a8e8cfe8 9a34bf69
Loading
Loading
Loading
Loading
+32 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ import static android.view.View.VISIBLE;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;


import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_CONTROLLER;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_CONTROLLER;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_GESTURE;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.wm.shell.bubbles.BubblePositioner.TASKBAR_POSITION_BOTTOM;
import static com.android.wm.shell.bubbles.BubblePositioner.TASKBAR_POSITION_BOTTOM;
@@ -879,6 +880,19 @@ public class BubbleController {
        }
        }
    }
    }


    private void onNotificationPanelExpandedChanged(boolean expanded) {
        if (DEBUG_BUBBLE_GESTURE) {
            Log.d(TAG, "onNotificationPanelExpandedChanged: expanded=" + expanded);
        }
        if (mStackView != null && mStackView.isExpanded()) {
            if (expanded) {
                mStackView.stopMonitoringSwipeUpGesture();
            } else {
                mStackView.startMonitoringSwipeUpGesture();
            }
        }
    }

    private void setSysuiProxy(Bubbles.SysuiProxy proxy) {
    private void setSysuiProxy(Bubbles.SysuiProxy proxy) {
        mSysuiProxy = proxy;
        mSysuiProxy = proxy;
    }
    }
@@ -1461,6 +1475,18 @@ public class BubbleController {
        return mStackView;
        return mStackView;
    }
    }


    /**
     * Check if notification panel is in an expanded state.
     * Makes a call to System UI process and delivers the result via {@code callback} on the
     * WM Shell main thread.
     *
     * @param callback callback that has the result of notification panel expanded state
     */
    public void isNotificationPanelExpanded(Consumer<Boolean> callback) {
        mSysuiProxy.isNotificationPanelExpand(expanded ->
                mMainExecutor.execute(() -> callback.accept(expanded)));
    }

    /**
    /**
     * Description of current bubble state.
     * Description of current bubble state.
     */
     */
@@ -1836,6 +1862,12 @@ public class BubbleController {
            });
            });
        }
        }


        @Override
        public void onNotificationPanelExpandedChanged(boolean expanded) {
            mMainExecutor.execute(
                    () -> BubbleController.this.onNotificationPanelExpandedChanged(expanded));
        }

        @Override
        @Override
        public void dump(PrintWriter pw, String[] args) {
        public void dump(PrintWriter pw, String[] args) {
            try {
            try {
+28 −5
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;


import static com.android.wm.shell.animation.Interpolators.ALPHA_IN;
import static com.android.wm.shell.animation.Interpolators.ALPHA_IN;
import static com.android.wm.shell.animation.Interpolators.ALPHA_OUT;
import static com.android.wm.shell.animation.Interpolators.ALPHA_OUT;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_GESTURE;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_STACK_VIEW;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_STACK_VIEW;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
@@ -1930,11 +1931,13 @@ public class BubbleStackView extends FrameLayout
            return;
            return;
        }
        }


        boolean wasExpanded = mIsExpanded;

        hideCurrentInputMethod();
        hideCurrentInputMethod();


        mBubbleController.getSysuiProxy().onStackExpandChanged(shouldExpand);
        mBubbleController.getSysuiProxy().onStackExpandChanged(shouldExpand);


        if (mIsExpanded) {
        if (wasExpanded) {
            stopMonitoringSwipeUpGesture();
            stopMonitoringSwipeUpGesture();
            if (HOME_GESTURE_ENABLED) {
            if (HOME_GESTURE_ENABLED) {
                animateCollapse();
                animateCollapse();
@@ -1949,14 +1952,24 @@ public class BubbleStackView extends FrameLayout
            logBubbleEvent(mExpandedBubble,
            logBubbleEvent(mExpandedBubble,
                    FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__STACK_EXPANDED);
                    FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__STACK_EXPANDED);
            if (HOME_GESTURE_ENABLED) {
            if (HOME_GESTURE_ENABLED) {
                mBubbleController.isNotificationPanelExpanded(notifPanelExpanded -> {
                    if (!notifPanelExpanded && mIsExpanded) {
                        startMonitoringSwipeUpGesture();
                        startMonitoringSwipeUpGesture();
                    }
                    }
                });
            }
        }
        }
        notifyExpansionChanged(mExpandedBubble, mIsExpanded);
        notifyExpansionChanged(mExpandedBubble, mIsExpanded);
    }
    }


    private void startMonitoringSwipeUpGesture() {
    /**
        stopMonitoringSwipeUpGesture();
     * Monitor for swipe up gesture that is used to collapse expanded view
     */
    void startMonitoringSwipeUpGesture() {
        if (DEBUG_BUBBLE_GESTURE) {
            Log.d(TAG, "startMonitoringSwipeUpGesture");
        }
        stopMonitoringSwipeUpGestureInternal();


        if (isGestureNavEnabled()) {
        if (isGestureNavEnabled()) {
            mBubblesNavBarGestureTracker = new BubblesNavBarGestureTracker(mContext, mPositioner);
            mBubblesNavBarGestureTracker = new BubblesNavBarGestureTracker(mContext, mPositioner);
@@ -1971,7 +1984,17 @@ public class BubbleStackView extends FrameLayout
                == WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
                == WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
    }
    }


    private void stopMonitoringSwipeUpGesture() {
    /**
     * Stop monitoring for swipe up gesture
     */
    void stopMonitoringSwipeUpGesture() {
        if (DEBUG_BUBBLE_GESTURE) {
            Log.d(TAG, "stopMonitoringSwipeUpGesture");
        }
        stopMonitoringSwipeUpGestureInternal();
    }

    private void stopMonitoringSwipeUpGestureInternal() {
        if (mBubblesNavBarGestureTracker != null) {
        if (mBubblesNavBarGestureTracker != null) {
            mBubblesNavBarGestureTracker.stop();
            mBubblesNavBarGestureTracker.stop();
            mBubblesNavBarGestureTracker = null;
            mBubblesNavBarGestureTracker = null;
+6 −1
Original line number Original line Diff line number Diff line
@@ -213,6 +213,11 @@ public interface Bubbles {
            NotificationChannel channel,
            NotificationChannel channel,
            int modificationType);
            int modificationType);


    /**
     * Called when notification panel is expanded or collapsed
     */
    void onNotificationPanelExpandedChanged(boolean expanded);

    /**
    /**
     * Called when the status bar has become visible or invisible (either permanently or
     * Called when the status bar has become visible or invisible (either permanently or
     * temporarily).
     * temporarily).
@@ -285,7 +290,7 @@ public interface Bubbles {


    /** Callback to tell SysUi components execute some methods. */
    /** Callback to tell SysUi components execute some methods. */
    interface SysuiProxy {
    interface SysuiProxy {
        void isNotificationShadeExpand(Consumer<Boolean> callback);
        void isNotificationPanelExpand(Consumer<Boolean> callback);


        void getPendingOrActiveEntry(String key, Consumer<BubbleEntry> callback);
        void getPendingOrActiveEntry(String key, Consumer<BubbleEntry> callback);


+3 −2
Original line number Original line Diff line number Diff line
@@ -199,7 +199,8 @@ public class SystemActions extends CoreStartable {
        mNotificationShadeController = notificationShadeController;
        mNotificationShadeController = notificationShadeController;
        // Saving in instance variable since to prevent GC since
        // Saving in instance variable since to prevent GC since
        // NotificationShadeWindowController.registerCallback() only keeps weak references.
        // NotificationShadeWindowController.registerCallback() only keeps weak references.
        mNotificationShadeCallback = (keyguardShowing, keyguardOccluded, bouncerShowing, mDozing) ->
        mNotificationShadeCallback =
                (keyguardShowing, keyguardOccluded, bouncerShowing, mDozing, panelExpanded) ->
                        registerOrUnregisterDismissNotificationShadeAction();
                        registerOrUnregisterDismissNotificationShadeAction();
        mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy;
        mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy;
    }
    }
+1 −1
Original line number Original line Diff line number Diff line
@@ -736,7 +736,7 @@ public class OverviewProxyService extends CurrentUserTracker implements
    }
    }


    private void onStatusBarStateChanged(boolean keyguardShowing, boolean keyguardOccluded,
    private void onStatusBarStateChanged(boolean keyguardShowing, boolean keyguardOccluded,
            boolean bouncerShowing, boolean isDozing) {
            boolean bouncerShowing, boolean isDozing, boolean panelExpanded) {
        mSysUiState.setFlag(SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING,
        mSysUiState.setFlag(SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING,
                        keyguardShowing && !keyguardOccluded)
                        keyguardShowing && !keyguardOccluded)
                .setFlag(SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED,
                .setFlag(SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED,
Loading