Not rendering the dark icons with the shelf anymore

Instead it is rendered by a dedicated container.
This will help with a lot of the transitions that
are necessary for the bypass and also fixes the
coloring of the notification icons on the lockscreen.

Fixes: 133869048
Bug: 130327302
Bug: 133182504
Test: atest SystemUITests
Change-Id: I422b3da488fdac6577173d41b26c67f81c7826c5
(cherry picked from commit 195dfc5db60fc913d060a692dc4ee7b0b02ece68)
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml
index 04d6afc..a983b05 100644
--- a/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml
+++ b/packages/SystemUI/res-keyguard/layout/keyguard_status_view.xml
@@ -25,14 +25,11 @@
     android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    androidprv:layout_maxWidth="@dimen/keyguard_security_width"
-    androidprv:layout_maxHeight="@dimen/keyguard_security_height"
     android:gravity="center_horizontal|top">
     <LinearLayout
         android:id="@+id/status_view_container"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginBottom="@dimen/widget_vertical_padding"
         android:orientation="vertical">
         <TextView
             android:id="@+id/logout"
@@ -71,5 +68,11 @@
             android:letterSpacing="0.05"
             android:ellipsize="marquee"
             android:singleLine="true" />
+        <com.android.systemui.statusbar.phone.NotificationIconContainer
+            android:id="@+id/clock_notification_icon_container"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/notification_shelf_height"
+            android:layout_marginTop="18dp"
+        />
     </LinearLayout>
 </com.android.keyguard.KeyguardStatusView>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index c5e4662..afe6d9c 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -258,8 +258,8 @@
     <!-- size at which Notification icons will be drawn on Ambient Display -->
     <dimen name="status_bar_icon_drawing_size_dark">@*android:dimen/notification_header_icon_size_ambient</dimen>
 
-    <!-- size of notification icons on AOD -->
-    <dimen name="dark_shelf_icon_size">16dp</dimen>
+    <!-- size of notification icons when the notifications are hidden -->
+    <dimen name="hidden_shelf_icon_size">16dp</dimen>
 
     <!-- opacity at which Notification icons will be drawn in the status bar -->
     <item type="dimen" name="status_bar_icon_drawing_alpha">90%</item>
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index 09d4b05..7b58c5d 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -515,7 +515,7 @@
         viewState.gone = false;
         viewState.hidden = false;
         viewState.dimmed = false;
-        viewState.dark = false;
+        viewState.dozing = false;
         viewState.alpha = 1f;
         viewState.notGoneIndex = -1;
         viewState.xTranslation = 0;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
index 1779b32..9ffb78c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
@@ -63,15 +63,12 @@
             = 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 = 200;
 
     private NotificationIconContainer mShelfIcons;
     private int[] mTmp = new int[2];
     private boolean mHideBackground;
     private int mIconAppearTopPadding;
-    private int mShelfAppearTranslation;
-    private float mDarkShelfPadding;
-    private float mDarkShelfIconSize;
+    private float mHiddenShelfIconSize;
     private int mStatusBarHeight;
     private int mStatusBarPaddingStart;
     private AmbientState mAmbientState;
@@ -140,8 +137,6 @@
         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);
-        mDarkShelfPadding = res.getDimensionPixelSize(R.dimen.widget_bottom_separator_padding);
 
         ViewGroup.LayoutParams layoutParams = getLayoutParams();
         layoutParams.height = res.getDimensionPixelOffset(R.dimen.notification_shelf_height);
@@ -152,7 +147,7 @@
         mScrollFastThreshold = res.getDimensionPixelOffset(R.dimen.scroll_fast_threshold);
         mShowNotificationShelf = res.getBoolean(R.bool.config_showNotificationShelf);
         mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size);
-        mDarkShelfIconSize = res.getDimensionPixelOffset(R.dimen.dark_shelf_icon_size);
+        mHiddenShelfIconSize = res.getDimensionPixelOffset(R.dimen.hidden_shelf_icon_size);
         mGapHeight = res.getDimensionPixelSize(R.dimen.qs_notification_padding);
 
         if (!mShowNotificationShelf) {
@@ -167,33 +162,6 @@
     }
 
     @Override
-    public void setDark(boolean dark, boolean fade, long delay) {
-        if (mDark == dark) return;
-        super.setDark(dark, fade, delay);
-        mShelfIcons.setDark(dark, fade, delay);
-        updateInteractiveness();
-        updateOutline();
-    }
-
-    /**
-     * Alpha animation with translation played when this view is visible on AOD.
-     */
-    public void fadeInTranslating() {
-        mShelfIcons.setTranslationY(-mShelfAppearTranslation);
-        mShelfIcons.setAlpha(0);
-        mShelfIcons.animate()
-                .setInterpolator(Interpolators.DECELERATE_QUINT)
-                .translationY(0)
-                .setDuration(SHELF_IN_TRANSLATION_DURATION)
-                .start();
-        mShelfIcons.animate()
-                .alpha(1)
-                .setInterpolator(Interpolators.LINEAR)
-                .setDuration(SHELF_IN_TRANSLATION_DURATION)
-                .start();
-    }
-
-    @Override
     protected View getContentView() {
         return mShelfIcons;
     }
@@ -219,11 +187,8 @@
             viewState.copyFrom(lastViewState);
             viewState.height = getIntrinsicHeight();
 
-            float awakenTranslation = Math.max(Math.min(viewEnd, maxShelfEnd) - viewState.height,
+            viewState.yTranslation = Math.max(Math.min(viewEnd, maxShelfEnd) - viewState.height,
                     getFullyClosedTranslation());
-            float yRatio = mAmbientState.hasPulsingNotifications() ?
-                    0 : mAmbientState.getDarkAmount();
-            viewState.yTranslation = awakenTranslation + mDarkShelfPadding * yRatio;
             viewState.zTranslation = ambientState.getBaseZHeight();
             // For the small display size, it's not enough to make the icon not covered by
             // the top cutout so the denominator add the height of cutout.
@@ -452,7 +417,7 @@
         }
         StatusBarIconView icon = row.getEntry().expandedIcon;
         float shelfIconPosition = getTranslationY() + icon.getTop() + icon.getTranslationY();
-        if (shelfIconPosition < maxTop && !mAmbientState.isFullyDark()) {
+        if (shelfIconPosition < maxTop && !mAmbientState.isFullyHidden()) {
             int top = (int) (maxTop - shelfIconPosition);
             Rect clipRect = new Rect(0, top, icon.getWidth(), Math.max(top, icon.getHeight()));
             icon.setClipBounds(clipRect);
@@ -666,8 +631,8 @@
             iconState.translateContent = false;
         }
         float transitionAmount;
-        if (mAmbientState.isDarkAtAll() && !row.isInShelf()) {
-            transitionAmount = mAmbientState.isFullyDark() ? 1 : 0;
+        if (mAmbientState.isHiddenAtAll() && !row.isInShelf()) {
+            transitionAmount = mAmbientState.isFullyHidden() ? 1 : 0;
         } else if (isLastChild || !USE_ANIMATIONS_WHEN_OPENING || iconState.useFullTransitionAmount
                 || iconState.useLinearTransitionAmount) {
             transitionAmount = iconTransitionAmount;
@@ -717,7 +682,7 @@
         }
         notificationIconPosition += iconTopPadding;
         float shelfIconPosition = getTranslationY() + icon.getTop();
-        float iconSize = mDark ? mDarkShelfIconSize : mIconSize;
+        float iconSize = mDozing ? mHiddenShelfIconSize : mIconSize;
         shelfIconPosition += (icon.getHeight() - icon.getIconScale() * iconSize) / 2.0f;
         float iconYTranslation = NotificationUtils.interpolate(
                 notificationIconPosition - shelfIconPosition,
@@ -794,12 +759,12 @@
 
     @Override
     protected boolean needsOutline() {
-        return !mHideBackground && !mDark && super.needsOutline();
+        return !mHideBackground && super.needsOutline();
     }
 
     @Override
     protected boolean shouldHideBackground() {
-        return super.shouldHideBackground() || mHideBackground || mDark;
+        return super.shouldHideBackground() || mHideBackground;
     }
 
     @Override
@@ -910,8 +875,7 @@
     }
 
     private void updateInteractiveness() {
-        mInteractive = mStatusBarState == StatusBarState.KEYGUARD && mHasItemsInStableShelf
-                && !mDark;
+        mInteractive = mStatusBarState == StatusBarState.KEYGUARD && mHasItemsInStableShelf;
         setClickable(mInteractive);
         setFocusable(mInteractive);
         setImportantForAccessibility(mInteractive ? View.IMPORTANT_FOR_ACCESSIBILITY_YES
@@ -929,7 +893,6 @@
 
     public void setAnimationsEnabled(boolean enabled) {
         mAnimationsEnabled = enabled;
-        mCollapsedIcons.setAnimationsEnabled(enabled);
         if (!enabled) {
             // we need to wait with enabling the animations until the first frame has passed
             mShelfIcons.setAnimationsEnabled(false);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index 6552fe6..f4af9ae 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -112,7 +112,7 @@
     };
 
     private boolean mAlwaysScaleIcon;
-    private int mStatusBarIconDrawingSizeDark = 1;
+    private int mStatusBarIconDrawingSizeIncreased = 1;
     private int mStatusBarIconDrawingSize = 1;
     private int mStatusBarIconSize = 1;
     private StatusBarIcon mIcon;
@@ -139,7 +139,7 @@
     private int mDrawableColor;
     private int mIconColor;
     private int mDecorColor;
-    private float mDarkAmount;
+    private float mDozeAmount;
     private ValueAnimator mColorAnimator;
     private int mCurrentSetColor = NO_COLOR;
     private int mAnimationStartColor = NO_COLOR;
@@ -158,6 +158,7 @@
     private Runnable mLayoutRunnable;
     private boolean mDismissed;
     private Runnable mOnDismissListener;
+    private boolean mIncreasedSize;
 
     public StatusBarIconView(Context context, String slot, StatusBarNotification sbn) {
         this(context, slot, sbn, false);
@@ -196,12 +197,10 @@
     }
 
     private void updateIconScaleForNotifications() {
-        final float imageBounds = NotificationUtils.interpolate(
-                mStatusBarIconDrawingSize,
-                mStatusBarIconDrawingSizeDark,
-                mDarkAmount);
+        final float imageBounds = mIncreasedSize ?
+                mStatusBarIconDrawingSizeIncreased : mStatusBarIconDrawingSize;
         final int outerBounds = mStatusBarIconSize;
-        mIconScale = (float)imageBounds / (float)outerBounds;
+        mIconScale = imageBounds / (float)outerBounds;
         updatePivot();
     }
 
@@ -225,8 +224,8 @@
         }
     }
 
-    public float getIconScaleFullyDark() {
-        return (float) mStatusBarIconDrawingSizeDark / mStatusBarIconDrawingSize;
+    public float getIconScaleIncreased() {
+        return (float) mStatusBarIconDrawingSizeIncreased / mStatusBarIconDrawingSize;
     }
 
     public float getIconScale() {
@@ -256,7 +255,7 @@
         Resources res = getResources();
         mStaticDotRadius = res.getDimensionPixelSize(R.dimen.overflow_dot_radius);
         mStatusBarIconSize = res.getDimensionPixelSize(R.dimen.status_bar_icon_size);
-        mStatusBarIconDrawingSizeDark =
+        mStatusBarIconDrawingSizeIncreased =
                 res.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size_dark);
         mStatusBarIconDrawingSize =
                 res.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size);
@@ -584,7 +583,7 @@
     }
 
     private void updateDecorColor() {
-        int color = NotificationUtils.interpolateColors(mDecorColor, Color.WHITE, mDarkAmount);
+        int color = NotificationUtils.interpolateColors(mDecorColor, Color.WHITE, mDozeAmount);
         if (mDotPaint.getColor() != color) {
             mDotPaint.setColor(color);
 
@@ -618,13 +617,13 @@
                 mMatrixColorFilter = new ColorMatrixColorFilter(mMatrix);
             }
             int color = NotificationUtils.interpolateColors(
-                    mCurrentSetColor, Color.WHITE, mDarkAmount);
-            updateTintMatrix(mMatrix, color, DARK_ALPHA_BOOST * mDarkAmount);
+                    mCurrentSetColor, Color.WHITE, mDozeAmount);
+            updateTintMatrix(mMatrix, color, DARK_ALPHA_BOOST * mDozeAmount);
             mMatrixColorFilter.setColorMatrixArray(mMatrix);
             setColorFilter(null);  // setColorFilter only invalidates if the instance changed.
             setColorFilter(mMatrixColorFilter);
         } else {
-            mDozer.updateGrayscale(this, mDarkAmount);
+            mDozer.updateGrayscale(this, mDozeAmount);
         }
     }
 
@@ -855,19 +854,18 @@
         mOnVisibilityChangedListener = listener;
     }
 
-    public void setDark(boolean dark, boolean fade, long delay) {
-        mDozer.setIntensityDark(f -> {
-            mDarkAmount = f;
-            maybeUpdateIconScaleDimens();
+    public void setDozing(boolean dozing, boolean fade, long delay) {
+        mDozer.setDozing(f -> {
+            mDozeAmount = f;
             updateDecorColor();
             updateIconColor();
             updateAllowAnimation();
-        }, dark, fade, delay, this);
+        }, dozing, fade, delay, this);
     }
 
     private void updateAllowAnimation() {
-        if (mDarkAmount == 0 || mDarkAmount == 1) {
-            setAllowAnimation(mDarkAmount == 0);
+        if (mDozeAmount == 0 || mDozeAmount == 1) {
+            setAllowAnimation(mDozeAmount == 0);
         }
     }
 
@@ -949,6 +947,11 @@
         return mBlocked;
     }
 
+    public void setIncreasedSize(boolean increasedSize) {
+        mIncreasedSize = increasedSize;
+        maybeUpdateIconScaleDimens();
+    }
+
     public interface OnVisibilityChangedListener {
         void onVisibilityChanged(int newVisibility);
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationDozeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationDozeHelper.java
index ef042ba..63bb73a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationDozeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationDozeHelper.java
@@ -79,10 +79,11 @@
         animator.start();
     }
 
-    public void setIntensityDark(Consumer<Float> listener, boolean dark,
+    public void setDozing(Consumer<Float> listener, boolean dozing,
             boolean animate, long delay, View view) {
         if (animate) {
-            startIntensityAnimation(a -> listener.accept((Float) a.getAnimatedValue()), dark, delay,
+            startIntensityAnimation(a -> listener.accept((Float) a.getAnimatedValue()), dozing,
+                    delay,
                     new AnimatorListenerAdapter() {
 
                         @Override
@@ -100,7 +101,7 @@
             if (animator != null) {
                 animator.cancel();
             }
-            listener.accept(dark ? 1f : 0f);
+            listener.accept(dozing ? 1f : 0f);
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt
index 3613f9f..0fa6842 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt
@@ -28,6 +28,7 @@
 import com.android.systemui.statusbar.notification.stack.StackStateAnimator
 import com.android.systemui.statusbar.phone.DozeParameters
 import com.android.systemui.statusbar.phone.KeyguardBypassController
+import com.android.systemui.statusbar.phone.NotificationIconAreaController
 
 import javax.inject.Inject
 import javax.inject.Singleton
@@ -59,7 +60,7 @@
     private var mNotificationVisibleAmount = 0.0f
     private var mNotificationsVisible = false
     private var mNotificationsVisibleForExpansion = false
-    private var mDarkAnimator: ObjectAnimator? = null
+    private var mVisibilityAnimator: ObjectAnimator? = null
     private var mVisibilityAmount = 0.0f
     private var mLinearVisibilityAmount = 0.0f
     private var mWakingUp = false
@@ -72,6 +73,8 @@
             }
         }
 
+    lateinit var iconAreaController : NotificationIconAreaController
+
     var pulsing: Boolean = false
         set(value) {
             field = value
@@ -129,7 +132,7 @@
             return
         }
         mNotificationsVisible = visible
-        mDarkAnimator?.cancel();
+        mVisibilityAnimator?.cancel();
         if (animate) {
             notifyAnimationStart(visible)
             startVisibilityAnimation(increaseSpeed)
@@ -155,7 +158,7 @@
         mLinearDozeAmount = linear
         mDozeAmount = eased
         mStackScroller.setDozeAmount(mDozeAmount)
-        updateDarkAmount()
+        updateHideAmount()
         if (changed && linear == 0.0f) {
             setNotificationsVisible(visible = false, animate = false, increaseSpeed = false);
             setNotificationsVisibleForExpansion(visible = false, animate = false,
@@ -188,15 +191,15 @@
                 Interpolators.FAST_OUT_SLOW_IN_REVERSE
         }
         val target = if (mNotificationsVisible) 1.0f else 0.0f
-        val darkAnimator = ObjectAnimator.ofFloat(this, mNotificationVisibility, target)
-        darkAnimator.setInterpolator(Interpolators.LINEAR)
+        val visibilityAnimator = ObjectAnimator.ofFloat(this, mNotificationVisibility, target)
+        visibilityAnimator.setInterpolator(Interpolators.LINEAR)
         var duration = StackStateAnimator.ANIMATION_DURATION_WAKEUP.toLong()
         if (increaseSpeed) {
             duration = (duration.toFloat() / 1.5F).toLong();
         }
-        darkAnimator.setDuration(duration)
-        darkAnimator.start()
-        mDarkAnimator = darkAnimator
+        visibilityAnimator.setDuration(duration)
+        visibilityAnimator.start()
+        mVisibilityAnimator = visibilityAnimator
     }
 
     private fun setVisibilityAmount(visibilityAmount: Float) {
@@ -204,7 +207,7 @@
         mVisibilityAmount = mVisibilityInterpolator.getInterpolation(
                 visibilityAmount)
         handleAnimationFinished();
-        updateDarkAmount()
+        updateHideAmount()
     }
 
     private fun handleAnimationFinished() {
@@ -218,14 +221,15 @@
         return mStackScroller.pulseHeight
     }
 
-    private fun updateDarkAmount() {
+    private fun updateHideAmount() {
         val linearAmount = Math.min(1.0f - mLinearVisibilityAmount, mLinearDozeAmount)
         val amount = Math.min(1.0f - mVisibilityAmount, mDozeAmount)
-        mStackScroller.setDarkAmount(linearAmount, amount)
+        mStackScroller.setHideAmount(linearAmount, amount)
+        iconAreaController.setFullyHidden(linearAmount == 1.0f);
     }
 
     private fun notifyAnimationStart(awake: Boolean) {
-        mStackScroller.notifyDarkAnimationStart(!awake)
+        mStackScroller.notifyHideAnimationStart(!awake)
     }
 
     override fun onDozingChanged(isDozing: Boolean) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
index 92c261c..5371bd9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
@@ -96,6 +96,7 @@
     public StatusBarIconView icon;
     public StatusBarIconView expandedIcon;
     public StatusBarIconView centeredIcon;
+    public StatusBarIconView aodIcon;
     private boolean interruption;
     public boolean autoRedacted; // whether the redacted notification was generated by us
     public int targetSdk;
@@ -336,6 +337,12 @@
                 sbn.getPackageName() + "/0x" + Integer.toHexString(sbn.getId()), sbn);
         expandedIcon.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
 
+        // Construct the expanded icon.
+        aodIcon = new StatusBarIconView(context,
+                sbn.getPackageName() + "/0x" + Integer.toHexString(sbn.getId()), sbn);
+        aodIcon.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
+        aodIcon.setIncreasedSize(true);
+
         final StatusBarIcon ic = new StatusBarIcon(
                 sbn.getUser(),
                 sbn.getPackageName(),
@@ -344,10 +351,11 @@
                 n.number,
                 StatusBarIconView.contentDescForNotification(context, n));
 
-        if (!icon.set(ic) || !expandedIcon.set(ic)) {
+        if (!icon.set(ic) || !expandedIcon.set(ic) || !aodIcon.set(ic)) {
             icon = null;
             expandedIcon = null;
             centeredIcon = null;
+            aodIcon = null;
             throw new InflationException("Couldn't create icon: " + ic);
         }
         expandedIcon.setVisibility(View.INVISIBLE);
@@ -380,6 +388,10 @@
         if (centeredIcon != null) {
             centeredIcon.setTag(key, tag);
         }
+
+        if (aodIcon != null) {
+            aodIcon.setTag(key, tag);
+        }
     }
 
     /**
@@ -403,7 +415,8 @@
                     StatusBarIconView.contentDescForNotification(context, n));
             icon.setNotification(sbn);
             expandedIcon.setNotification(sbn);
-            if (!icon.set(ic) || !expandedIcon.set(ic)) {
+            aodIcon.setNotification(sbn);
+            if (!icon.set(ic) || !expandedIcon.set(ic) || !aodIcon.set(ic)) {
                 throw new InflationException("Couldn't update icon: " + ic);
             }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java
index 94face2..11321cf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java
@@ -52,7 +52,6 @@
 
     private static final int BACKGROUND_ANIMATION_LENGTH_MS = 220;
     private static final int ACTIVATE_ANIMATION_LENGTH = 220;
-    private static final long DARK_ANIMATION_LENGTH = StackStateAnimator.ANIMATION_DURATION_WAKEUP;
 
     /**
      * The amount of width, which is kept in the end when performing a disappear animation (also
@@ -85,11 +84,6 @@
     private static final float VERTICAL_ANIMATION_START = 1.0f;
 
     /**
-     * Scale for the background to animate from when exiting dark mode.
-     */
-    private static final float DARK_EXIT_SCALE_START = 0.93f;
-
-    /**
      * A sentinel value when no color should be used. Can be used with {@link #setTintColor(int)}
      * or {@link #setOverrideTintColor(int, float)}.
      */
@@ -105,7 +99,7 @@
     private final DoubleTapHelper mDoubleTapHelper;
 
     private boolean mDimmed;
-    protected boolean mDark;
+    protected boolean mDozing;
 
     protected int mBgTint = NO_COLOR;
     private float mBgAlpha = 1f;
@@ -440,12 +434,12 @@
         return true;
     }
 
-    public void setDark(boolean dark, boolean fade, long delay) {
-        super.setDark(dark, fade, delay);
-        if (mDark == dark) {
+    public void setDozing(boolean dozing, boolean fade, long delay) {
+        super.setDozing(dozing, fade, delay);
+        if (mDozing == dozing) {
             return;
         }
-        mDark = dark;
+        mDozing = dozing;
         updateBackground();
         updateBackgroundTint(false);
     }
@@ -542,7 +536,7 @@
      *                       used and the background color not at all.
      */
     public void setOverrideTintColor(int color, float overrideAmount) {
-        if (mDark) {
+        if (mDozing) {
             color = NO_COLOR;
             overrideAmount = 0;
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
index d625b31..a27c15b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
@@ -2051,18 +2051,18 @@
     }
 
     @Override
-    public void setDark(boolean dark, boolean fade, long delay) {
-        if (mDark == dark) {
+    public void setDozing(boolean dozing, boolean fade, long delay) {
+        if (mDozing == dozing) {
             return;
         }
-        super.setDark(dark, fade, delay);
+        super.setDozing(dozing, fade, delay);
         if (!mIsAmbientPulsing) {
             // Only fade the showing view of the pulsing notification.
             fade = false;
         }
         final NotificationContentView showing = getShowingLayout();
         if (showing != null) {
-            showing.setDark(dark, fade, delay);
+            showing.setDozing(dozing, fade, delay);
         }
         updateShelfIconColor();
     }
@@ -2180,7 +2180,7 @@
      */
     @Override
     public boolean isSoundEffectsEnabled() {
-        final boolean mute = mDark && mSecureStateProvider != null &&
+        final boolean mute = mDozing && mSecureStateProvider != null &&
                 !mSecureStateProvider.getAsBoolean();
         return !mute && super.isSoundEffectsEnabled();
     }
@@ -2563,7 +2563,7 @@
         showingLayout.updateBackgroundColor(animated);
         mPrivateLayout.updateExpandButtons(isExpandable());
         updateShelfIconColor();
-        showingLayout.setDark(isDark(), false /* animate */, 0 /* delay */);
+        showingLayout.setDozing(isDozing(), false /* animate */, 0 /* delay */);
         mShowingPublicInitialized = true;
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java
index cac41da..30b5338 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java
@@ -49,7 +49,7 @@
     protected int mClipBottomAmount;
     protected int mMinimumHeightForClipping = 0;
     protected float mExtraWidthForClipping = 0;
-    private boolean mDark;
+    private boolean mDozing;
     private ArrayList<View> mMatchParentViews = new ArrayList<View>();
     private static Rect mClipRect = new Rect();
     private boolean mWillBeGone;
@@ -213,18 +213,18 @@
     }
 
     /**
-     * Sets the notification as dark. The default implementation does nothing.
+     * Sets the notification as dozing. The default implementation does nothing.
      *
-     * @param dark Whether the notification should be dark.
+     * @param dozing Whether the notification should be dozing.
      * @param fade Whether an animation should be played to change the state.
      * @param delay If fading, the delay of the animation.
      */
-    public void setDark(boolean dark, boolean fade, long delay) {
-        mDark = dark;
+    public void setDozing(boolean dozing, boolean fade, long delay) {
+        mDozing = dozing;
     }
 
-    public boolean isDark() {
-        return mDark;
+    public boolean isDozing() {
+        return mDozing;
     }
 
     public boolean isRemoved() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
index 354ed2d..ef11c7a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java
@@ -103,7 +103,7 @@
     private int mClipTopAmount;
     private int mContentHeight;
     private int mVisibleType = VISIBLE_TYPE_CONTRACTED;
-    private boolean mDark;
+    private boolean mDozing;
     private boolean mAnimate;
     private boolean mIsHeadsUp;
     private boolean mLegacy;
@@ -1130,12 +1130,12 @@
         return mIsContentExpandable;
     }
 
-    public void setDark(boolean dark, boolean fade, long delay) {
+    public void setDozing(boolean dozing, boolean fade, long delay) {
         if (mContractedChild == null) {
             return;
         }
-        mDark = dark;
-        selectLayout(!dark && fade /* animate */, false /* force */);
+        mDozing = dozing;
+        selectLayout(!dozing && fade /* animate */, false /* force */);
     }
 
     public void setHeadsUp(boolean headsUp) {
@@ -1208,7 +1208,7 @@
         applyMediaTransfer(entry);
         updateLegacy();
         mForceSelectNextLayout = true;
-        setDark(mDark, false /* animate */, 0 /* delay */);
+        setDozing(mDozing, false /* animate */, 0 /* delay */);
         mPreviousExpandedRemoteInputIntent = null;
         mPreviousHeadsUpRemoteInputIntent = null;
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
index fe890fb..caad0f5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
@@ -386,7 +386,7 @@
         }
 
         final ExpandableNotificationRow row = (ExpandableNotificationRow) view;
-        if (row.isDark()) {
+        if (row.isDozing()) {
             return false;
         }
         view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java
index d911e1a..7bde92f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java
@@ -346,7 +346,7 @@
         if (mShouldShowMenu
                 && !NotificationStackScrollLayout.isPinnedHeadsUp(getParent())
                 && !mParent.areGutsExposed()
-                && !mParent.isDark()
+                && !mParent.isDozing()
                 && !mParent.showingAmbientPulsing()
                 && (mCheckForDrag == null || !mHandler.hasCallbacks(mCheckForDrag))) {
             // Only show the menu if we're not a heads up view and guts aren't exposed.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
index d9162c0..d8bda6c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java
@@ -79,7 +79,7 @@
     private int mIntrinsicPadding;
     private int mExpandAnimationTopChange;
     private ExpandableNotificationRow mExpandingNotification;
-    private float mDarkAmount;
+    private float mHideAmount;
     private boolean mAppearing;
     private float mPulseHeight = MAX_PULSE_HEIGHT;
     private float mDozeAmount = 0.0f;
@@ -180,23 +180,23 @@
         mDimmed = dimmed;
     }
 
-    /** In dark mode, we draw as little as possible, assuming a black background */
+    /** While dozing, we draw as little as possible, assuming a black background */
     public void setDozing(boolean dozing) {
         mDozing = dozing;
     }
 
-    /** Dark ratio of the status bar **/
-    public void setDarkAmount(float darkAmount) {
-        if (darkAmount == 1.0f && mDarkAmount != darkAmount) {
-            // Whenever we are fully dark, let's reset the pulseHeight again
+    /** Hide ratio of the status bar **/
+    public void setHideAmount(float hidemount) {
+        if (hidemount == 1.0f && mHideAmount != hidemount) {
+            // Whenever we are fully hidden, let's reset the pulseHeight again
             mPulseHeight = MAX_PULSE_HEIGHT;
         }
-        mDarkAmount = darkAmount;
+        mHideAmount = hidemount;
     }
 
-    /** Returns the dark ratio of the status bar */
-    public float getDarkAmount() {
-        return mDarkAmount;
+    /** Returns the hide ratio of the status bar */
+    public float getHideAmount() {
+        return mHideAmount;
     }
 
     public void setHideSensitive(boolean hideSensitive) {
@@ -295,7 +295,7 @@
     }
 
     public boolean isPulseExpanding() {
-        return mPulseHeight != MAX_PULSE_HEIGHT && mDozeAmount != 0.0f && mDarkAmount != 1.0f;
+        return mPulseHeight != MAX_PULSE_HEIGHT && mDozeAmount != 0.0f && mHideAmount != 1.0f;
     }
 
     public boolean isShadeExpanded() {
@@ -481,14 +481,15 @@
     }
 
     /**
-     * @return {@code true } when shade is completely dark: in AOD or ambient display.
+     * @return {@code true } when shade is completely hidden: in AOD, ambient display or when
+     * bypassing.
      */
-    public boolean isFullyDark() {
-        return mDarkAmount == 1;
+    public boolean isFullyHidden() {
+        return mHideAmount == 1;
     }
 
-    public boolean isDarkAtAll() {
-        return mDarkAmount != 0;
+    public boolean isHiddenAtAll() {
+        return mHideAmount != 0;
     }
 
     public void setAppearing(boolean appearing) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java
index a471d87..bc9e71a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationFilter.java
@@ -36,7 +36,7 @@
     boolean animateHeight;
     boolean animateTopInset;
     boolean animateDimmed;
-    boolean animateDark;
+    boolean animateDozing;
     boolean animateHideSensitive;
     boolean hasDelays;
     boolean hasGoToFullShadeEvent;
@@ -89,8 +89,8 @@
         return this;
     }
 
-    public AnimationFilter animateDark() {
-        animateDark = true;
+    public AnimationFilter animateDozing() {
+        animateDozing = true;
         return this;
     }
 
@@ -145,7 +145,7 @@
         animateHeight |= filter.animateHeight;
         animateTopInset |= filter.animateTopInset;
         animateDimmed |= filter.animateDimmed;
-        animateDark |= filter.animateDark;
+        animateDozing |= filter.animateDozing;
         animateHideSensitive |= filter.animateHideSensitive;
         hasDelays |= filter.hasDelays;
         mAnimatedProperties.addAll(filter.mAnimatedProperties);
@@ -160,7 +160,7 @@
         animateHeight = false;
         animateTopInset = false;
         animateDimmed = false;
-        animateDark = false;
+        animateDozing = false;
         animateHideSensitive = false;
         hasDelays = false;
         hasGoToFullShadeEvent = false;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ExpandableViewState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ExpandableViewState.java
index f28e556..af26c7c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ExpandableViewState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ExpandableViewState.java
@@ -85,7 +85,7 @@
 
     public int height;
     public boolean dimmed;
-    public boolean dark;
+    public boolean dozing;
     public boolean hideSensitive;
     public boolean belowSpeedBump;
     public boolean inShelf;
@@ -121,7 +121,7 @@
             ExpandableViewState svs = (ExpandableViewState) viewState;
             height = svs.height;
             dimmed = svs.dimmed;
-            dark = svs.dark;
+            dozing = svs.dozing;
             hideSensitive = svs.hideSensitive;
             belowSpeedBump = svs.belowSpeedBump;
             clipTopAmount = svs.clipTopAmount;
@@ -158,8 +158,8 @@
             // apply below shelf speed bump
             expandableView.setBelowSpeedBump(this.belowSpeedBump);
 
-            // apply dark
-            expandableView.setDark(this.dark, false /* animate */, 0 /* delay */);
+            // apply dozing
+            expandableView.setDozing(this.dozing, false /* animate */, 0 /* delay */);
 
             // apply clipping
             float oldClipTopAmount = expandableView.getClipTopAmount();
@@ -209,8 +209,8 @@
         expandableView.setHideSensitive(this.hideSensitive, animationFilter.animateHideSensitive,
                 properties.delay, properties.duration);
 
-        // start dark animation
-        expandableView.setDark(this.dark, animationFilter.animateDark, properties.delay);
+        // start dozing animation
+        expandableView.setDozing(this.dozing, animationFilter.animateDozing, properties.delay);
 
         if (properties.wasAdded(child) && !hidden) {
             expandableView.performAddAnimation(properties.delay, properties.duration,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
index 6632ae6..5425c8e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
@@ -567,7 +567,7 @@
                     ? parentState.zTranslation
                     : 0;
             childState.dimmed = parentState.dimmed;
-            childState.dark = parentState.dark;
+            childState.dozing = parentState.dozing;
             childState.hideSensitive = parentState.hideSensitive;
             childState.belowSpeedBump = parentState.belowSpeedBump;
             childState.clipTopAmount = 0;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index aae4caf..1f0e545 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -126,7 +126,6 @@
 import com.android.systemui.statusbar.notification.row.NotificationGutsManager;
 import com.android.systemui.statusbar.notification.row.NotificationSnooze;
 import com.android.systemui.statusbar.notification.row.StackScrollerDecorView;
-import com.android.systemui.statusbar.phone.DozeParameters;
 import com.android.systemui.statusbar.phone.HeadsUpAppearanceController;
 import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
 import com.android.systemui.statusbar.phone.HeadsUpTouchHelper;
@@ -267,8 +266,7 @@
     private boolean mTopPaddingNeedsAnimation;
     private boolean mDimmedNeedsAnimation;
     private boolean mHideSensitiveNeedsAnimation;
-    private boolean mDarkNeedsAnimation;
-    private int mDarkAnimationOriginIndex;
+    private boolean mDozingNeedsAnimation;
     private boolean mActivateNeedsAnimation;
     private boolean mGoToFullShadeNeedsAnimation;
     private boolean mIsExpanded = true;
@@ -409,9 +407,9 @@
     private final ViewOutlineProvider mOutlineProvider = new ViewOutlineProvider() {
         @Override
         public void getOutline(View view, Outline outline) {
-            if (mAmbientState.isDarkAtAll()) {
-                float xProgress = mDarkXInterpolator.getInterpolation(
-                        (1 - mLinearDarkAmount) * mBackgroundXFactor);
+            if (mAmbientState.isHiddenAtAll()) {
+                float xProgress = mHideXInterpolator.getInterpolation(
+                        (1 - mLinearHideAmount) * mBackgroundXFactor);
                 outline.setRoundRect(mBackgroundAnimationRect,
                         MathUtils.lerp(mCornerRadius / 2.0f, mCornerRadius,
                                 xProgress));
@@ -427,14 +425,14 @@
     private View mForcedScroll;
 
     /**
-     * @see #setDarkAmount(float, float)
+     * @see #setHideAmount(float, float)
      */
-    private float mInterpolatedDarkAmount = 0f;
+    private float mInterpolatedHideAmount = 0f;
 
     /**
-     * @see #setDarkAmount(float, float)
+     * @see #setHideAmount(float, float)
      */
-    private float mLinearDarkAmount = 0f;
+    private float mLinearHideAmount = 0f;
 
     /**
      * How fast the background scales in the X direction as a factor of the Y expansion.
@@ -495,16 +493,13 @@
             Dependency.get(VisualStabilityManager.class);
     protected boolean mClearAllEnabled;
 
-    private Interpolator mDarkXInterpolator = Interpolators.FAST_OUT_SLOW_IN;
+    private Interpolator mHideXInterpolator = Interpolators.FAST_OUT_SLOW_IN;
     private NotificationPanelView mNotificationPanel;
     private final ShadeController mShadeController = Dependency.get(ShadeController.class);
 
     private final NotificationGutsManager
             mNotificationGutsManager = Dependency.get(NotificationGutsManager.class);
     private final NotificationSectionsManager mSectionsManager;
-    /**
-     * If the {@link NotificationShelf} should be visible when dark.
-     */
     private boolean mAnimateBottomOnLayout;
 
     @Inject
@@ -571,7 +566,8 @@
             blockingHelperManager.setNotificationShadeExpanded(height);
         });
 
-        updateWillNotDraw();
+        boolean willDraw = mShouldDrawNotificationBackground || DEBUG;
+        setWillNotDraw(!willDraw);
         mBackgroundPaint.setAntiAlias(true);
         if (DEBUG) {
             mDebugPaint = new Paint();
@@ -814,17 +810,17 @@
         int lockScreenRight = getWidth() - mSidePaddings;
         int lockScreenTop = mSections[0].getCurrentBounds().top;
         int lockScreenBottom = mSections[NUM_SECTIONS - 1].getCurrentBounds().bottom;
-        int darkLeft = getWidth() / 2;
-        int darkTop = mTopPadding;
+        int hiddenLeft = getWidth() / 2;
+        int hiddenTop = mTopPadding;
 
-        float yProgress = 1 - mInterpolatedDarkAmount;
-        float xProgress = mDarkXInterpolator.getInterpolation(
-                (1 - mLinearDarkAmount) * mBackgroundXFactor);
+        float yProgress = 1 - mInterpolatedHideAmount;
+        float xProgress = mHideXInterpolator.getInterpolation(
+                (1 - mLinearHideAmount) * mBackgroundXFactor);
 
-        int left = (int) MathUtils.lerp(darkLeft, lockScreenLeft, xProgress);
-        int right = (int) MathUtils.lerp(darkLeft, lockScreenRight, xProgress);
-        int top = (int) MathUtils.lerp(darkTop, lockScreenTop, yProgress);
-        int bottom = (int) MathUtils.lerp(darkTop, lockScreenBottom, yProgress);
+        int left = (int) MathUtils.lerp(hiddenLeft, lockScreenLeft, xProgress);
+        int right = (int) MathUtils.lerp(hiddenLeft, lockScreenRight, xProgress);
+        int top = (int) MathUtils.lerp(hiddenTop, lockScreenTop, yProgress);
+        int bottom = (int) MathUtils.lerp(hiddenTop, lockScreenBottom, yProgress);
         mBackgroundAnimationRect.set(
                 left,
                 top,
@@ -940,7 +936,7 @@
         // Interpolate between semi-transparent notification panel background color
         // and white AOD separator.
         float colorInterpolation = MathUtils.smoothStep(0.4f /* start */, 1f /* end */,
-                mLinearDarkAmount);
+                mLinearHideAmount);
         int color = ColorUtils.blendARGB(mBgColor, Color.WHITE, colorInterpolation);
 
         if (mCachedBackgroundColor != color) {
@@ -1361,11 +1357,12 @@
             mIsClipped = clipped;
         }
 
-        if (!mAmbientPulseManager.hasNotifications() && mAmbientState.isFullyDark()) {
-            setClipBounds(null);
-        } else if (mAmbientState.isDarkAtAll()) {
+        if (mAmbientState.isHiddenAtAll()) {
             clipToOutline = true;
             invalidateOutline();
+            if (isFullyHidden()) {
+                setClipBounds(null);
+            }
         } else if (clipped) {
             setClipBounds(mRequestedClipBounds);
         } else {
@@ -2434,7 +2431,7 @@
     @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
     private void updateBackground() {
         // No need to update the background color if it's not being drawn.
-        if (!mShouldDrawNotificationBackground || mAmbientState.isFullyDark()) {
+        if (!mShouldDrawNotificationBackground) {
             return;
         }
 
@@ -3356,7 +3353,7 @@
         generateActivateEvent();
         generateDimmedEvent();
         generateHideSensitiveEvent();
-        generateDarkEvent();
+        generateDozingEvent();
         generateGoToFullShadeEvent();
         generateViewResizeEvent();
         generateGroupExpansionEvent();
@@ -3571,17 +3568,16 @@
     }
 
     @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
-    private void generateDarkEvent() {
-        if (mDarkNeedsAnimation) {
+    private void generateDozingEvent() {
+        if (mDozingNeedsAnimation) {
             AnimationEvent ev = new AnimationEvent(null,
-                    AnimationEvent.ANIMATION_TYPE_DARK,
+                    AnimationEvent.ANIMATION_TYPE_DOZING,
                     new AnimationFilter()
-                            .animateDark()
+                            .animateDozing()
                             .animateY(mShelf));
-            ev.darkAnimationOriginIndex = mDarkAnimationOriginIndex;
             mAnimationEvents.add(ev);
         }
-        mDarkNeedsAnimation = false;
+        mDozingNeedsAnimation = false;
     }
 
     @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
@@ -4711,18 +4707,16 @@
         }
         mAmbientState.setDozing(dozing);
         if (animate && mAnimationsEnabled) {
-            mDarkNeedsAnimation = true;
-            mDarkAnimationOriginIndex = findDarkAnimationOriginIndex(touchWakeUpScreenLocation);
+            mDozingNeedsAnimation = true;
             mNeedsAnimation = true;
         }
         requestChildrenUpdate();
-        updateWillNotDraw();
         notifyHeightChangeListener(mShelf);
     }
 
     @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
     private void updatePanelTranslation() {
-        setTranslationX(mHorizontalPanelTranslation + mAntiBurnInOffsetX * mInterpolatedDarkAmount);
+        setTranslationX(mHorizontalPanelTranslation + mAntiBurnInOffsetX * mInterpolatedHideAmount);
     }
 
     @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
@@ -4732,49 +4726,30 @@
     }
 
     /**
-     * Updates whether or not this Layout will perform its own custom drawing (i.e. whether or
-     * not {@link #onDraw(Canvas)} is called). This method should be called whenever the
-     * {@link #mAmbientState}'s dark mode is toggled.
-     */
-    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
-    private void updateWillNotDraw() {
-        boolean willDraw = mShouldDrawNotificationBackground || DEBUG;
-        setWillNotDraw(!willDraw);
-    }
-
-    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
-    private void setDarkAmount(float darkAmount) {
-        setDarkAmount(darkAmount, darkAmount);
-    }
-
-    /**
-     * Sets the current dark amount.
+     * Sets the current hide amount.
      *
-     * @param linearDarkAmount       The dark amount that follows linear interpoloation in the
+     * @param linearHideAmount       The hide amount that follows linear interpoloation in the
      *                               animation,
      *                               i.e. animates from 0 to 1 or vice-versa in a linear manner.
-     * @param interpolatedDarkAmount The dark amount that follows the actual interpolation of the
+     * @param interpolatedHideAmount The hide amount that follows the actual interpolation of the
      *                               animation curve.
      */
     @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
-    public void setDarkAmount(float linearDarkAmount, float interpolatedDarkAmount) {
-        mLinearDarkAmount = linearDarkAmount;
-        mInterpolatedDarkAmount = interpolatedDarkAmount;
-        boolean wasFullyDark = mAmbientState.isFullyDark();
-        boolean wasDarkAtAll = mAmbientState.isDarkAtAll();
-        mAmbientState.setDarkAmount(interpolatedDarkAmount);
-        boolean nowFullyDark = mAmbientState.isFullyDark();
-        boolean nowDarkAtAll = mAmbientState.isDarkAtAll();
-        if (nowFullyDark != wasFullyDark) {
-            updateContentHeight();
-            if (nowFullyDark) {
-                updateDarkShelfVisibility();
-            }
+    public void setHideAmount(float linearHideAmount, float interpolatedHideAmount) {
+        mLinearHideAmount = linearHideAmount;
+        mInterpolatedHideAmount = interpolatedHideAmount;
+        boolean wasFullyHidden = mAmbientState.isFullyHidden();
+        boolean wasHiddenAtAll = mAmbientState.isHiddenAtAll();
+        mAmbientState.setHideAmount(interpolatedHideAmount);
+        boolean nowFullyHidden = mAmbientState.isFullyHidden();
+        boolean nowHiddenAtAll = mAmbientState.isHiddenAtAll();
+        if (nowFullyHidden != wasFullyHidden) {
+            setVisibility(mAmbientState.isFullyHidden() ? View.INVISIBLE : View.VISIBLE);
         }
-        if (!wasDarkAtAll && nowDarkAtAll) {
+        if (!wasHiddenAtAll && nowHiddenAtAll) {
             resetExposedMenuView(true /* animate */, true /* animate */);
         }
-        if (nowFullyDark != wasFullyDark || wasDarkAtAll != nowDarkAtAll) {
+        if (nowFullyHidden != wasFullyHidden || wasHiddenAtAll != nowHiddenAtAll) {
             invalidateOutline();
         }
         updateAlgorithmHeightAndPadding();
@@ -4783,42 +4758,18 @@
         requestChildrenUpdate();
     }
 
-    private void updateDarkShelfVisibility() {
-        DozeParameters dozeParameters = DozeParameters.getInstance(mContext);
-        if (dozeParameters.shouldControlScreenOff()) {
-            mShelf.fadeInTranslating();
-        }
-        updateClipping();
-    }
-
     @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
-    public void notifyDarkAnimationStart(boolean dark) {
-        // We only swap the scaling factor if we're fully dark or fully awake to avoid
+    public void notifyHideAnimationStart(boolean hide) {
+        // We only swap the scaling factor if we're fully hidden or fully awake to avoid
         // interpolation issues when playing with the power button.
-        if (mInterpolatedDarkAmount == 0 || mInterpolatedDarkAmount == 1) {
-            mBackgroundXFactor = dark ? 1.8f : 1.5f;
-            mDarkXInterpolator = dark
+        if (mInterpolatedHideAmount == 0 || mInterpolatedHideAmount == 1) {
+            mBackgroundXFactor = hide ? 1.8f : 1.5f;
+            mHideXInterpolator = hide
                     ? Interpolators.FAST_OUT_SLOW_IN_REVERSE
                     : Interpolators.FAST_OUT_SLOW_IN;
         }
     }
 
-    @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
-    private int findDarkAnimationOriginIndex(@Nullable PointF screenLocation) {
-        if (screenLocation == null || screenLocation.y < mTopPadding) {
-            return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE;
-        }
-        if (screenLocation.y > getBottomMostNotificationBottom()) {
-            return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_BELOW;
-        }
-        View child = getClosestChildAtRawPosition(screenLocation.x, screenLocation.y);
-        if (child != null) {
-            return getNotGoneIndex(child);
-        } else {
-            return AnimationEvent.DARK_ANIMATION_ORIGIN_INDEX_ABOVE;
-        }
-    }
-
     @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
     private int getNotGoneIndex(View child) {
         int count = getChildCount();
@@ -5416,8 +5367,8 @@
     }
 
     @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
-    public boolean isFullyDark() {
-        return mAmbientState.isFullyDark();
+    public boolean isFullyHidden() {
+        return mAmbientState.isFullyHidden();
     }
 
     /**
@@ -5661,7 +5612,7 @@
     }
 
     /**
-     * Set the amount how much we're dozing. This is different from how dark the shade is, when
+     * Set the amount how much we're dozing. This is different from how hidden the shade is, when
      * the notification is pulsing.
      */
     public void setDozeAmount(float dozeAmount) {
@@ -5880,7 +5831,7 @@
                         .animateY()
                         .animateZ(),
 
-                // ANIMATION_TYPE_DARK
+                // ANIMATION_TYPE_DOZING
                 null, // Unused
 
                 // ANIMATION_TYPE_GO_TO_FULL_SHADE
@@ -5944,7 +5895,7 @@
                 // ANIMATION_TYPE_EVERYTHING
                 new AnimationFilter()
                         .animateAlpha()
-                        .animateDark()
+                        .animateDozing()
                         .animateDimmed()
                         .animateHideSensitive()
                         .animateHeight()
@@ -5976,7 +5927,7 @@
                 // ANIMATION_TYPE_CHANGE_POSITION
                 StackStateAnimator.ANIMATION_DURATION_STANDARD,
 
-                // ANIMATION_TYPE_DARK
+                // ANIMATION_TYPE_DOZING
                 StackStateAnimator.ANIMATION_DURATION_WAKEUP,
 
                 // ANIMATION_TYPE_GO_TO_FULL_SHADE
@@ -6014,7 +5965,7 @@
         static final int ANIMATION_TYPE_ACTIVATED_CHILD = 4;
         static final int ANIMATION_TYPE_DIMMED = 5;
         static final int ANIMATION_TYPE_CHANGE_POSITION = 6;
-        static final int ANIMATION_TYPE_DARK = 7;
+        static final int ANIMATION_TYPE_DOZING = 7;
         static final int ANIMATION_TYPE_GO_TO_FULL_SHADE = 8;
         static final int ANIMATION_TYPE_HIDE_SENSITIVE = 9;
         static final int ANIMATION_TYPE_VIEW_RESIZE = 10;
@@ -6025,16 +5976,12 @@
         static final int ANIMATION_TYPE_HEADS_UP_OTHER = 15;
         static final int ANIMATION_TYPE_EVERYTHING = 16;
 
-        static final int DARK_ANIMATION_ORIGIN_INDEX_ABOVE = -1;
-        static final int DARK_ANIMATION_ORIGIN_INDEX_BELOW = -2;
-
         final long eventStartTime;
         final ExpandableView mChangingView;
         final int animationType;
         final AnimationFilter filter;
         final long length;
         View viewAfterChangingView;
-        int darkAnimationOriginIndex;
         boolean headsUpFromBottom;
 
         AnimationEvent(ExpandableView view, int type) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
index 2980ee4..ccee2a1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
@@ -213,7 +213,7 @@
     private void updateDimmedActivatedHideSensitive(AmbientState ambientState,
             StackScrollAlgorithmState algorithmState) {
         boolean dimmed = ambientState.isDimmed();
-        boolean dark = ambientState.isFullyDark();
+        boolean hidden = ambientState.isFullyHidden();
         boolean hideSensitive = ambientState.isHideSensitive();
         View activatedChild = ambientState.getActivatedChild();
         int childCount = algorithmState.visibleChildren.size();
@@ -221,7 +221,7 @@
             ExpandableView child = algorithmState.visibleChildren.get(i);
             ExpandableViewState childViewState = child.getViewState();
             childViewState.dimmed = dimmed;
-            childViewState.dark = dark;
+            childViewState.dozing = hidden;
             childViewState.hideSensitive = hideSensitive;
             boolean isActivatedChild = activatedChild == child;
             if (dimmed && isActivatedChild) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java
index 7332b03..ea1ceec 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java
@@ -172,7 +172,7 @@
                         || viewState.alpha != child.getAlpha()
                         || viewState.height != child.getActualHeight()
                         || viewState.clipTopAmount != child.getClipTopAmount()
-                        || viewState.dark != child.isDark())) {
+                        || viewState.dozing != child.isDozing())) {
             mAnimationProperties.delay = mCurrentAdditionalDelay
                     + calculateChildAnimationDelay(viewState);
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
index e8ca3ee..177b72a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
@@ -15,7 +15,9 @@
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.statusbar.StatusBarIcon;
 import com.android.internal.util.ContrastColorUtil;
+import com.android.settingslib.Utils;
 import com.android.systemui.Dependency;
+import com.android.systemui.Interpolators;
 import com.android.systemui.R;
 import com.android.systemui.plugins.DarkIconDispatcher;
 import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
@@ -24,6 +26,7 @@
 import com.android.systemui.statusbar.NotificationMediaManager;
 import com.android.systemui.statusbar.NotificationShelf;
 import com.android.systemui.statusbar.StatusBarIconView;
+import com.android.systemui.statusbar.StatusBarState;
 import com.android.systemui.statusbar.notification.NotificationEntryManager;
 import com.android.systemui.statusbar.notification.NotificationUtils;
 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -41,12 +44,14 @@
         StatusBarStateController.StateListener {
 
     public static final String LOW_PRIORITY = "low_priority";
+    private static final long AOD_ICONS_APPEAR_DURATION = 200;
 
     private final ContrastColorUtil mContrastColorUtil;
     private final NotificationEntryManager mEntryManager;
     private final Runnable mUpdateStatusBarIcons = this::updateStatusBarIcons;
     private final StatusBarStateController mStatusBarStateController;
     private final NotificationMediaManager mMediaManager;
+    private final DozeParameters mDozeParameters;
     @VisibleForTesting
     final NotificationListener.NotificationSettingsListener mSettingsListener =
             new NotificationListener.NotificationSettingsListener() {
@@ -72,17 +77,17 @@
     private NotificationIconContainer mShelfIcons;
     protected View mCenteredIconArea;
     private NotificationIconContainer mCenteredIcon;
+    private NotificationIconContainer mAodIcons;
     private StatusBarIconView mCenteredIconView;
     private final Rect mTintArea = new Rect();
     private ViewGroup mNotificationScrollLayout;
     private Context mContext;
-    private boolean mFullyDark;
     private boolean mShowLowPriority = true;
+    private int mAodIconAppearTranslation;
 
-    /**
-     * Ratio representing being awake or in ambient mode, where 1 is dark and 0 awake.
-     */
-    private float mDarkAmount;
+    private boolean mAnimationsEnabled;
+    private int mAodIconTint;
+    private boolean mFullyHidden;
 
     public NotificationIconAreaController(Context context, StatusBar statusBar,
             StatusBarStateController statusBarStateController,
@@ -96,8 +101,10 @@
         mStatusBarStateController.addCallback(this);
         mMediaManager = notificationMediaManager;
         notificationListener.addNotificationSettingsListener(mSettingsListener);
+        mDozeParameters = DozeParameters.getInstance(mContext);
 
         initializeNotificationAreaViews(context);
+        reloadAodColor();
     }
 
     protected View inflateIconArea(LayoutInflater inflater) {
@@ -118,6 +125,24 @@
 
         mCenteredIconArea = layoutInflater.inflate(R.layout.center_icon_area, null);
         mCenteredIcon = mCenteredIconArea.findViewById(R.id.centeredIcon);
+
+        initAodIcons();
+    }
+
+    public void initAodIcons() {
+        boolean changed = mAodIcons != null;
+        if (changed) {
+            mAodIcons.setAnimationsEnabled(false);
+            mAodIcons.removeAllViews();
+        }
+        mAodIcons = mStatusBar.getStatusBarWindow().findViewById(
+                R.id.clock_notification_icon_container);
+        mAodIcons.setOnLockScreen(true);
+        updateAodIconsVisibility();
+        updateAnimations();
+        if (changed) {
+            updateAodIcons();
+        }
     }
 
     public void setupShelf(NotificationShelf shelf) {
@@ -140,6 +165,10 @@
             View child = mCenteredIcon.getChildAt(i);
             child.setLayoutParams(params);
         }
+        for (int i = 0; i < mAodIcons.getChildCount(); i++) {
+            View child = mAodIcons.getChildAt(i);
+            child.setLayoutParams(params);
+        }
     }
 
     @NonNull
@@ -152,6 +181,8 @@
         Resources res = context.getResources();
         mIconSize = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_icon_size);
         mIconHPadding = res.getDimensionPixelSize(R.dimen.status_bar_icon_padding);
+        mAodIconAppearTranslation = res.getDimensionPixelSize(
+                R.dimen.shelf_appear_translation);
     }
 
     /**
@@ -236,7 +267,7 @@
             return false;
         }
         // showAmbient == show in shade but not shelf
-        if ((!showAmbient || mFullyDark) && entry.shouldSuppressStatusBar()) {
+        if (!showAmbient && entry.shouldSuppressStatusBar()) {
             return false;
         }
         return true;
@@ -249,6 +280,7 @@
         updateStatusBarIcons();
         updateShelfIcons();
         updateCenterIcon();
+        updateAodIcons();
 
         applyNotificationIconsTint();
     }
@@ -256,10 +288,10 @@
     private void updateShelfIcons() {
         updateIconsForLayout(entry -> entry.expandedIcon, mShelfIcons,
                 true /* showAmbient */,
-                !mFullyDark /* showLowPriority */,
+                true /* showLowPriority */,
                 false /* hideDismissed */,
-                mFullyDark /* hideRepliedMessages */,
-                mFullyDark /* hideCurrentMedia */,
+                false /* hideRepliedMessages */,
+                false /* hideCurrentMedia */,
                 true /* hide centered icon */);
     }
 
@@ -276,13 +308,23 @@
     private void updateCenterIcon() {
         updateIconsForLayout(entry -> entry.centeredIcon, mCenteredIcon,
                 false /* showAmbient */,
-                !mFullyDark /* showLowPriority */,
+                true /* showLowPriority */,
                 false /* hideDismissed */,
                 false /* hideRepliedMessages */,
-                mFullyDark /* hideCurrentMedia */,
+                false /* hideCurrentMedia */,
                 false /* hide centered icon */);
     }
 
+    public void updateAodIcons() {
+        updateIconsForLayout(entry -> entry.aodIcon, mAodIcons,
+                false /* showAmbient */,
+                mShowLowPriority /* showLowPriority */,
+                true /* hideDismissed */,
+                true /* hideRepliedMessages */,
+                true /* hideCurrentMedia */,
+                true /* hide centered icon */);
+    }
+
     @VisibleForTesting
     boolean shouldShouldLowPriorityIcons() {
         return mShowLowPriority;
@@ -424,6 +466,8 @@
                 iv.executeOnLayout(() -> updateTintForIcon(iv, mCenteredIconTint));
             }
         }
+
+        updateAodIconColors();
     }
 
     private void updateTintForIcon(StatusBarIconView v, int tint) {
@@ -437,12 +481,6 @@
         v.setDecorColor(tint);
     }
 
-    public void setDark(boolean dark) {
-        mNotificationIcons.setDark(dark, false, 0);
-        mShelfIcons.setDark(dark, false, 0);
-        mCenteredIcon.setDark(dark, false, 0);
-    }
-
     /**
      * Shows the icon view given in the center.
      */
@@ -463,12 +501,78 @@
     }
 
     @Override
-    public void onDozeAmountChanged(float linear, float eased) {
-        mDarkAmount = linear;
-        boolean fullyDark = mDarkAmount == 1f;
-        if (mFullyDark != fullyDark) {
-            mFullyDark = fullyDark;
-            updateShelfIcons();
+    public void onDozingChanged(boolean isDozing) {
+        boolean animate = mDozeParameters.getAlwaysOn()
+                && !mDozeParameters.getDisplayNeedsBlanking();
+        mAodIcons.setDozing(isDozing, animate, 0);
+    }
+
+    public void setAnimationsEnabled(boolean enabled) {
+        mAnimationsEnabled = enabled;
+        updateAnimations();
+    }
+
+    @Override
+    public void onStateChanged(int newState) {
+        updateAnimations();
+    }
+
+    private void updateAnimations() {
+        boolean inShade = mStatusBarStateController.getState() == StatusBarState.SHADE;
+        mAodIcons.setAnimationsEnabled(mAnimationsEnabled && !inShade);
+        mCenteredIcon.setAnimationsEnabled(mAnimationsEnabled && inShade);
+        mNotificationIcons.setAnimationsEnabled(mAnimationsEnabled && inShade);
+    }
+
+    public void onThemeChanged() {
+        reloadAodColor();
+        updateAodIconColors();
+    }
+
+    public void appearAodIcons() {
+        DozeParameters dozeParameters = DozeParameters.getInstance(mContext);
+        if (dozeParameters.shouldControlScreenOff()) {
+            mAodIcons.setTranslationY(-mAodIconAppearTranslation);
+            mAodIcons.setAlpha(0);
+            mAodIcons.animate()
+                    .setInterpolator(Interpolators.DECELERATE_QUINT)
+                    .translationY(0)
+                    .setDuration(AOD_ICONS_APPEAR_DURATION)
+                    .start();
+            mAodIcons.animate()
+                    .alpha(1)
+                    .setInterpolator(Interpolators.LINEAR)
+                    .setDuration(AOD_ICONS_APPEAR_DURATION)
+                    .start();
         }
     }
+
+    private void reloadAodColor() {
+        mAodIconTint = Utils.getColorAttrDefaultColor(mContext,
+                R.attr.wallpaperTextColor);
+    }
+    private void updateAodIconColors() {
+        for (int i = 0; i < mAodIcons.getChildCount(); i++) {
+            final StatusBarIconView iv = (StatusBarIconView) mAodIcons.getChildAt(i);
+            if (iv.getWidth() != 0) {
+                updateTintForIcon(iv, mAodIconTint);
+            } else {
+                iv.executeOnLayout(() -> updateTintForIcon(iv, mAodIconTint));
+            }
+        }
+    }
+
+    public void setFullyHidden(boolean fullyHidden) {
+        if (mFullyHidden != fullyHidden) {
+            mFullyHidden = fullyHidden;
+            if (fullyHidden) {
+                appearAodIcons();
+            }
+            updateAodIconsVisibility();
+        }
+    }
+
+    private void updateAodIconsVisibility() {
+        mAodIcons.setVisibility(mFullyHidden ? View.VISIBLE : View.INVISIBLE);
+    }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java
index 009afca..e51baf3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java
@@ -128,7 +128,7 @@
         }
     }.setDuration(CONTENT_FADE_DURATION);
 
-    private static final int MAX_VISIBLE_ICONS_WHEN_DARK = 5;
+    private static final int MAX_VISIBLE_ICONS_ON_LOCK = 5;
     public static final int MAX_STATIC_ICONS = 4;
     private static final int MAX_DOTS = 1;
 
@@ -141,7 +141,8 @@
     private int mActualLayoutWidth = NO_VALUE;
     private float mActualPaddingEnd = NO_VALUE;
     private float mActualPaddingStart = NO_VALUE;
-    private boolean mDark;
+    private boolean mDozing;
+    private boolean mOnLockScreen;
     private boolean mChangingViewPositions;
     private int mAddAnimationStartIndex = -1;
     private int mCannedAnimationStartIndex = -1;
@@ -288,7 +289,7 @@
             }
         }
         if (child instanceof StatusBarIconView) {
-            ((StatusBarIconView) child).setDark(mDark, false, 0);
+            ((StatusBarIconView) child).setDozing(mDozing, false, 0);
         }
     }
 
@@ -315,7 +316,7 @@
     @Override
     public void onViewRemoved(View child) {
         super.onViewRemoved(child);
-        if (child instanceof StatusBarIconView) {
+        if (mAnimationsEnabled && child instanceof StatusBarIconView) {
             boolean isReplacingIcon = isReplacingIcon(child);
             final StatusBarIconView icon = (StatusBarIconView) child;
             if (icon.getVisibleState() != StatusBarIconView.STATE_HIDDEN
@@ -372,7 +373,7 @@
         float translationX = getActualPaddingStart();
         int firstOverflowIndex = -1;
         int childCount = getChildCount();
-        int maxVisibleIcons = mDark ? MAX_VISIBLE_ICONS_WHEN_DARK :
+        int maxVisibleIcons = mOnLockScreen ? MAX_VISIBLE_ICONS_ON_LOCK :
                 mIsStaticLayout ? MAX_STATIC_ICONS : childCount;
         float layoutEnd = getLayoutEnd();
         float overflowStart = getMaxOverflowStart();
@@ -389,8 +390,8 @@
             boolean forceOverflow = mSpeedBumpIndex != -1 && i >= mSpeedBumpIndex
                     && iconState.iconAppearAmount > 0.0f || i >= maxVisibleIcons;
             boolean noOverflowAfter = i == childCount - 1;
-            float drawingScale = mDark && view instanceof StatusBarIconView
-                    ? ((StatusBarIconView) view).getIconScaleFullyDark()
+            float drawingScale = mOnLockScreen && view instanceof StatusBarIconView
+                    ? ((StatusBarIconView) view).getIconScaleIncreased()
                     : 1f;
             if (mOpenedAmount != 0.0f) {
                 noOverflowAfter = noOverflowAfter && !hasAmbient && !forceOverflow;
@@ -437,7 +438,7 @@
             mFirstVisibleIconState = mIconStates.get(getChildAt(0));
         }
 
-        boolean center = mDark;
+        boolean center = mOnLockScreen;
         if (center && translationX < getLayoutEnd()) {
             float initialTranslation =
                     mFirstVisibleIconState == null ? 0 : mFirstVisibleIconState.xTranslation;
@@ -557,13 +558,13 @@
         mChangingViewPositions = changingViewPositions;
     }
 
-    public void setDark(boolean dark, boolean fade, long delay) {
-        mDark = dark;
+    public void setDozing(boolean dozing, boolean fade, long delay) {
+        mDozing = dozing;
         mDisallowNextAnimation |= !fade;
         for (int i = 0; i < getChildCount(); i++) {
             View view = getChildAt(i);
             if (view instanceof StatusBarIconView) {
-                ((StatusBarIconView) view).setDark(dark, fade, delay);
+                ((StatusBarIconView) view).setDozing(dozing, fade, delay);
             }
         }
     }
@@ -667,6 +668,10 @@
         }
     }
 
+    public void setOnLockScreen(boolean onLockScreen) {
+        mOnLockScreen = onLockScreen;
+    }
+
     public class IconState extends ViewState {
         public static final int NO_VALUE = NotificationIconContainer.NO_VALUE;
         public float iconAppearAmount = 1.0f;
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 1d1ae37..1ee1c42 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -345,6 +345,9 @@
     private int mThemeResId;
     private KeyguardIndicationController mKeyguardIndicationController;
     private Consumer<Boolean> mAffordanceLaunchListener;
+    private int mShelfHeight;
+    private Runnable mOnReinflationListener;
+    private int mDarkIconSize;
 
     @Inject
     public NotificationPanelView(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
@@ -452,6 +455,9 @@
                 R.dimen.keyguard_indication_bottom_padding);
         mQsNotificationTopPadding = getResources().getDimensionPixelSize(
                 R.dimen.qs_notification_padding);
+        mShelfHeight = getResources().getDimensionPixelSize(R.dimen.notification_shelf_height);
+        mDarkIconSize = getResources().getDimensionPixelSize(
+                R.dimen.status_bar_icon_drawing_size_dark);
     }
 
     /**
@@ -544,6 +550,9 @@
 
         setKeyguardStatusViewVisibility(mBarState, false, false);
         setKeyguardBottomAreaVisibility(mBarState, false);
+        if (mOnReinflationListener != null) {
+            mOnReinflationListener.run();
+        }
     }
 
     private void initBottomArea() {
@@ -674,7 +683,8 @@
                     mNotificationStackScroller.getIntrinsicContentHeight(),
                     getExpandedFraction(),
                     totalHeight,
-                    mKeyguardStatusView.getHeight(),
+                    (int) (mKeyguardStatusView.getHeight()
+                            - mShelfHeight / 2.0f - mDarkIconSize / 2.0f),
                     clockPreferredY,
                     hasCustomClock(),
                     mNotificationStackScroller.getVisibleNotificationCount() != 0,
@@ -3063,10 +3073,6 @@
         return mNotificationStackScroller.hasPulsingNotifications();
     }
 
-    public boolean isFullyDark() {
-        return mNotificationStackScroller.isFullyDark();
-    }
-
     public ActivatableNotificationView getActivatedChild() {
         return mNotificationStackScroller.getActivatedChild();
     }
@@ -3114,6 +3120,10 @@
         mAnimateNextPositionUpdate = true;
     }
 
+    public void setOnReinflationListener(Runnable onReinflationListener) {
+        mOnReinflationListener = onReinflationListener;
+    }
+
     /**
      * Panel and QS expansion callbacks.
      */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java
index ca762cd..27c94d2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQuickSettingsContainer.java
@@ -36,6 +36,9 @@
 import com.android.systemui.statusbar.notification.AboveShelfObserver;
 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
 
+import java.util.ArrayList;
+import java.util.Comparator;
+
 /**
  * The container with notification stack scroller and quick settings inside.
  */
@@ -54,6 +57,9 @@
     private int mBottomPadding;
     private int mStackScrollerMargin;
     private boolean mHasViewsAboveShelf;
+    private ArrayList<View> mDrawingOrderedChildren = new ArrayList<>();
+    private ArrayList<View> mLayoutDrawingOrder = new ArrayList<>();
+    private final Comparator<View> mIndexComparator = Comparator.comparingInt(this::indexOfChild);
 
     public NotificationsQuickSettingsContainer(Context context, AttributeSet attrs) {
         super(context, attrs);
@@ -107,35 +113,44 @@
     }
 
     @Override
-    protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
-        boolean userSwitcherVisible = mInflated && mUserSwitcher.getVisibility() == View.VISIBLE;
-        boolean statusBarVisible = mKeyguardStatusBar.getVisibility() == View.VISIBLE;
-
-        final boolean qsBottom = mHasViewsAboveShelf;
-        View stackQsTop = qsBottom ? mStackScroller : mQsFrame;
-        View stackQsBottom = !qsBottom ? mStackScroller : mQsFrame;
+    protected void dispatchDraw(Canvas canvas) {
         // Invert the order of the scroll view and user switcher such that the notifications receive
         // touches first but the panel gets drawn above.
-        if (child == mQsFrame) {
-            return super.drawChild(canvas, userSwitcherVisible && statusBarVisible ? mUserSwitcher
-                    : statusBarVisible ? mKeyguardStatusBar
-                    : userSwitcherVisible ? mUserSwitcher
-                    : stackQsBottom, drawingTime);
-        } else if (child == mStackScroller) {
-            return super.drawChild(canvas,
-                    userSwitcherVisible && statusBarVisible ? mKeyguardStatusBar
-                    : statusBarVisible || userSwitcherVisible ? stackQsBottom
-                    : stackQsTop,
-                    drawingTime);
-        } else if (child == mUserSwitcher) {
-            return super.drawChild(canvas,
-                    userSwitcherVisible && statusBarVisible ? stackQsBottom
-                    : stackQsTop,
-                    drawingTime);
-        } else if (child == mKeyguardStatusBar) {
-            return super.drawChild(canvas,
-                    stackQsTop,
-                    drawingTime);
+        mDrawingOrderedChildren.clear();
+        mLayoutDrawingOrder.clear();
+        if (mInflated && mUserSwitcher.getVisibility() == View.VISIBLE) {
+            mDrawingOrderedChildren.add(mUserSwitcher);
+            mLayoutDrawingOrder.add(mUserSwitcher);
+        }
+        if (mKeyguardStatusBar.getVisibility() == View.VISIBLE) {
+            mDrawingOrderedChildren.add(mKeyguardStatusBar);
+            mLayoutDrawingOrder.add(mKeyguardStatusBar);
+        }
+        if (mStackScroller.getVisibility() == View.VISIBLE) {
+            mDrawingOrderedChildren.add(mStackScroller);
+            mLayoutDrawingOrder.add(mStackScroller);
+        }
+        if (mQsFrame.getVisibility() == View.VISIBLE) {
+            mDrawingOrderedChildren.add(mQsFrame);
+            mLayoutDrawingOrder.add(mQsFrame);
+        }
+
+        if (mHasViewsAboveShelf) {
+            // StackScroller needs to be on top
+            mDrawingOrderedChildren.remove(mStackScroller);
+            mDrawingOrderedChildren.add(mStackScroller);
+        }
+
+        // Let's now find the order that the view has when drawing regulary by sorting
+        mLayoutDrawingOrder.sort(mIndexComparator);
+        super.dispatchDraw(canvas);
+    }
+
+    @Override
+    protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
+        int layoutIndex = mLayoutDrawingOrder.indexOf(child);
+        if (layoutIndex >= 0) {
+            return super.drawChild(canvas, mDrawingOrderedChildren.get(layoutIndex), drawingTime);
         } else {
             return super.drawChild(canvas, child, drawingTime);
         }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 8ad25bf..3cde493 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -811,8 +811,10 @@
         mNotificationIconAreaController = SystemUIFactory.getInstance()
                 .createNotificationIconAreaController(context, this,
                         mStatusBarStateController, mNotificationListener);
+        mWakeUpCoordinator.setIconAreaController(mNotificationIconAreaController);
         inflateShelf();
         mNotificationIconAreaController.setupShelf(mNotificationShelf);
+        mNotificationPanel.setOnReinflationListener(mNotificationIconAreaController::initAodIcons);
 
         Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mNotificationIconAreaController);
         // Allow plugins to reference DarkIconDispatcher and StatusBarStateController
@@ -1189,6 +1191,7 @@
         if (mAmbientIndicationContainer instanceof AutoReinflateContainer) {
             ((AutoReinflateContainer) mAmbientIndicationContainer).inflateLayout();
         }
+        mNotificationIconAreaController.onThemeChanged();
     }
 
     @Override
@@ -3666,8 +3669,9 @@
     private void updateNotificationPanelTouchState() {
         boolean goingToSleepWithoutAnimation = isGoingToSleep()
                 && !DozeParameters.getInstance(mContext).shouldControlScreenOff();
-        mNotificationPanel.setTouchAndAnimationDisabled((!mDeviceInteractive && !mPulsing)
-                || goingToSleepWithoutAnimation);
+        boolean disabled = (!mDeviceInteractive && !mPulsing) || goingToSleepWithoutAnimation;
+        mNotificationPanel.setTouchAndAnimationDisabled(disabled);
+        mNotificationIconAreaController.setAnimationsEnabled(!disabled);
     }
 
     final ScreenLifecycle.Observer mScreenObserver = new ScreenLifecycle.Observer() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index 7d5f23b..de26659 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -415,7 +415,6 @@
         }
         boolean intercept = false;
         if (mNotificationPanel.isFullyExpanded()
-                && stackScrollLayout.getVisibility() == View.VISIBLE
                 && mStatusBarStateController.getState() == StatusBarState.KEYGUARD
                 && !mService.isBouncerShowing()
                 && !mService.isDozing()) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
index 8077e3f..8d3c549 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
@@ -37,9 +37,7 @@
 import static org.mockito.Mockito.when;
 
 import android.app.AppOpsManager;
-import android.app.Notification;
 import android.app.NotificationChannel;
-import android.os.UserHandle;
 import android.testing.AndroidTestingRunner;
 import android.testing.TestableLooper;
 import android.testing.TestableLooper.RunWithLooper;
@@ -140,7 +138,7 @@
     @Test
     public void testIconColorShouldBeUpdatedWhenSettingDark() throws Exception {
         ExpandableNotificationRow row = spy(mNotificationTestHelper.createRow());
-        row.setDark(true, false, 0);
+        row.setDozing(true, false, 0);
         verify(row).updateShelfIconColor();
     }
 
@@ -212,7 +210,7 @@
     @Test
     public void testClickSound() throws Exception {
         assertTrue("Should play sounds by default.", mGroupRow.isSoundEffectsEnabled());
-        mGroupRow.setDark(true /* dark */, false /* fade */, 0 /* delay */);
+        mGroupRow.setDozing(true /* dark */, false /* fade */, 0 /* delay */);
         mGroupRow.setSecureStateProvider(()-> false);
         assertFalse("Shouldn't play sounds when dark and trusted.",
                 mGroupRow.isSoundEffectsEnabled());
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java
index 5cd0ca7..377aa0b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationContentViewTest.java
@@ -83,8 +83,8 @@
     @UiThreadTest
     public void animationStartType_getsClearedAfterUpdatingVisibilitiesWithoutAnimation() {
         mView.setHeadsUp(true);
-        mView.setDark(true, false, 0);
-        mView.setDark(false, true, 0);
+        mView.setDozing(true, false, 0);
+        mView.setDozing(false, true, 0);
         mView.setHeadsUpAnimatingAway(true);
         assertFalse(mView.isAnimatingVisibleType());
     }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
index 662edd2..c178046 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java
@@ -173,7 +173,6 @@
         doNothing().when(mGroupManager).collapseAllGroups();
         doNothing().when(mExpandHelper).cancelImmediately();
         doNothing().when(notificationShelf).setAnimationsEnabled(anyBoolean());
-        doNothing().when(notificationShelf).fadeInTranslating();
     }
 
     @After
@@ -194,9 +193,9 @@
     public void testAntiBurnInOffset() {
         final int burnInOffset = 30;
         mStackScroller.setAntiBurnInOffsetX(burnInOffset);
-        mStackScroller.setDarkAmount(0.0f, 0.0f);
+        mStackScroller.setHideAmount(0.0f, 0.0f);
         Assert.assertEquals(0 /* expected */, mStackScroller.getTranslationX(), 0.01 /* delta */);
-        mStackScroller.setDarkAmount(1.0f, 1.0f);
+        mStackScroller.setHideAmount(1.0f, 1.0f);
         Assert.assertEquals(burnInOffset /* expected */, mStackScroller.getTranslationX(),
                 0.01 /* delta */);
     }
@@ -386,7 +385,7 @@
         NotificationSwipeHelper swipeActionHelper =
                 (NotificationSwipeHelper) mStackScroller.getSwipeActionHelper();
         swipeActionHelper.setExposedMenuView(new View(mContext));
-        mStackScroller.setDarkAmount(0.1f, 0.1f);
+        mStackScroller.setHideAmount(0.1f, 0.1f);
         assertNull(swipeActionHelper.getExposedMenuView());
     }
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java
index 7f7a3e7..61b7530 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationIconAreaControllerTest.java
@@ -20,6 +20,7 @@
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
 
 import android.provider.Settings;
 import android.testing.AndroidTestingRunner;
@@ -27,6 +28,7 @@
 
 import androidx.test.filters.SmallTest;
 
+import com.android.systemui.R;
 import com.android.systemui.SysuiTestCase;
 import com.android.systemui.plugins.statusbar.StatusBarStateController;
 import com.android.systemui.statusbar.NotificationListener;
@@ -36,6 +38,7 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
+import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 
 @SmallTest
@@ -48,6 +51,10 @@
     @Mock
     StatusBar mStatusBar;
     @Mock
+    StatusBarWindowView mStatusBarWindowView;
+    @Mock
+    NotificationIconContainer mIconContainer;
+    @Mock
     StatusBarStateController mStatusBarStateController;
     @Mock
     private NotificationMediaManager mMediaManager;
@@ -56,7 +63,9 @@
     @Before
     public void setup() {
         MockitoAnnotations.initMocks(this);
-
+        when(mStatusBar.getStatusBarWindow()).thenReturn(mStatusBarWindowView);
+        when(mStatusBarWindowView.findViewById(R.id.clock_notification_icon_container)).thenReturn(
+                mIconContainer);
         mController = new NotificationIconAreaController(mContext, mStatusBar,
                 mStatusBarStateController, mListener, mMediaManager);
     }