summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/scrim/ScrimDrawable.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/QuickSettingsController.java31
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java4
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerTest.java24
5 files changed, 62 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/scrim/ScrimDrawable.java b/packages/SystemUI/src/com/android/systemui/scrim/ScrimDrawable.java
index 10e2afe0baa9..9a1ffcbab8d1 100644
--- a/packages/SystemUI/src/com/android/systemui/scrim/ScrimDrawable.java
+++ b/packages/SystemUI/src/com/android/systemui/scrim/ScrimDrawable.java
@@ -203,7 +203,10 @@ public class ScrimDrawable extends Drawable {
}
public void setBottomEdgeRadius(float radius) {
- mBottomEdgeRadius = radius;
+ if (mBottomEdgeRadius != radius) {
+ mBottomEdgeRadius = radius;
+ invalidateSelf();
+ }
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
index 784a36092922..047fea123dc3 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
@@ -2206,6 +2206,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
// TODO: non-linearly transform progress fraction into squish amount (ease-in, linear out)
mCurrentBackProgress = progressFraction;
applyBackScaling(progressFraction);
+ mQsController.setClippingBounds();
}
/** Resets back progress. */
diff --git a/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsController.java b/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsController.java
index 8672260790c3..c42c2f4fa15a 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsController.java
@@ -114,6 +114,8 @@ import javax.inject.Inject;
public class QuickSettingsController implements Dumpable {
public static final String TAG = "QuickSettingsController";
+ public static final int SHADE_BACK_ANIM_SCALE_MULTIPLIER = 100;
+
private QS mQs;
private final Lazy<NotificationPanelViewController> mPanelViewControllerLazy;
@@ -1128,7 +1130,7 @@ public class QuickSettingsController implements Dumpable {
* Updates scrim bounds, QS clipping, notifications clipping and keyguard status view clipping
* as well based on the bounds of the shade and QS state.
*/
- private void setClippingBounds() {
+ void setClippingBounds() {
float qsExpansionFraction = computeExpansionFraction();
final int qsPanelBottomY = calculateBottomPosition(qsExpansionFraction);
// Split shade has no QQS
@@ -1216,7 +1218,10 @@ public class QuickSettingsController implements Dumpable {
? 0 : mScreenCornerRadius;
radius = (int) MathUtils.lerp(screenCornerRadius, mScrimCornerRadius,
Math.min(top / (float) mScrimCornerRadius, 1f));
- mScrimController.setNotificationBottomRadius(radius);
+
+ float bottomRadius = mExpanded ? screenCornerRadius :
+ calculateBottomCornerRadius(screenCornerRadius);
+ mScrimController.setNotificationBottomRadius(bottomRadius);
}
if (isQsFragmentCreated()) {
float qsTranslation = 0;
@@ -1279,6 +1284,28 @@ public class QuickSettingsController implements Dumpable {
nsslLeft, nsslTop, nsslRight, nsslBottom, topRadius, bottomRadius);
}
+ /**
+ * Bottom corner radius should follow screen corner radius unless
+ * predictive back is running. We want a smooth transition from screen
+ * corner radius to scrim corner radius as the notification scrim is scaled down,
+ * but the transition should be brief enough to accommodate very short back gestures.
+ */
+ @VisibleForTesting
+ int calculateBottomCornerRadius(float screenCornerRadius) {
+ return (int) MathUtils.lerp(screenCornerRadius, mScrimCornerRadius,
+ Math.min(calculateBottomRadiusProgress(), 1f));
+ }
+
+ @VisibleForTesting
+ float calculateBottomRadiusProgress() {
+ return (1 - mScrimController.getBackScaling()) * SHADE_BACK_ANIM_SCALE_MULTIPLIER;
+ }
+
+ @VisibleForTesting
+ int getScrimCornerRadius() {
+ return mScrimCornerRadius;
+ }
+
void setDisplayInsets(int leftInset, int rightInset) {
mDisplayLeftInset = leftInset;
mDisplayRightInset = rightInset;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index fdb772bc6c13..25ecf1a424e0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -602,6 +602,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
mNotificationsScrim.setScaleY(scale);
}
+ public float getBackScaling() {
+ return mNotificationsScrim.getScaleY();
+ }
+
public void onTrackingStarted() {
mDarkenWhileDragging = !mKeyguardStateController.canDismissLockScreen();
if (!mKeyguardUnlockAnimationController.isPlayingCannedUnlockAnimation()) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerTest.java
index 34d09a912c87..ff047aa2faf2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/QuickSettingsControllerTest.java
@@ -580,6 +580,30 @@ public class QuickSettingsControllerTest extends SysuiTestCase {
verify(mQs).setQsVisible(true);
}
+ @Test
+ public void calculateBottomCornerRadius_scrimScaleMax() {
+ when(mScrimController.getBackScaling()).thenReturn(1.0f);
+ assertThat(mQsController.calculateBottomCornerRadius(0.0f)).isEqualTo(0);
+ }
+
+ @Test
+ public void calculateBottomCornerRadius_scrimScaleMin() {
+ when(mScrimController.getBackScaling())
+ .thenReturn(mNotificationPanelViewController.SHADE_BACK_ANIM_MIN_SCALE);
+ assertThat(mQsController.calculateBottomCornerRadius(0.0f))
+ .isEqualTo(mQsController.getScrimCornerRadius());
+ }
+
+ @Test
+ public void calculateBottomCornerRadius_scrimScaleCutoff() {
+ float ratio = 1 / mQsController.calculateBottomRadiusProgress();
+ float cutoffScale = 1 - mNotificationPanelViewController.SHADE_BACK_ANIM_MIN_SCALE / ratio;
+ when(mScrimController.getBackScaling())
+ .thenReturn(cutoffScale);
+ assertThat(mQsController.calculateBottomCornerRadius(0.0f))
+ .isEqualTo(mQsController.getScrimCornerRadius());
+ }
+
private void lockScreen() {
mQsController.setBarState(KEYGUARD);
}