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

Commit 1426a8ea authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Make the BubbleBar flag dynamic in wmshell.

Changing the flag currently requires a reboot, because it is read once when the process starts and never changes.
This change triggers a re-read of the flag value from SystemProperties whenever the bubble bar state listener is registered and unregistered.
This allows setting the flag as part of integration tests for bubble bar.

Bug: 273994695
Test: Manual:
       - turn flag off
       - create bubbles
       - observe floating bubbles are added
       - turn flag on
       - change navigation mode to gesture navigation
       - observe bubble bar becomes visible
Change-Id: I06bdee8ddb59b3b80ea216205ff107cd84f48237
parent 3f98ccfd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -512,6 +512,7 @@ public class BubbleController implements ConfigurationChangeListener,
     * <p>If bubble bar is supported, bubble views will be updated to switch to bar mode.
     */
    public void registerBubbleStateListener(Bubbles.BubbleStateListener listener) {
        mBubbleProperties.refresh();
        if (canShowAsBubbleBar() && listener != null) {
            // Only set the listener if we can show the bubble bar.
            mBubbleStateListener = listener;
@@ -529,6 +530,7 @@ public class BubbleController implements ConfigurationChangeListener,
     * will be updated accordingly.
     */
    public void unregisterBubbleStateListener() {
        mBubbleProperties.refresh();
        if (mBubbleStateListener != null) {
            mBubbleStateListener = null;
            setUpBubbleViewsForMode();
+3 −0
Original line number Diff line number Diff line
@@ -29,4 +29,7 @@ interface BubbleProperties {
     * When this is `false`, bubbles will be floating.
     */
    val isBubbleBarEnabled: Boolean

    /** Refreshes the current value of [isBubbleBarEnabled]. */
    fun refresh()
}
+8 −2
Original line number Diff line number Diff line
@@ -22,6 +22,12 @@ import android.os.SystemProperties
object ProdBubbleProperties : BubbleProperties {

    // TODO(b/256873975) Should use proper flag when available to shell/launcher
    override val isBubbleBarEnabled =
    private var _isBubbleBarEnabled =
            SystemProperties.getBoolean("persist.wm.debug.bubble_bar", false)

    override val isBubbleBarEnabled = _isBubbleBarEnabled

    override fun refresh() {
        _isBubbleBarEnabled = SystemProperties.getBoolean("persist.wm.debug.bubble_bar", false)
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -2262,5 +2262,8 @@ public class BubblesTest extends SysuiTestCase {
        public boolean isBubbleBarEnabled() {
            return mIsBubbleBarEnabled;
        }

        @Override
        public void refresh() {}
    }
}