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

Commit 33090c99 authored by Josh Tsuji's avatar Josh Tsuji Committed by Android (Google) Code Review
Browse files

Merge changes Ic00e9b8f,I59cf13ae

* changes:
  Ignore two tests that sporadically fail due to DynamicAnimation quirks.
  Ensure the cutout is not null before trying to use it.
parents 23e1fa48 87ebd746
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
@@ -590,9 +591,12 @@ public class BubbleStackView extends FrameLayout implements BubbleTouchHandler.F

    private int getStatusBarHeight() {
        if (getRootWindowInsets() != null) {
            WindowInsets insets = getRootWindowInsets();
            return Math.max(
                    getRootWindowInsets().getSystemWindowInsetTop(),
                    getRootWindowInsets().getDisplayCutout().getSafeInsetTop());
                    insets.getSystemWindowInsetTop(),
                    insets.getDisplayCutout() != null
                            ? insets.getDisplayCutout().getSafeInsetTop()
                            : 0);
        }

        return 0;
+3 −1
Original line number Diff line number Diff line
@@ -98,7 +98,9 @@ public class ExpandedAnimationController
        if (insets != null) {
            return mBubblePaddingPx + Math.max(
                    insets.getSystemWindowInsetTop(),
                    insets.getDisplayCutout().getSafeInsetTop());
                    insets.getDisplayCutout() != null
                            ? insets.getDisplayCutout().getSafeInsetTop()
                            : 0);
        }

        return mBubblePaddingPx;
+12 −4
Original line number Diff line number Diff line
@@ -211,7 +211,9 @@ public class StackAnimationController extends
                            - mBubblePadding
                            + Math.max(
                            insets.getSystemWindowInsetLeft(),
                            insets.getDisplayCutout().getSafeInsetLeft());
                            insets.getDisplayCutout() != null
                                    ? insets.getDisplayCutout().getSafeInsetLeft()
                                    : 0);
            mAllowableStackPositionRegion.right =
                    mLayout.getWidth()
                            - mIndividualBubbleSize
@@ -219,20 +221,26 @@ public class StackAnimationController extends
                            - mBubblePadding
                            - Math.max(
                            insets.getSystemWindowInsetRight(),
                            insets.getDisplayCutout().getSafeInsetRight());
                            insets.getDisplayCutout() != null
                                ? insets.getDisplayCutout().getSafeInsetRight()
                                : 0);

            mAllowableStackPositionRegion.top =
                    mBubblePadding
                            + Math.max(
                            insets.getSystemWindowInsetTop(),
                            insets.getDisplayCutout().getSafeInsetTop());
                            insets.getDisplayCutout() != null
                                ? insets.getDisplayCutout().getSafeInsetTop()
                                : 0);
            mAllowableStackPositionRegion.bottom =
                    mLayout.getHeight()
                            - mIndividualBubbleSize
                            - mBubblePadding
                            - Math.max(
                            insets.getSystemWindowInsetBottom(),
                            insets.getDisplayCutout().getSafeInsetBottom());
                            insets.getDisplayCutout() != null
                                    ? insets.getDisplayCutout().getSafeInsetBottom()
                                    : 0);
        }

        return mAllowableStackPositionRegion;
+3 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import androidx.dynamicanimation.animation.SpringForce;
import com.android.systemui.R;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Spy;
@@ -89,6 +90,7 @@ public class StackAnimationControllerTest extends PhysicsAnimationLayoutTestCase
    }

    @Test
    @Ignore("Sporadically failing due to DynamicAnimation not settling.")
    public void testFlingSideways() throws InterruptedException {
        // Hard fling directly upwards, no X velocity. The X fling should terminate pretty much
        // immediately, and spring to 0f, the y fling is hard enough that it will overshoot the top
@@ -119,6 +121,7 @@ public class StackAnimationControllerTest extends PhysicsAnimationLayoutTestCase
    }

    @Test
    @Ignore("Sporadically failing due to DynamicAnimation not settling.")
    public void testFlingUpFromBelowBottomCenter() throws InterruptedException {
        // Move to the center of the screen, just past the bottom.
        mStackController.moveFirstBubbleWithStackFollowing(mWidth / 2f, mHeight + 100);