diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 84ca657f3da5d..ceff6e04d0d23 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -136,6 +136,10 @@
views where the distance can't be measured -->
15dp
+
+ 9dp
+
32dp
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
index 0112661cf9fc3..6364f5b63e881 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
@@ -17,7 +17,6 @@
package com.android.systemui.statusbar;
import static com.android.systemui.statusbar.phone.NotificationIconContainer.IconState.NO_VALUE;
-import static com.android.systemui.statusbar.phone.NotificationIconContainer.OVERFLOW_EARLY_AMOUNT;
import android.content.Context;
import android.content.res.Configuration;
@@ -26,6 +25,7 @@ import android.graphics.Rect;
import android.os.SystemProperties;
import android.util.AttributeSet;
import android.util.Log;
+import android.util.MathUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
@@ -58,6 +58,8 @@ public class NotificationShelf extends ActivatableNotificationView implements
= SystemProperties.getBoolean("debug.icon_scroll_animations", true);
private static final int TAG_CONTINUOUS_CLIPPING = R.id.continuous_clipping_tag;
private static final String TAG = "NotificationShelf";
+ private static final long SHELF_IN_TRANSLATION_DURATION = 220;
+
private ViewInvertHelper mViewInvertHelper;
private boolean mDark;
private NotificationIconContainer mShelfIcons;
@@ -65,6 +67,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
private int[] mTmp = new int[2];
private boolean mHideBackground;
private int mIconAppearTopPadding;
+ private int mShelfAppearTranslation;
private int mStatusBarHeight;
private int mStatusBarPaddingStart;
private AmbientState mAmbientState;
@@ -120,6 +123,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
mStatusBarHeight = res.getDimensionPixelOffset(R.dimen.status_bar_height);
mStatusBarPaddingStart = res.getDimensionPixelOffset(R.dimen.status_bar_padding_start);
mPaddingBetweenElements = res.getDimensionPixelSize(R.dimen.notification_divider_height);
+ mShelfAppearTranslation = res.getDimensionPixelSize(R.dimen.shelf_appear_translation);
ViewGroup.LayoutParams layoutParams = getLayoutParams();
layoutParams.height = res.getDimensionPixelOffset(R.dimen.notification_shelf_height);
@@ -151,6 +155,18 @@ public class NotificationShelf extends ActivatableNotificationView implements
updateInteractiveness();
}
+ public void fadeInTranslating() {
+ float translation = mShelfIcons.getTranslationY();
+ mShelfIcons.setTranslationY(translation + mShelfAppearTranslation);
+ mShelfIcons.setAlpha(0);
+ mShelfIcons.animate()
+ .alpha(1)
+ .setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN)
+ .translationY(translation)
+ .setDuration(SHELF_IN_TRANSLATION_DURATION)
+ .start();
+ }
+
@Override
protected View getContentView() {
return mShelfIcons;
@@ -175,12 +191,14 @@ public class NotificationShelf extends ActivatableNotificationView implements
float viewEnd = lastViewState.yTranslation + lastViewState.height;
mShelfState.copyFrom(lastViewState);
mShelfState.height = getIntrinsicHeight();
- mShelfState.yTranslation = Math.max(Math.min(viewEnd, maxShelfEnd) - mShelfState.height,
+
+ float awakenTranslation = Math.max(Math.min(viewEnd, maxShelfEnd) - mShelfState.height,
getFullyClosedTranslation());
+ float darkTranslation = mAmbientState.getDarkTopPadding();
+ float yRatio = mAmbientState.hasPulsingNotifications() ?
+ 0 : mAmbientState.getDarkAmount();
+ mShelfState.yTranslation = MathUtils.lerp(awakenTranslation, darkTranslation, yRatio);
mShelfState.zTranslation = ambientState.getBaseZHeight();
- if (mAmbientState.isDark() && !mAmbientState.hasPulsingNotifications()) {
- mShelfState.yTranslation = mAmbientState.getDarkTopPadding();
- }
float openedAmount = (mShelfState.yTranslation - getFullyClosedTranslation())
/ (getIntrinsicHeight() * 2);
openedAmount = Math.min(1.0f, openedAmount);
@@ -555,7 +573,9 @@ public class NotificationShelf extends ActivatableNotificationView implements
iconState.translateContent = false;
}
float transitionAmount;
- if (isLastChild || !USE_ANIMATIONS_WHEN_OPENING || iconState.useFullTransitionAmount
+ if (mAmbientState.getDarkAmount() > 0 && !row.isInShelf()) {
+ transitionAmount = mAmbientState.isFullyDark() ? 1 : 0;
+ } else if (isLastChild || !USE_ANIMATIONS_WHEN_OPENING || iconState.useFullTransitionAmount
|| iconState.useLinearTransitionAmount) {
transitionAmount = iconTransitionAmount;
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java
index 7c1c566a57bf3..91a4b07c21097 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java
@@ -70,8 +70,8 @@ public class AmbientState {
private int mIntrinsicPadding;
private int mExpandAnimationTopChange;
private ExpandableNotificationRow mExpandingNotification;
- private boolean mFullyDark;
private int mDarkTopPadding;
+ private float mDarkAmount;
public AmbientState(Context context) {
reload(context);
@@ -149,6 +149,16 @@ public class AmbientState {
mDark = dark;
}
+ /** Dark ratio of the status bar **/
+ public void setDarkAmount(float darkAmount) {
+ mDarkAmount = darkAmount;
+ }
+
+ /** Returns the dark ratio of the status bar */
+ public float getDarkAmount() {
+ return mDarkAmount;
+ }
+
public void setHideSensitive(boolean hideSensitive) {
mHideSensitive = hideSensitive;
}
@@ -412,18 +422,11 @@ public class AmbientState {
return mExpandAnimationTopChange;
}
- /**
- * {@see isFullyDark}
- */
- public void setFullyDark(boolean fullyDark) {
- mFullyDark = fullyDark;
- }
-
/**
* @return {@code true } when shade is completely dark: in AOD or ambient display.
*/
public boolean isFullyDark() {
- return mFullyDark;
+ return mDarkAmount == 1;
}
public void setDarkTopPadding(int darkTopPadding) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index d282f259df812..bc5a848f9f2a5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -96,6 +96,7 @@ import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.notification.FakeShadowView;
import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.notification.VisibilityLocationProvider;
+import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.ScrimController;
@@ -269,8 +270,6 @@ public class NotificationStackScrollLayout extends ViewGroup
*/
private boolean mOnlyScrollingInThisMotion;
private boolean mDisallowDismissInThisMotion;
- private boolean mInterceptDelegateEnabled;
- private boolean mDelegateToScrollView;
private boolean mDisallowScrollingInThisMotion;
private long mGoToFullShadeDelay;
private ViewTreeObserver.OnPreDrawListener mChildrenUpdater
@@ -562,17 +561,17 @@ public class NotificationStackScrollLayout extends ViewGroup
return;
}
- final int color;
- if (mAmbientState.isDark()) {
- color = Color.WHITE;
- } else {
- float alpha =
- BACKGROUND_ALPHA_DIMMED + (1 - BACKGROUND_ALPHA_DIMMED) * (1.0f - mDimAmount);
- alpha *= 1f - mDarkAmount;
- // We need to manually blend in the background color
- int scrimColor = mScrimController.getBackgroundColor();
- color = ColorUtils.blendARGB(scrimColor, mBgColor, alpha);
- }
+ float alpha =
+ BACKGROUND_ALPHA_DIMMED + (1 - BACKGROUND_ALPHA_DIMMED) * (1.0f - mDimAmount);
+ alpha *= 1f - mDarkAmount;
+ // We need to manually blend in the background color.
+ int scrimColor = mScrimController.getBackgroundColor();
+ int awakeColor = ColorUtils.blendARGB(scrimColor, mBgColor, alpha);
+
+ // Interpolate between semi-transparent notification panel background color
+ // and white AOD separator.
+ float colorInterpolation = Interpolators.DECELERATE_QUINT.getInterpolation(mDarkAmount);
+ int color = ColorUtils.blendARGB(awakeColor, Color.WHITE, colorInterpolation);
if (mCachedBackgroundColor != color) {
mCachedBackgroundColor = color;
@@ -3961,13 +3960,18 @@ public class NotificationStackScrollLayout extends ViewGroup
private void setDarkAmount(float darkAmount) {
mDarkAmount = darkAmount;
- final boolean fullyDark = darkAmount == 1;
- if (mAmbientState.isFullyDark() != fullyDark) {
- mAmbientState.setFullyDark(fullyDark);
+ boolean wasFullyDark = mAmbientState.isFullyDark();
+ mAmbientState.setDarkAmount(darkAmount);
+ if (mAmbientState.isFullyDark() != wasFullyDark) {
updateContentHeight();
+ DozeParameters dozeParameters = DozeParameters.getInstance(mContext);
+ if (mAmbientState.isFullyDark() && dozeParameters.shouldControlScreenOff()) {
+ mShelf.fadeInTranslating();
+ }
}
updateBackgroundDimming();
updateAntiBurnInTranslation();
+ requestChildrenUpdate();
}
public float getDarkAmount() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
index a8d2d98b6f2b9..f4d7f8d48a669 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
@@ -276,8 +276,6 @@ public class StackScrollAlgorithm {
if (i >= firstHiddenIndex) {
// we need normal padding now, to be in sync with what the stack calculates
lastView = null;
- ExpandableViewState viewState = resultState.getViewStateForView(v);
- viewState.hidden = true;
}
notGoneIndex = updateNotGoneIndex(resultState, state, notGoneIndex, v);
float increasedPadding = v.getIncreasedPaddingAmount();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayoutTest.java
index cd3031bbb787d..dd2b58169eb85 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayoutTest.java
@@ -97,6 +97,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
doNothing().when(mGroupManager).collapseAllGroups();
doNothing().when(mExpandHelper).cancelImmediately();
doNothing().when(notificationShelf).setAnimationsEnabled(anyBoolean());
+ doNothing().when(notificationShelf).fadeInTranslating();
}
@Test