diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml
index 31635a507d6f2..9b401145b2169 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml
@@ -62,7 +62,7 @@
android:layout_gravity="center_horizontal"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
- android:letterSpacing="0.04"
+ android:letterSpacing="0.03"
android:textColor="?attr/wallpaperTextColor"
android:singleLine="true"
style="@style/widget_big_thin"
diff --git a/packages/SystemUI/res-keyguard/values/dimens.xml b/packages/SystemUI/res-keyguard/values/dimens.xml
index 4934e147e42be..1c1c7579b8ad9 100644
--- a/packages/SystemUI/res-keyguard/values/dimens.xml
+++ b/packages/SystemUI/res-keyguard/values/dimens.xml
@@ -60,8 +60,8 @@
8dp
16dp
8dp
-
- 29dp
+
+ 28dp
32dp
diff --git a/packages/SystemUI/res/values-h560dp-xhdpi/dimens.xml b/packages/SystemUI/res/values-h560dp-xhdpi/dimens.xml
deleted file mode 100644
index f6dbc3de27383..0000000000000
--- a/packages/SystemUI/res/values-h560dp-xhdpi/dimens.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
- 32.5%
- 24%
-
\ No newline at end of file
diff --git a/packages/SystemUI/res/values-h560dp-xxhdpi/config.xml b/packages/SystemUI/res/values-h560dp-xxhdpi/config.xml
deleted file mode 100644
index b2231a6160a9e..0000000000000
--- a/packages/SystemUI/res/values-h560dp-xxhdpi/config.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- 4
-
-
diff --git a/packages/SystemUI/res/values-h560dp-xxhdpi/dimens.xml b/packages/SystemUI/res/values-h560dp-xxhdpi/dimens.xml
deleted file mode 100644
index 905e9e3adb62b..0000000000000
--- a/packages/SystemUI/res/values-h560dp-xxhdpi/dimens.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
- 32.5%
- 19.8%
-
\ No newline at end of file
diff --git a/packages/SystemUI/res/values-h650dp/config.xml b/packages/SystemUI/res/values-h650dp/config.xml
deleted file mode 100644
index ee641b4b6edde..0000000000000
--- a/packages/SystemUI/res/values-h650dp/config.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
- 5
-
-
diff --git a/packages/SystemUI/res/values-h650dp/dimens.xml b/packages/SystemUI/res/values-h650dp/dimens.xml
index 3811f678e3305..8a00953049789 100644
--- a/packages/SystemUI/res/values-h650dp/dimens.xml
+++ b/packages/SystemUI/res/values-h650dp/dimens.xml
@@ -16,7 +16,4 @@
32dp
-
- 32.5%
- 18.5%
\ No newline at end of file
diff --git a/packages/SystemUI/res/values-sw600dp-land/config.xml b/packages/SystemUI/res/values-sw600dp-land/config.xml
index 6594bd28c8b45..c4c4671522814 100644
--- a/packages/SystemUI/res/values-sw600dp-land/config.xml
+++ b/packages/SystemUI/res/values-sw600dp-land/config.xml
@@ -15,10 +15,6 @@
~ limitations under the License
-->
-
- 3
-
false
diff --git a/packages/SystemUI/res/values-sw600dp-land/dimens.xml b/packages/SystemUI/res/values-sw600dp-land/dimens.xml
index 13ca11401c03e..f2df4b9023b14 100644
--- a/packages/SystemUI/res/values-sw600dp-land/dimens.xml
+++ b/packages/SystemUI/res/values-sw600dp-land/dimens.xml
@@ -16,9 +16,6 @@
*/
-->
- 37%
- 20%
-
36dp
80dp
diff --git a/packages/SystemUI/res/values-sw600dp/config.xml b/packages/SystemUI/res/values-sw600dp/config.xml
index 63b9d75f50546..67dabdb7353dd 100644
--- a/packages/SystemUI/res/values-sw600dp/config.xml
+++ b/packages/SystemUI/res/values-sw600dp/config.xml
@@ -26,10 +26,6 @@
1
-
- 5
-
true
diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml
index e95d9fee880b4..923edc8f1e929 100644
--- a/packages/SystemUI/res/values-sw600dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw600dp/dimens.xml
@@ -38,12 +38,6 @@
@dimen/close_handle_height
-
- 34%
- 24%
-
44dp
diff --git a/packages/SystemUI/res/values-sw720dp-land/config.xml b/packages/SystemUI/res/values-sw720dp-land/config.xml
deleted file mode 100644
index 1b502886d8da9..0000000000000
--- a/packages/SystemUI/res/values-sw720dp-land/config.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- 4
-
-
diff --git a/packages/SystemUI/res/values-sw720dp-land/dimens.xml b/packages/SystemUI/res/values-sw720dp-land/dimens.xml
deleted file mode 100644
index 511d45ffe71dd..0000000000000
--- a/packages/SystemUI/res/values-sw720dp-land/dimens.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
- 35%
- 24%
-
diff --git a/packages/SystemUI/res/values-sw720dp/dimens.xml b/packages/SystemUI/res/values-sw720dp/dimens.xml
index 25e96c8848dbc..8cf4adb73a7c7 100644
--- a/packages/SystemUI/res/values-sw720dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw720dp/dimens.xml
@@ -28,11 +28,5 @@
770dp
56dp
-
-
- 35%
- 25%
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 59c009fbaddbd..36bc3be624d95 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -437,15 +437,10 @@
100dp
-
- 45%
- 19.8%
-
-
+
30dp
+
+ 26dp
250dp
- 0.62
@@ -883,9 +878,6 @@
burn-in on AOD -->
50dp
-
- 30dp
-
16dp
0dp
48dp
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
index 389be1ad6d77e..0cf26df7b3778 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
@@ -19,11 +19,10 @@ package com.android.systemui.statusbar.phone;
import static com.android.systemui.statusbar.notification.NotificationUtils.interpolate;
import android.content.res.Resources;
-import android.graphics.Path;
import android.util.MathUtils;
-import android.view.animation.AccelerateInterpolator;
-import android.view.animation.PathInterpolator;
+import com.android.keyguard.KeyguardStatusView;
+import com.android.systemui.Interpolators;
import com.android.systemui.R;
/**
@@ -31,54 +30,83 @@ import com.android.systemui.R;
*/
public class KeyguardClockPositionAlgorithm {
- private static final float SLOW_DOWN_FACTOR = 0.4f;
-
- private static final float CLOCK_RUBBERBAND_FACTOR_MIN = 0.08f;
- private static final float CLOCK_RUBBERBAND_FACTOR_MAX = 0.8f;
- private static final float CLOCK_SCALE_FADE_START = 0.95f;
- private static final float CLOCK_SCALE_FADE_END = 0.75f;
- private static final float CLOCK_SCALE_FADE_END_NO_NOTIFS = 0.5f;
-
- private static final float CLOCK_ADJ_TOP_PADDING_MULTIPLIER_MIN = 1.4f;
- private static final float CLOCK_ADJ_TOP_PADDING_MULTIPLIER_MAX = 3.2f;
-
private static final long MILLIS_PER_MINUTES = 1000 * 60;
private static final float BURN_IN_PREVENTION_PERIOD_Y = 521;
private static final float BURN_IN_PREVENTION_PERIOD_X = 83;
+ /**
+ * How much the clock height influences the shade position.
+ * 0 means nothing, 1 means move the shade up by the height of the clock
+ * 0.5f means move the shade up by half of the size of the clock.
+ */
+ private static float CLOCK_HEIGHT_WEIGHT = 0.7f;
+
+ /**
+ * Margin between the bottom of the clock and the notification shade.
+ */
private int mClockNotificationsMargin;
- private float mClockYFractionMin;
- private float mClockYFractionMax;
- private int mMaxKeyguardNotifications;
- private int mMaxPanelHeight;
+
+ /**
+ * Current height of {@link NotificationPanelView}, considering how much the
+ * user collapsed it.
+ */
private float mExpandedHeight;
- private int mNotificationCount;
+
+ /**
+ * Height of the parent view - display size in px.
+ */
private int mHeight;
+
+ /**
+ * Height of {@link KeyguardStatusView}.
+ */
private int mKeyguardStatusHeight;
- private float mEmptyDragAmount;
- private float mDensity;
+
+ /**
+ * Height of notification stack: Sum of height of each notification.
+ */
+ private int mNotificationStackHeight;
+
+ /**
+ * Minimum top margin to avoid overlap with status bar.
+ */
+ private int mMinTopMargin;
+
+ /**
+ * Maximum bottom padding to avoid overlap with {@link KeyguardBottomAreaView} or
+ * the ambient indication.
+ */
+ private int mMaxShadeBottom;
+
+ /**
+ * Margin that we should respect within the available space.
+ */
+ private int mContainerPadding;
+
+ /**
+ * Position where clock should be when the panel is collapsed.
+ */
+ private int mClockYTarget;
+
+ /**
+ * @see NotificationPanelView#getMaxPanelHeight()
+ */
+ private float mMaxPanelHeight;
+
+ /**
+ * Burn-in prevention x translation.
+ */
private int mBurnInPreventionOffsetX;
+
+ /**
+ * Burn-in prevention y translation.
+ */
private int mBurnInPreventionOffsetY;
/**
- * The number (fractional) of notifications the "more" card counts when calculating how many
- * notifications are currently visible for the y positioning of the clock.
+ * Doze/AOD transition amount.
*/
- private float mMoreCardNotificationAmount;
-
- private static final PathInterpolator sSlowDownInterpolator;
-
- static {
- Path path = new Path();
- path.moveTo(0, 0);
- path.cubicTo(0.3f, 0.875f, 0.6f, 1f, 1f, 1f);
- sSlowDownInterpolator = new PathInterpolator(path);
- }
-
- private AccelerateInterpolator mAccelerateInterpolator = new AccelerateInterpolator();
- private int mClockBottom;
private float mDarkAmount;
- private int mDozingStackPadding;
/**
* Refreshes the dimension values.
@@ -86,79 +114,95 @@ public class KeyguardClockPositionAlgorithm {
public void loadDimens(Resources res) {
mClockNotificationsMargin = res.getDimensionPixelSize(
R.dimen.keyguard_clock_notifications_margin);
- mClockYFractionMin = res.getFraction(R.fraction.keyguard_clock_y_fraction_min, 1, 1);
- mClockYFractionMax = res.getFraction(R.fraction.keyguard_clock_y_fraction_max, 1, 1);
- mMoreCardNotificationAmount =
- (float) res.getDimensionPixelSize(R.dimen.notification_shelf_height) /
- res.getDimensionPixelSize(R.dimen.notification_min_height);
- mDensity = res.getDisplayMetrics().density;
+ mContainerPadding = res.getDimensionPixelSize(
+ R.dimen.keyguard_clock_top_margin);
mBurnInPreventionOffsetX = res.getDimensionPixelSize(
R.dimen.burn_in_prevention_offset_x);
mBurnInPreventionOffsetY = res.getDimensionPixelSize(
R.dimen.burn_in_prevention_offset_y);
- mDozingStackPadding = res.getDimensionPixelSize(R.dimen.dozing_stack_padding);
}
- public void setup(int maxKeyguardNotifications, int maxPanelHeight, float expandedHeight,
- int notificationCount, int height, int keyguardStatusHeight, float emptyDragAmount,
- int clockBottom, float dark) {
- mMaxKeyguardNotifications = maxKeyguardNotifications;
- mMaxPanelHeight = maxPanelHeight;
+ public void setup(int minTopMargin, int maxShadeBottom, int notificationStackHeight,
+ float expandedHeight, float maxPanelHeight, int parentHeight, int keyguardStatusHeight,
+ float dark) {
+ mMinTopMargin = minTopMargin;
+ mMaxShadeBottom = maxShadeBottom;
+ mNotificationStackHeight = notificationStackHeight;
mExpandedHeight = expandedHeight;
- mNotificationCount = notificationCount;
- mHeight = height;
+ mMaxPanelHeight = maxPanelHeight;
+ mHeight = parentHeight;
mKeyguardStatusHeight = keyguardStatusHeight;
- mEmptyDragAmount = emptyDragAmount;
- mClockBottom = clockBottom;
mDarkAmount = dark;
- }
- public float getMinStackScrollerPadding(int height, int keyguardStatusHeight) {
- return mClockYFractionMin * height + keyguardStatusHeight / 2
- + mClockNotificationsMargin;
+ // Where the clock should stop when swiping up.
+ // This should be outside of the display when unlocked or
+ // under then status bar when the bouncer will be shown
+ mClockYTarget = -mKeyguardStatusHeight;
+ // TODO: on bouncer animation follow-up CL
+ // mClockYTarget = mMinTopMargin + mContainerPadding;
}
public void run(Result result) {
- int y = getClockY() - mKeyguardStatusHeight / 2;
- float clockAdjustment = getClockYExpansionAdjustment();
- float topPaddingAdjMultiplier = getTopPaddingAdjMultiplier();
- result.stackScrollerPaddingAdjustment = (int) (clockAdjustment*topPaddingAdjMultiplier);
+ final int y = getClockY();
result.clockY = y;
- int clockNotificationsPadding = mClockNotificationsMargin
- + result.stackScrollerPaddingAdjustment;
- int padding = y + clockNotificationsPadding;
- result.clockScale = getClockScale(mKeyguardStatusHeight + padding,
- y, y + mClockNotificationsMargin + mKeyguardStatusHeight);
- result.clockAlpha = getClockAlpha(result.clockScale);
-
- result.stackScrollerPadding = mClockBottom + y + mDozingStackPadding;
+ result.clockAlpha = getClockAlpha(y);
+ result.stackScrollerPadding = y + mKeyguardStatusHeight;
result.clockX = (int) interpolate(0, burnInPreventionOffsetX(), mDarkAmount);
}
- private float getClockScale(int notificationPadding, int clockY, int startPadding) {
- float scaleMultiplier = getNotificationAmountT() == 0 ? 6.0f : 5.0f;
- float scaleEnd = clockY - mKeyguardStatusHeight * scaleMultiplier;
- float distanceToScaleEnd = notificationPadding - scaleEnd;
- float progress = distanceToScaleEnd / (startPadding - scaleEnd);
- progress = Math.max(0.0f, Math.min(progress, 1.0f));
- progress = mAccelerateInterpolator.getInterpolation(progress);
- progress *= Math.pow(1 + mEmptyDragAmount / mDensity / 300, 0.3f);
- return interpolate(progress, 1, mDarkAmount);
+ public float getMinStackScrollerPadding() {
+ return mMinTopMargin + mKeyguardStatusHeight + mClockNotificationsMargin;
}
- private float getClockYFraction() {
- float t = getNotificationAmountT();
- t = Math.min(t, 1.0f);
- return MathUtils.lerp(mClockYFractionMax, mClockYFractionMin, t);
+ private int getMaxClockY() {
+ return mHeight / 2 - mKeyguardStatusHeight - mClockNotificationsMargin;
+ }
+
+ public int getExpandedClockBottom() {
+ return getExpandedClockPosition() + mKeyguardStatusHeight;
+ }
+
+ /**
+ * Vertically align the clock and the shade in the available space considering only
+ * a percentage of the clock height defined by {@code CLOCK_HEIGHT_WEIGHT}.
+ * @return Clock Y in pixels.
+ */
+ private int getExpandedClockPosition() {
+ final int availableHeight = mMaxShadeBottom - mMinTopMargin;
+ final int containerCenter = mMinTopMargin + availableHeight / 2;
+
+ float y = containerCenter - mKeyguardStatusHeight * CLOCK_HEIGHT_WEIGHT
+ - mClockNotificationsMargin - mNotificationStackHeight / 2;
+ if (y < mMinTopMargin + mContainerPadding) {
+ y = mMinTopMargin + mContainerPadding;
+ }
+
+ // Don't allow the clock base to be under half of the screen
+ final float maxClockY = getMaxClockY();
+ if (y > maxClockY) {
+ y = maxClockY;
+ }
+
+ return (int) y;
}
private int getClockY() {
// Dark: Align the bottom edge of the clock at about half of the screen:
- float clockYDark = (mClockYFractionMax * mHeight +
- (float) mKeyguardStatusHeight / 2 - mClockBottom)
- + burnInPreventionOffsetY();
- float clockYRegular = getClockYFraction() * mHeight;
- return (int) interpolate(clockYRegular, clockYDark, mDarkAmount);
+ final float clockYDark = getMaxClockY() + burnInPreventionOffsetY();
+ float clockYRegular = getExpandedClockPosition();
+
+ // Move clock up while collapsing the shade
+ final float shadeExpansion = mExpandedHeight / mMaxPanelHeight;
+ final float clockY = MathUtils.lerp(mClockYTarget, clockYRegular, shadeExpansion);
+
+ return (int) MathUtils.lerp(clockY, clockYDark, mDarkAmount);
+ }
+
+ private float getClockAlpha(int y) {
+ float alphaKeyguard = Math.max(0, Math.min(1, (y - mMinTopMargin)
+ / Math.max(1f, getExpandedClockPosition() - mMinTopMargin)));
+ alphaKeyguard = Interpolators.ACCELERATE.getInterpolation(alphaKeyguard);
+ return MathUtils.lerp(alphaKeyguard, 1f, mDarkAmount);
}
private float burnInPreventionOffsetY() {
@@ -190,62 +234,18 @@ public class KeyguardClockPositionAlgorithm {
return interpolate(0, amplitude, interpolationAmount);
}
- private float getClockYExpansionAdjustment() {
- float rubberbandFactor = getClockYExpansionRubberbandFactor();
- float value = (rubberbandFactor * (mMaxPanelHeight - mExpandedHeight));
- float t = value / mMaxPanelHeight;
- float slowedDownValue = -sSlowDownInterpolator.getInterpolation(t) * SLOW_DOWN_FACTOR
- * mMaxPanelHeight;
- if (mNotificationCount == 0) {
- return (-2*value + slowedDownValue)/3;
- } else {
- return slowedDownValue;
- }
- }
-
- private float getClockYExpansionRubberbandFactor() {
- float t = getNotificationAmountT();
- t = Math.min(t, 1.0f);
- t = (float) Math.pow(t, 0.3f);
- return (1 - t) * CLOCK_RUBBERBAND_FACTOR_MAX + t * CLOCK_RUBBERBAND_FACTOR_MIN;
- }
-
- private float getTopPaddingAdjMultiplier() {
- float t = getNotificationAmountT();
- t = Math.min(t, 1.0f);
- return (1 - t) * CLOCK_ADJ_TOP_PADDING_MULTIPLIER_MIN
- + t * CLOCK_ADJ_TOP_PADDING_MULTIPLIER_MAX;
- }
-
- private float getClockAlpha(float scale) {
- float fadeEnd = getNotificationAmountT() == 0.0f
- ? CLOCK_SCALE_FADE_END_NO_NOTIFS
- : CLOCK_SCALE_FADE_END;
- float alpha = (scale - fadeEnd)
- / (CLOCK_SCALE_FADE_START - fadeEnd);
- return Math.max(0, Math.min(1, alpha));
- }
-
- /**
- * @return a value from 0 to 1 depending on how many notification there are
- */
- private float getNotificationAmountT() {
- return mNotificationCount
- / (mMaxKeyguardNotifications + mMoreCardNotificationAmount);
- }
-
public static class Result {
+ /**
+ * The x translation of the clock.
+ */
+ public int clockX;
+
/**
* The y translation of the clock.
*/
public int clockY;
- /**
- * The scale of the Clock
- */
- public float clockScale;
-
/**
* The alpha value of the clock.
*/
@@ -255,14 +255,5 @@ public class KeyguardClockPositionAlgorithm {
* The top padding of the stack scroller, in pixels.
*/
public int stackScrollerPadding;
-
- /**
- * The top padding adjustment of the stack scroller, in pixels. This value is used to adjust
- * the padding, but not the overall panel size.
- */
- public int stackScrollerPaddingAdjustment;
-
- /** The x translation of the clock. */
- public int clockX;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 3b129fc5e08d1..51d094e5f8b08 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -37,6 +37,7 @@ import android.graphics.Rect;
import android.os.PowerManager;
import android.util.AttributeSet;
import android.util.FloatProperty;
+import android.util.Log;
import android.util.MathUtils;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -172,7 +173,6 @@ public class NotificationPanelView extends PanelView implements
private Animator mClockAnimator;
private int mClockAnimationTargetX = Integer.MIN_VALUE;
private int mClockAnimationTargetY = Integer.MIN_VALUE;
- private int mTopPaddingAdjustment;
private KeyguardClockPositionAlgorithm mClockPositionAlgorithm =
new KeyguardClockPositionAlgorithm();
private KeyguardClockPositionAlgorithm.Result mClockPositionResult =
@@ -244,6 +244,7 @@ public class NotificationPanelView extends PanelView implements
private int mQsNotificationTopPadding;
private float mExpandOffset;
private boolean mHideIconsDuringNotificationLaunch = true;
+ private int mStackScrollerMeasuringPass;
public NotificationPanelView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -459,17 +460,17 @@ public class NotificationPanelView extends PanelView implements
if (mStatusBarState != StatusBarState.KEYGUARD) {
stackScrollerPadding = (mQs != null ? mQs.getHeader().getHeight() : 0) + mQsPeekHeight
+ mQsNotificationTopPadding;
- mTopPaddingAdjustment = 0;
} else {
+ final int totalHeight = getHeight();
+ final int bottomPadding = Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding);
mClockPositionAlgorithm.setup(
- mStatusBar.getMaxNotificationsWhileLocked(),
- getMaxPanelHeight(),
+ mStatusBarMinHeight,
+ totalHeight - bottomPadding,
+ calculatePanelHeightShade() - mNotificationStackScroller.getTopPadding(),
getExpandedHeight(),
- mNotificationStackScroller.getNotGoneChildCount(),
- getHeight(),
+ getMaxPanelHeight(),
+ totalHeight,
mKeyguardStatusView.getHeight(),
- mEmptyDragAmount,
- mKeyguardStatusView.getClockBottom(),
mDarkAmount);
mClockPositionAlgorithm.run(mClockPositionResult);
if (animate || mClockAnimator != null) {
@@ -478,14 +479,16 @@ public class NotificationPanelView extends PanelView implements
mKeyguardStatusView.setX(mClockPositionResult.clockX);
mKeyguardStatusView.setY(mClockPositionResult.clockY);
}
- updateClock(mClockPositionResult.clockAlpha, mClockPositionResult.clockScale);
+ updateClock();
stackScrollerPadding = mClockPositionResult.stackScrollerPadding;
- mTopPaddingAdjustment = mClockPositionResult.stackScrollerPaddingAdjustment;
}
mNotificationStackScroller.setIntrinsicPadding(stackScrollerPadding);
mNotificationStackScroller.setAntiBurnInOffsetX(mClockPositionResult.clockX);
mKeyguardBottomArea.setBurnInXOffset(mClockPositionResult.clockX);
+
+ mStackScrollerMeasuringPass++;
requestScrollerTopPaddingUpdate(animate);
+ mStackScrollerMeasuringPass = 0;
}
/**
@@ -493,8 +496,7 @@ public class NotificationPanelView extends PanelView implements
* @return the maximum keyguard notifications that can fit on the screen
*/
public int computeMaxKeyguardNotifications(int maximum) {
- float minPadding = mClockPositionAlgorithm.getMinStackScrollerPadding(getHeight(),
- mKeyguardStatusView.getHeight());
+ float minPadding = mClockPositionAlgorithm.getMinStackScrollerPadding();
int notificationPadding = Math.max(1, getResources().getDimensionPixelSize(
R.dimen.notification_divider_height));
NotificationShelf shelf = mNotificationStackScroller.getNotificationShelf();
@@ -579,12 +581,10 @@ public class NotificationPanelView extends PanelView implements
});
}
- private void updateClock(float alpha, float scale) {
+ private void updateClock() {
if (!mKeyguardStatusViewAnimating) {
- mKeyguardStatusView.setAlpha(alpha * mQsClockAlphaOverride);
+ mKeyguardStatusView.setAlpha(mClockPositionResult.clockAlpha * mQsClockAlphaOverride);
}
- mKeyguardStatusView.setScaleX(scale);
- mKeyguardStatusView.setScaleY(scale);
}
public void animateToFullShade(long delay) {
@@ -1316,7 +1316,7 @@ public class NotificationPanelView extends PanelView implements
newClockAlpha = 1 - MathUtils.constrain(newClockAlpha, 0, 1);
if (newClockAlpha != mQsClockAlphaOverride) {
mQsClockAlphaOverride = Interpolators.ALPHA_OUT.getInterpolation(newClockAlpha);
- updateClock(mClockPositionResult.clockAlpha, mClockPositionResult.clockScale);
+ updateClock();
}
if (mAccessibilityManager.isEnabled()) {
@@ -1356,15 +1356,15 @@ public class NotificationPanelView extends PanelView implements
&& (mQsExpandImmediate || mIsExpanding && mQsExpandedWhenExpandingStarted)) {
// Either QS pushes the notifications down when fully expanded, or QS is fully above the
- // notifications (mostly on tablets). maxNotifications denotes the normal top padding
- // on Keyguard, maxQs denotes the top padding from the quick settings panel. We need to
- // take the maximum and linearly interpolate with the panel expansion for a nice motion.
- int maxNotifications = mClockPositionResult.stackScrollerPadding
- - mClockPositionResult.stackScrollerPaddingAdjustment;
- int maxQs = mQsMaxExpansionHeight + mQsNotificationTopPadding;
+ // notifications (mostly on tablets). maxNotificationPadding denotes the normal top
+ // padding on Keyguard, maxQsPadding denotes the top padding from the quick settings
+ // panel. We need to take the maximum and linearly interpolate with the panel expansion
+ // for a nice motion.
+ int maxNotificationPadding = mClockPositionResult.stackScrollerPadding;
+ int maxQsPadding = mQsMaxExpansionHeight + mQsNotificationTopPadding;
int max = mStatusBarState == StatusBarState.KEYGUARD
- ? Math.max(maxNotifications, maxQs)
- : maxQs;
+ ? Math.max(maxNotificationPadding, maxQsPadding)
+ : maxQsPadding;
return (int) interpolate(getExpandedFraction(),
mQsMinExpansionHeight, max);
} else if (mQsSizeChangeAnimator != null) {
@@ -1507,7 +1507,7 @@ public class NotificationPanelView extends PanelView implements
if (mQsExpandImmediate || mQsExpanded || mIsExpanding && mQsExpandedWhenExpandingStarted) {
maxHeight = calculatePanelHeightQsExpanded();
} else {
- maxHeight = calculatePanelHeightShade();
+ maxHeight = Math.max(calculatePanelHeightShade(), calculatePanelHeightShadeExpanded());
}
maxHeight = Math.max(maxHeight, min);
return maxHeight;
@@ -1524,7 +1524,15 @@ public class NotificationPanelView extends PanelView implements
@Override
protected void onHeightUpdated(float expandedHeight) {
if (!mQsExpanded || mQsExpandImmediate || mIsExpanding && mQsExpandedWhenExpandingStarted) {
- positionClockAndNotifications();
+ // Updating the clock position will set the top padding which might
+ // trigger a new panel height and re-position the clock.
+ // This is a circular dependency and should be avoided, otherwise we'll have
+ // a stack overflow.
+ if (mStackScrollerMeasuringPass > 2) {
+ if (DEBUG) Log.d(TAG, "Unstable notification panel height. Aborting.");
+ } else {
+ positionClockAndNotifications();
+ }
}
if (mQsExpandImmediate || mQsExpanded && !mQsTracking && mQsExpansionAnimator == null
&& !mQsExpansionFromOverscroll) {
@@ -1568,12 +1576,18 @@ public class NotificationPanelView extends PanelView implements
private int calculatePanelHeightShade() {
int emptyBottomMargin = mNotificationStackScroller.getEmptyBottomMargin();
- int maxHeight = mNotificationStackScroller.getHeight() - emptyBottomMargin
- - mTopPaddingAdjustment;
+ int maxHeight = mNotificationStackScroller.getHeight() - emptyBottomMargin;
maxHeight += mNotificationStackScroller.getTopPaddingOverflow();
return maxHeight;
}
+ private int calculatePanelHeightShadeExpanded() {
+ return mNotificationStackScroller.getHeight()
+ - mNotificationStackScroller.getEmptyBottomMargin()
+ - mNotificationStackScroller.getTopPadding()
+ + mClockPositionAlgorithm.getExpandedClockBottom();
+ }
+
private int calculatePanelHeightQsExpanded() {
float notificationHeight = mNotificationStackScroller.getHeight()
- mNotificationStackScroller.getEmptyBottomMargin()
@@ -1598,8 +1612,7 @@ public class NotificationPanelView extends PanelView implements
}
float totalHeight = Math.max(
maxQsHeight, mStatusBarState == StatusBarState.KEYGUARD
- ? mClockPositionResult.stackScrollerPadding - mTopPaddingAdjustment
- : 0)
+ ? mClockPositionResult.stackScrollerPadding : 0)
+ notificationHeight + mNotificationStackScroller.getTopPaddingOverflow();
if (totalHeight > mNotificationStackScroller.getHeight()) {
float fullyCollapsedHeight = maxQsHeight
@@ -2272,8 +2285,9 @@ public class NotificationPanelView extends PanelView implements
}
@Override
- protected void dispatchDraw(Canvas canvas) {
- super.dispatchDraw(canvas);
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+
if (DEBUG) {
Paint p = new Paint();
p.setColor(Color.RED);
@@ -2288,6 +2302,9 @@ public class NotificationPanelView extends PanelView implements
p.setColor(Color.YELLOW);
canvas.drawLine(0, calculatePanelHeightShade(), getWidth(),
calculatePanelHeightShade(), p);
+ p.setColor(Color.GRAY);
+ canvas.drawLine(0, calculatePanelHeightShadeExpanded(), getWidth(),
+ calculatePanelHeightShadeExpanded(), p);
p.setColor(Color.MAGENTA);
canvas.drawLine(0, calculateQsTopPadding(), getWidth(),
calculateQsTopPadding(), p);