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

Commit 22e579bf authored by Lyn Han's avatar Lyn Han Committed by android-build-merger
Browse files

Merge "Remove unused flags from bubble controller" into qt-dev

am: 68c570ec

Change-Id: Ia754892440f60b386ec78bfe4ad6b7879e9b91a4
parents 538ced2c 68c570ec
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -109,11 +109,6 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
    /** Use an activityView for an auto-bubbled notifs if it has an appropriate content intent */
    private static final String ENABLE_BUBBLE_CONTENT_INTENT = "experiment_bubble_content_intent";

    /** Whether the row of bubble circles are anchored to the top or bottom of the screen. */
    private static final String ENABLE_BUBBLES_AT_TOP = "experiment_enable_top_bubbles";
    /** Flag to position the header below the activity view */
    private static final String ENABLE_BUBBLE_FOOTER = "experiment_enable_bubble_footer";

    private static final String BUBBLE_STIFFNESS = "experiment_bubble_stiffness";
    private static final String BUBBLE_BOUNCINESS = "experiment_bubble_bounciness";

@@ -607,22 +602,6 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
                ENABLE_BUBBLES, 1) != 0;
    }

    /**
     * Whether bubbles should be positioned at the top of the screen or not.
     */
    public static boolean showBubblesAtTop(Context context) {
        return Settings.Secure.getInt(context.getContentResolver(),
                ENABLE_BUBBLES_AT_TOP, 0) != 0;
    }

    /**
     * Whether the bubble chrome should display as a footer or not (in which case it's a header).
     */
    public static boolean useFooter(Context context) {
        return Settings.Secure.getInt(context.getContentResolver(),
                ENABLE_BUBBLE_FOOTER, 0) != 0;
    }

    /** Default stiffness to use for bubble physics animations. */
    public static int getBubbleStiffness(Context context, int defaultStiffness) {
        return Settings.Secure.getInt(
+3 −28
Original line number Diff line number Diff line
@@ -74,10 +74,6 @@ import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
public class BubbleExpandedView extends LinearLayout implements View.OnClickListener {
    private static final String TAG = "BubbleExpandedView";

    // Configurable via bubble settings; just for testing
    private boolean mUseFooter;
    private boolean mShowOnTop;

    // The triangle pointing to the expanded view
    private View mPointerView;
    private int mPointerMargin;
@@ -185,11 +181,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
        int bgColor = ta.getColor(0, Color.WHITE);
        ta.recycle();

        mShowOnTop = BubbleController.showBubblesAtTop(getContext());
        mUseFooter = BubbleController.useFooter(getContext());

        ShapeDrawable triangleDrawable = new ShapeDrawable(
                TriangleShape.create(width, height, mShowOnTop /* pointUp */));
                TriangleShape.create(width, height, false /* pointUp */));
        triangleDrawable.setTint(bgColor);
        mPointerView.setBackground(triangleDrawable);

@@ -238,18 +231,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
            }
            return view.onApplyWindowInsets(insets);
        });

        if (!mShowOnTop) {
            removeView(mPointerView);
            if (mUseFooter) {
                View divider = findViewById(R.id.divider);
                viewWrapper.removeView(divider);
                removeView(viewWrapper);
                addView(divider);
                addView(viewWrapper);
            }
            addView(mPointerView);
        }
    }

    @Override
@@ -289,9 +270,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
        final float cr = ta2.getDimension(0, 0f);
        ta2.recycle();

        float[] radii = mUseFooter
                ? new float[] {0, 0, 0, 0, cr, cr, cr, cr}
                : new float[] {cr, cr, cr, cr, 0, 0, 0, 0};
        float[] radii = new float[] {cr, cr, cr, cr, 0, 0, 0, 0};
        GradientDrawable chromeBackground = new GradientDrawable();
        chromeBackground.setShape(GradientDrawable.RECTANGLE);
        chromeBackground.setCornerRadii(radii);
@@ -353,11 +332,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
                // Still in the shade... remove it
                parent.removeView(mNotifRow);
            }
            if (mShowOnTop) {
                addView(mNotifRow);
            } else {
                addView(mNotifRow, mUseFooter ? 0 : 1);
            }
            addView(mNotifRow, 1 /* index */);
        }
    }

+3 −15
Original line number Diff line number Diff line
@@ -810,29 +810,17 @@ public class BubbleStackView extends FrameLayout {
     * y position when the bubbles are expanded as well as the bounds of the dismiss target.
     */
    int getMaxExpandedHeight() {
        boolean showOnTop = BubbleController.showBubblesAtTop(getContext());
        int expandedY = (int) mExpandedAnimationController.getExpandedY();
        if (showOnTop) {
            // PIP dismiss view uses FLAG_LAYOUT_IN_SCREEN so we need to subtract the bottom inset
            int pipDismissHeight = mPipDismissHeight - getBottomInset();
            return mDisplaySize.y - expandedY - mBubbleSize - pipDismissHeight;
        } else {
        return expandedY - getStatusBarHeight();
    }
    }

    /**
     * Calculates the y position of the expanded view when it is expanded.
     */
    float getYPositionForExpandedView() {
        boolean showOnTop = BubbleController.showBubblesAtTop(getContext());
        if (showOnTop) {
            return getStatusBarHeight() + mBubbleSize + mBubblePadding;
        } else {
        return mExpandedAnimationController.getExpandedY()
                - mExpandedBubble.expandedView.getExpandedSize() - mBubblePadding;
    }
    }

    /**
     * Called when the height of the currently expanded view has changed (not via an
+7 −17
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import androidx.dynamicanimation.animation.DynamicAnimation;
import androidx.dynamicanimation.animation.SpringForce;

import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController;

import com.google.android.collect.Sets;

@@ -222,15 +221,7 @@ public class ExpandedAnimationController
        if (mLayout == null || mLayout.getRootWindowInsets() == null) {
            return 0;
        }
        final boolean showOnTop = BubbleController.showBubblesAtTop(mLayout.getContext());
        final WindowInsets insets = mLayout.getRootWindowInsets();
        if (showOnTop) {
            return mBubblePaddingPx + Math.max(
                    mStatusBarHeight,
                    insets.getDisplayCutout() != null
                            ? insets.getDisplayCutout().getSafeInsetTop()
                            : 0);
        } else {
        int keyboardHeight = insets.getSystemWindowInsetBottom()
                - insets.getStableInsetBottom();
        float bottomInset = keyboardHeight > 0
@@ -239,7 +230,6 @@ public class ExpandedAnimationController
        // Stable insets are excluded from display size, so we must subtract it
        return mDisplaySize.y - mBubbleSizePx - mBubblePaddingPx - bottomInset;
    }
    }

    @Override
    Set<DynamicAnimation.ViewProperty> getAnimatedProperties() {