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

Commit 9e287a35 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

API for whether Bubbles can show notifications

Introduces a new API method in Bubbles to indicate whether
it can handle bubble notifications.

This will be wired up in a follow up to the Notifications
API to determine when a HUN should be suppressed.

Flag: ACONFIG com.android.wm.shell.enable_bubble_bar DEVELOPMENT
Bug: 340532785
Test: Manual
Change-Id: I0ac6848995df2f17906e2b5817f17c4e6da87acc
parent 5876053b
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2709,6 +2709,15 @@ public class BubbleController implements ConfigurationChangeListener,
                    () -> BubbleController.this.onSensitiveNotificationProtectionStateChanged(
                            sensitiveNotificationProtectionActive));
        }

        @Override
        public boolean canShowBubbleNotification() {
            // in bubble bar mode, when the IME is visible we can't animate new bubbles.
            if (BubbleController.this.isShowingAsBubbleBar()) {
                return !BubbleController.this.mBubblePositioner.getIsImeVisible();
            }
            return true;
        }
    }

    /**
+5 −0
Original line number Diff line number Diff line
@@ -324,6 +324,11 @@ public class BubblePositioner {
        return 0;
    }

    /** Returns whether the IME is visible. */
    public boolean getIsImeVisible() {
        return mImeVisible;
    }

    /** Sets whether the IME is visible. **/
    public void setImeVisible(boolean visible, int height) {
        mImeVisible = visible;
+9 −0
Original line number Diff line number Diff line
@@ -296,6 +296,15 @@ public interface Bubbles {
    void onSensitiveNotificationProtectionStateChanged(
            boolean sensitiveNotificationProtectionActive);

    /**
     * Determines whether Bubbles can show notifications.
     *
     * <p>Normally bubble notifications are shown by Bubbles, but in some cases the bubble
     * notification is suppressed and should be shown by the Notifications pipeline as regular
     * notifications.
     */
    boolean canShowBubbleNotification();

    /**
     * A listener to be notified of bubble state changes, used by launcher to render bubbles in
     * its process.