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

Commit a52cb715 authored by Mady Mellor's avatar Mady Mellor
Browse files

Only round the corners if the devices supports it

- In BubbleExpandedView the outline provider was using corner radius
  even if the device didn't support it
- In BubbleStackView the screenshot used when switching between bubbles
  also applied a corner radius even if the device didn't support it

This change ensures to check if rounded corners is supported before
applying it.

Test: manual - alter the code so that the device doesn't support rounded
               corners and check that expanding and switching between
               bubbles shows proper corners all the time
Fixes: 206902204
Change-Id: Ia0a8ceee825d4b399dd86f09306b021b38071e8d
parent 5f8f93b9
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -386,13 +386,14 @@ public class BubbleExpandedView extends LinearLayout {
        final TypedArray ta = mContext.obtainStyledAttributes(new int[] {
                android.R.attr.dialogCornerRadius,
                android.R.attr.colorBackgroundFloating});
        mCornerRadius = ta.getDimensionPixelSize(0, 0);
        boolean supportsRoundedCorners = ScreenDecorationsUtils.supportsRoundedCornersOnWindows(
                mContext.getResources());
        mCornerRadius = supportsRoundedCorners ? ta.getDimensionPixelSize(0, 0) : 0;
        mBackgroundColorFloating = ta.getColor(1, Color.WHITE);
        mExpandedViewContainer.setBackgroundColor(mBackgroundColorFloating);
        ta.recycle();

        if (mTaskView != null && ScreenDecorationsUtils.supportsRoundedCornersOnWindows(
                mContext.getResources())) {
        if (mTaskView != null) {
            mTaskView.setCornerRadius(mCornerRadius);
        }
        updatePointerView();
+4 −1
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ import androidx.dynamicanimation.animation.SpringAnimation;
import androidx.dynamicanimation.animation.SpringForce;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.policy.ScreenDecorationsUtils;
import com.android.internal.util.FrameworkStatsLog;
import com.android.wm.shell.R;
import com.android.wm.shell.animation.Interpolators;
@@ -822,7 +823,9 @@ public class BubbleStackView extends FrameLayout
        mAnimatingOutSurfaceView = new SurfaceView(getContext());
        mAnimatingOutSurfaceView.setUseAlpha();
        mAnimatingOutSurfaceView.setZOrderOnTop(true);
        mAnimatingOutSurfaceView.setCornerRadius(mCornerRadius);
        boolean supportsRoundedCorners = ScreenDecorationsUtils.supportsRoundedCornersOnWindows(
                mContext.getResources());
        mAnimatingOutSurfaceView.setCornerRadius(supportsRoundedCorners ? mCornerRadius : 0);
        mAnimatingOutSurfaceView.setLayoutParams(new ViewGroup.LayoutParams(0, 0));
        mAnimatingOutSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
            @Override