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

Commit d1b02b39 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Interface for providing SysuiProxy

This change creates an interface for providing SysuiProxy. This allows abstracting out some api surface of BubbleController.

Bug: 321265700
Test: N/A
Change-Id: I499655d1b15c3bff41534c1b2d224658008a2189
parent fdaf4101
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ import java.util.function.IntConsumer;
 * The controller manages addition, removal, and visible state of bubbles on screen.
 */
public class BubbleController implements ConfigurationChangeListener,
        RemoteCallable<BubbleController> {
        RemoteCallable<BubbleController>, Bubbles.SysuiProxy.Provider {

    private static final String TAG = TAG_WITH_CLASS_NAME ? "BubbleController" : TAG_BUBBLES;

@@ -706,6 +706,7 @@ public class BubbleController implements ConfigurationChangeListener,
        return mBubbleIconFactory;
    }

    @Override
    public Bubbles.SysuiProxy getSysuiProxy() {
        return mSysuiProxy;
    }
@@ -732,8 +733,7 @@ public class BubbleController implements ConfigurationChangeListener,
            if (mStackView == null) {
                mStackView = new BubbleStackView(
                        mContext, this, mBubbleData, mSurfaceSynchronizer,
                        mFloatingContentCoordinator,
                        mMainExecutor);
                        mFloatingContentCoordinator, this, mMainExecutor);
                mStackView.onOrientationChanged();
                if (mExpandListener != null) {
                    mStackView.setExpandListener(mExpandListener);
+6 −3
Original line number Diff line number Diff line
@@ -206,6 +206,7 @@ public class BubbleStackView extends FrameLayout
            };
    private final BubbleController mBubbleController;
    private final BubbleData mBubbleData;
    private final Bubbles.SysuiProxy.Provider mSysuiProxyProvider;
    private StackViewState mStackViewState = new StackViewState();

    private final ValueAnimator mDismissBubbleAnimator;
@@ -867,12 +868,14 @@ public class BubbleStackView extends FrameLayout
    public BubbleStackView(Context context, BubbleController bubbleController,
            BubbleData data, @Nullable SurfaceSynchronizer synchronizer,
            FloatingContentCoordinator floatingContentCoordinator,
            Bubbles.SysuiProxy.Provider sysuiProxyProvider,
            ShellExecutor mainExecutor) {
        super(context);

        mMainExecutor = mainExecutor;
        mBubbleController = bubbleController;
        mBubbleData = data;
        mSysuiProxyProvider = sysuiProxyProvider;

        Resources res = getResources();
        mBubbleSize = res.getDimensionPixelSize(R.dimen.bubble_size);
@@ -2071,7 +2074,7 @@ public class BubbleStackView extends FrameLayout

        hideCurrentInputMethod();

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

        if (wasExpanded) {
            stopMonitoringSwipeUpGesture();
@@ -3015,7 +3018,7 @@ public class BubbleStackView extends FrameLayout
        if (mExpandedBubble == null || mExpandedBubble.getExpandedView() == null) {
            mManageMenu.setVisibility(View.INVISIBLE);
            mManageMenuScrim.setVisibility(INVISIBLE);
            mBubbleController.getSysuiProxy().onManageMenuExpandChanged(false /* show */);
            mSysuiProxyProvider.getSysuiProxy().onManageMenuExpandChanged(false /* show */);
            return;
        }
        if (show) {
@@ -3029,7 +3032,7 @@ public class BubbleStackView extends FrameLayout
            }
        };

        mBubbleController.getSysuiProxy().onManageMenuExpandChanged(show);
        mSysuiProxyProvider.getSysuiProxy().onManageMenuExpandChanged(show);
        mManageMenuScrim.animate()
                .setInterpolator(show ? ALPHA_IN : ALPHA_OUT)
                .alpha(show ? BUBBLE_EXPANDED_SCRIM_ALPHA : 0f)
+7 −0
Original line number Diff line number Diff line
@@ -321,6 +321,13 @@ public interface Bubbles {

    /** Callback to tell SysUi components execute some methods. */
    interface SysuiProxy {

        /** Provider interface for {@link SysuiProxy}. */
        interface Provider {
            /** Returns {@link SysuiProxy}. */
            SysuiProxy getSysuiProxy();
        }

        void isNotificationPanelExpand(Consumer<Boolean> callback);

        void getPendingOrActiveEntry(String key, Consumer<BubbleEntry> callback);
+1 −1
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ class BubbleViewInfoTest : ShellTestCase() {
                mock<BubbleProperties>())

        bubbleStackView = BubbleStackView(context, bubbleController, bubbleData,
                surfaceSynchronizer, FloatingContentCoordinator(), mainExecutor)
                surfaceSynchronizer, FloatingContentCoordinator(), bubbleController, mainExecutor)
        bubbleBarLayerView = BubbleBarLayerView(context, bubbleController)
    }