New pulsing notification layout
Test: wake up with power
Test: look at shelf on lock screen
Test: lock device w/ notifications from home screen
Test: receive notification on AOD
Test: atest KeyguardClockPositionAlgorithmTest
Test: atest NotificationRoundnessManagerTest
Test: atest ScrimControllerTest
Test: atest NotificationContentViewTest
Bug: 111405682
Change-Id: I9b4f2febd56a62256124567bffebc9f5f8255847
diff --git a/packages/SystemUI/res-keyguard/values/dimens.xml b/packages/SystemUI/res-keyguard/values/dimens.xml
index 9245c30..e2ba23e 100644
--- a/packages/SystemUI/res-keyguard/values/dimens.xml
+++ b/packages/SystemUI/res-keyguard/values/dimens.xml
@@ -47,8 +47,6 @@
<dimen name="bottom_text_spacing_digital">0dp</dimen>
<!-- Slice subtitle -->
<dimen name="widget_label_font_size">16dp</dimen>
- <!-- Slice offset when pulsing -->
- <dimen name="widget_pulsing_bottom_padding">48dp</dimen>
<!-- Clock without header -->
<dimen name="widget_big_font_size">64dp</dimen>
<!-- Clock with header -->
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 5a00b45..ab0bbe1 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -66,9 +66,7 @@
<item name="status_bar_icon_scale_factor" format="float" type="dimen">1.0</item>
<dimen name="group_overflow_number_size">@*android:dimen/notification_text_size</dimen>
- <dimen name="group_overflow_number_size_dark">16sp</dimen>
<dimen name="group_overflow_number_padding">@*android:dimen/notification_content_margin_end</dimen>
- <dimen name="group_overflow_number_extra_padding_dark">@*android:dimen/notification_extra_margin_ambient</dimen>
<!-- max height of a notification such that the content can still fade out when closing -->
<dimen name="max_notification_fadeout_height">100dp</dimen>
@@ -94,9 +92,6 @@
<!-- Height of a large notification in the status bar -->
<dimen name="notification_max_height">294dp</dimen>
- <!-- Height of an ambient notification on ambient display -->
- <dimen name="notification_ambient_height">400dp</dimen>
-
<!-- Height of a heads up notification in the status bar for legacy custom views -->
<dimen name="notification_max_heads_up_height_legacy">128dp</dimen>
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 22a0b36..fa675b7 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -64,48 +64,16 @@
<item name="hybridNotificationTextStyle">@style/hybrid_notification_text</item>
</style>
- <style name="HybridNotification.Ambient">
- <item name="hybridNotificationStyle">@style/hybrid_notification_ambient</item>
- <item name="hybridNotificationTitleStyle">@style/hybrid_notification_title_ambient</item>
- <item name="hybridNotificationTextStyle">@style/hybrid_notification_text_ambient</item>
- </style>
-
- <style name="hybrid_notification_ambient">
- <item name="android:paddingStart">@*android:dimen/notification_extra_margin_ambient</item>
- <item name="android:paddingEnd">@*android:dimen/notification_extra_margin_ambient</item>
- <item name="android:orientation">vertical</item>
- </style>
-
<style name="hybrid_notification">
<item name="android:paddingStart">@*android:dimen/notification_content_margin_start</item>
<item name="android:paddingEnd">12dp</item>
</style>
- <style name="hybrid_notification_title_ambient">
- <item name="android:layout_marginTop">@*android:dimen/notification_header_margin_top_ambient</item>
- <item name="android:paddingStart">@*android:dimen/notification_content_margin_start</item>
- <item name="android:paddingEnd">@*android:dimen/notification_content_margin_end</item>
- <item name="android:textAppearance">@*android:style/Notification.Header.Ambient</item>
- <item name="android:layout_gravity">top|center_horizontal</item>
- <item name="android:textSize">@*android:dimen/notification_ambient_title_text_size</item>
- <item name="android:textColor">#ffffffff</item>
- </style>
-
<style name="hybrid_notification_title">
<item name="android:paddingEnd">4dp</item>
<item name="android:textAppearance">@*android:style/TextAppearance.Material.Notification.Title</item>
</style>
- <style name="hybrid_notification_text_ambient">
- <item name="android:paddingStart">@*android:dimen/notification_content_margin_start</item>
- <item name="android:paddingEnd">@*android:dimen/notification_content_margin_end</item>
- <item name="android:textSize">@*android:dimen/notification_ambient_text_size</item>
- <item name="android:textColor">#eeffffff</item>
- <item name="android:gravity">top|center_horizontal</item>
- <item name="android:ellipsize">end</item>
- <item name="android:maxLines">3</item>
- </style>
-
<style name="hybrid_notification_text"
parent="@*android:style/Widget.Material.Notification.Text">
<item name="android:paddingEnd">4dp</item>
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
index 669e6ff..bac7844 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
@@ -90,7 +90,7 @@
*/
private Runnable mContentChangeListener;
private Slice mSlice;
- private boolean mPulsing;
+ private boolean mHasHeader;
public KeyguardSliceView(Context context) {
this(context, null, 0);
@@ -150,10 +150,18 @@
Dependency.get(ConfigurationController.class).removeCallback(this);
}
+ /**
+ * Returns whether the current visible slice has a title/header.
+ */
+ public boolean hasHeader() {
+ return mHasHeader;
+ }
+
private void showSlice() {
Trace.beginSection("KeyguardSliceView#showSlice");
- if (mPulsing || mSlice == null) {
+ if (mSlice == null) {
mRow.setVisibility(GONE);
+ mHasHeader = false;
if (mContentChangeListener != null) {
mContentChangeListener.run();
}
@@ -162,7 +170,7 @@
ListContent lc = new ListContent(getContext(), mSlice);
SliceContent headerContent = lc.getHeader();
- boolean hasHeader = headerContent != null
+ mHasHeader = headerContent != null
&& !headerContent.getSliceItem().hasHint(HINT_LIST_ITEM);
List<SliceContent> subItems = new ArrayList<>();
for (int i = 0; i < lc.getRowItems().size(); i++) {
@@ -177,7 +185,7 @@
mClickActions.clear();
final int subItemsCount = subItems.size();
final int blendedColor = getTextColor();
- final int startIndex = hasHeader ? 1 : 0; // First item is header; skip it
+ final int startIndex = mHasHeader ? 1 : 0; // First item is header; skip it
mRow.setVisibility(subItemsCount > 0 ? VISIBLE : GONE);
for (int i = startIndex; i < subItemsCount; i++) {
RowContent rc = (RowContent) subItems.get(i);
@@ -189,7 +197,7 @@
button = new KeyguardSliceButton(mContext);
button.setTextColor(blendedColor);
button.setTag(itemTag);
- final int viewIndex = i - (hasHeader ? 1 : 0);
+ final int viewIndex = i - (mHasHeader ? 1 : 0);
mRow.addView(button, viewIndex);
}
@@ -234,18 +242,6 @@
Trace.endSection();
}
- public void setPulsing(boolean pulsing, boolean animate) {
- mPulsing = pulsing;
- LayoutTransition transition = getLayoutTransition();
- if (!animate) {
- setLayoutTransition(null);
- }
- showSlice();
- if (!animate) {
- setLayoutTransition(transition);
- }
- }
-
public void setDarkAmount(float darkAmount) {
mDarkAmount = darkAmount;
mRow.setDarkAmount(darkAmount);
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
index 7ae4c41..bb549ad 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
@@ -72,7 +72,6 @@
private ArraySet<View> mVisibleInDoze;
private boolean mPulsing;
- private boolean mWasPulsing;
private float mDarkAmount = 0;
private int mTextColor;
private int mLastLayoutHeight;
@@ -210,7 +209,7 @@
private void onSliceContentChanged() {
LinearLayout.LayoutParams layoutParams =
(LinearLayout.LayoutParams) mClockView.getLayoutParams();
- layoutParams.bottomMargin = mPulsing ? mSmallClockPadding : 0;
+ layoutParams.bottomMargin = mKeyguardSlice.hasHeader() ? mSmallClockPadding : 0;
mClockView.setLayoutParams(layoutParams);
}
@@ -220,16 +219,16 @@
@Override
public void onLayoutChange(View view, int left, int top, int right, int bottom,
int oldLeft, int oldTop, int oldRight, int oldBottom) {
- int heightOffset = mPulsing || mWasPulsing ? 0 : getHeight() - mLastLayoutHeight;
+ boolean smallClock = mKeyguardSlice.hasHeader();
+ int heightOffset = smallClock ? 0 : getHeight() - mLastLayoutHeight;
long duration = KeyguardSliceView.DEFAULT_ANIM_DURATION;
- long delay = mPulsing || mWasPulsing ? 0 : duration / 4;
- mWasPulsing = false;
+ long delay = smallClock ? 0 : duration / 4;
boolean shouldAnimate = mKeyguardSlice.getLayoutTransition() != null
&& mKeyguardSlice.getLayoutTransition().isRunning();
if (view == mClockView) {
- float clockScale = mPulsing ? mSmallClockScale : 1;
- Paint.Style style = mPulsing ? Paint.Style.FILL_AND_STROKE : Paint.Style.FILL;
+ float clockScale = smallClock ? mSmallClockScale : 1;
+ Paint.Style style = smallClock ? Paint.Style.FILL_AND_STROKE : Paint.Style.FILL;
mClockView.animate().cancel();
if (shouldAnimate) {
mClockView.setY(oldTop + heightOffset);
@@ -434,15 +433,11 @@
}
}
- public void setPulsing(boolean pulsing, boolean animate) {
+ public void setPulsing(boolean pulsing) {
if (mPulsing == pulsing) {
return;
}
- if (mPulsing) {
- mWasPulsing = true;
- }
mPulsing = pulsing;
- mKeyguardSlice.setPulsing(pulsing, animate);
updateDozeVisibleViews();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
index bd9ca1a..9ef9c94 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
@@ -65,12 +65,12 @@
private static final String TAG = "NotificationShelf";
private static final long SHELF_IN_TRANSLATION_DURATION = 200;
- private boolean mDark;
private NotificationIconContainer mShelfIcons;
private int[] mTmp = new int[2];
private boolean mHideBackground;
private int mIconAppearTopPadding;
private int mShelfAppearTranslation;
+ private float mDarkShelfPadding;
private int mStatusBarHeight;
private int mStatusBarPaddingStart;
private AmbientState mAmbientState;
@@ -140,6 +140,7 @@
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);
@@ -165,11 +166,11 @@
@Override
public void setDark(boolean dark, boolean fade, long delay) {
- super.setDark(dark, fade, delay);
if (mDark == dark) return;
- mDark = dark;
+ super.setDark(dark, fade, delay);
mShelfIcons.setDark(dark, fade, delay);
updateInteractiveness();
+ updateOutline();
}
/**
@@ -218,10 +219,9 @@
float awakenTranslation = Math.max(Math.min(viewEnd, maxShelfEnd) - viewState.height,
getFullyClosedTranslation());
- float darkTranslation = mAmbientState.getDarkTopPadding();
float yRatio = mAmbientState.hasPulsingNotifications() ?
0 : mAmbientState.getDarkAmount();
- viewState.yTranslation = MathUtils.lerp(awakenTranslation, darkTranslation, yRatio);
+ 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.
@@ -763,18 +763,14 @@
}
}
- public boolean hidesBackground() {
- return mHideBackground;
- }
-
@Override
protected boolean needsOutline() {
- return !mHideBackground && super.needsOutline();
+ return !mHideBackground && !mDark && super.needsOutline();
}
@Override
protected boolean shouldHideBackground() {
- return super.shouldHideBackground() || mHideBackground;
+ return super.shouldHideBackground() || mHideBackground || mDark;
}
@Override
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 8b0a682..c34d567 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
@@ -105,7 +105,7 @@
private final DoubleTapHelper mDoubleTapHelper;
private boolean mDimmed;
- private boolean mDark;
+ protected boolean mDark;
protected int mBgTint = NO_COLOR;
private float mBgAlpha = 1f;
@@ -140,7 +140,6 @@
private FalsingManager mFalsingManager;
private float mNormalBackgroundVisibilityAmount;
- private ValueAnimator mFadeInFromDarkAnimator;
private float mDimmedBackgroundFadeInAmount = -1;
private ValueAnimator.AnimatorUpdateListener mBackgroundVisibilityUpdater
= new ValueAnimator.AnimatorUpdateListener() {
@@ -150,22 +149,6 @@
mDimmedBackgroundFadeInAmount = mBackgroundDimmed.getAlpha();
}
};
- private AnimatorListenerAdapter mFadeInEndListener = new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- mFadeInFromDarkAnimator = null;
- mDimmedBackgroundFadeInAmount = -1;
- updateBackground();
- }
- };
- private ValueAnimator.AnimatorUpdateListener mUpdateOutlineListener
- = new ValueAnimator.AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- updateOutlineAlpha();
- }
- };
private FakeShadowView mFakeShadow;
private int mCurrentBackgroundTint;
private int mTargetTint;
@@ -465,22 +448,11 @@
mDark = dark;
updateBackground();
updateBackgroundTint(false);
- if (!dark && fade && !shouldHideBackground()) {
- fadeInFromDark(delay);
- }
- updateOutlineAlpha();
}
private void updateOutlineAlpha() {
- if (mDark) {
- setOutlineAlpha(0f);
- return;
- }
float alpha = NotificationStackScrollLayout.BACKGROUND_ALPHA_DIMMED;
alpha = (alpha + (1.0f - alpha) * mNormalBackgroundVisibilityAmount);
- if (mFadeInFromDarkAnimator != null) {
- alpha *= mFadeInFromDarkAnimator.getAnimatedFraction();
- }
setOutlineAlpha(alpha);
}
@@ -638,36 +610,6 @@
}
/**
- * Fades in the background when exiting dark mode.
- */
- private void fadeInFromDark(long delay) {
- final View background = mDimmed ? mBackgroundDimmed : mBackgroundNormal;
- background.setAlpha(0f);
- mBackgroundVisibilityUpdater.onAnimationUpdate(null);
- background.animate()
- .alpha(1f)
- .setDuration(DARK_ANIMATION_LENGTH)
- .setStartDelay(delay)
- .setInterpolator(Interpolators.ALPHA_IN)
- .setListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationCancel(Animator animation) {
- // Jump state if we are cancelled
- background.setAlpha(1f);
- }
- })
- .setUpdateListener(mBackgroundVisibilityUpdater)
- .start();
- mFadeInFromDarkAnimator = TimeAnimator.ofFloat(0.0f, 1.0f);
- mFadeInFromDarkAnimator.setDuration(DARK_ANIMATION_LENGTH);
- mFadeInFromDarkAnimator.setStartDelay(delay);
- mFadeInFromDarkAnimator.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
- mFadeInFromDarkAnimator.addListener(mFadeInEndListener);
- mFadeInFromDarkAnimator.addUpdateListener(mUpdateOutlineListener);
- mFadeInFromDarkAnimator.start();
- }
-
- /**
* Fades the background when the dimmed state changes.
*/
private void fadeDimmedBackground() {
@@ -708,9 +650,7 @@
public void onAnimationEnd(Animator animation) {
updateBackground();
mBackgroundAnimator = null;
- if (mFadeInFromDarkAnimator == null) {
- mDimmedBackgroundFadeInAmount = -1;
- }
+ mDimmedBackgroundFadeInAmount = -1;
}
});
mBackgroundAnimator.addUpdateListener(mBackgroundVisibilityUpdater);
@@ -736,7 +676,7 @@
mBackgroundNormal.setVisibility(mActivated ? VISIBLE : INVISIBLE);
} else if (mDimmed) {
// When groups are animating to the expanded state from the lockscreen, show the
- // normal background instead of the dimmed background
+ // normal background instead of the dimmed background.
final boolean dontShowDimmed = isGroupExpansionChanging() && isChildInGroup();
mBackgroundDimmed.setVisibility(dontShowDimmed ? View.INVISIBLE : View.VISIBLE);
mBackgroundNormal.setVisibility((mActivated || dontShowDimmed)
@@ -760,7 +700,7 @@
}
protected boolean shouldHideBackground() {
- return mDark;
+ return false;
}
private void cancelFadeAnimations() {
@@ -1023,14 +963,11 @@
/**
* @param withTint should a possible tint be factored in?
- * @param withOverRide should the value be interpolated with {@link #mOverrideTint}
+ * @param withOverride should the value be interpolated with {@link #mOverrideTint}
* @return the calculated background color
*/
- private int calculateBgColor(boolean withTint, boolean withOverRide) {
- if (withTint && mDark) {
- return getContext().getColor(R.color.notification_material_background_dark_color);
- }
- if (withOverRide && mOverrideTint != NO_COLOR) {
+ private int calculateBgColor(boolean withTint, boolean withOverride) {
+ if (withOverride && mOverrideTint != NO_COLOR) {
int defaultTint = calculateBgColor(withTint, false);
return NotificationUtils.interpolateColors(defaultTint, mOverrideTint, mOverrideAmount);
}
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 df0189f..296c061 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
@@ -132,7 +132,6 @@
}
private LayoutListener mLayoutListener;
- private boolean mDark;
private boolean mLowPriorityStateUpdated;
private final NotificationInflater mNotificationInflater;
private int mIconTransformContentShift;
@@ -146,7 +145,6 @@
private int mNotificationMinHeight;
private int mNotificationMinHeightLarge;
private int mNotificationMaxHeight;
- private int mNotificationAmbientHeight;
private int mIncreasedPaddingBetweenElements;
private int mNotificationLaunchHeight;
private boolean mMustStayOnScreen;
@@ -677,8 +675,7 @@
if (headsUpWrapper != null) {
headsUpHeight = Math.max(headsUpHeight, headsUpWrapper.getMinLayoutHeight());
}
- layout.setHeights(minHeight, headsUpHeight, mNotificationMaxHeight,
- mNotificationAmbientHeight);
+ layout.setHeights(minHeight, headsUpHeight, mNotificationMaxHeight, headsUpHeight);
}
public StatusBarNotification getStatusBarNotification() {
@@ -1647,8 +1644,6 @@
R.dimen.notification_min_height_increased);
mNotificationMaxHeight = NotificationUtils.getFontScaledHeight(mContext,
R.dimen.notification_max_height);
- mNotificationAmbientHeight = NotificationUtils.getFontScaledHeight(mContext,
- R.dimen.notification_ambient_height);
mMaxHeadsUpHeightBeforeN = NotificationUtils.getFontScaledHeight(mContext,
R.dimen.notification_max_heads_up_height_legacy);
mMaxHeadsUpHeightBeforeP = NotificationUtils.getFontScaledHeight(mContext,
@@ -2008,8 +2003,10 @@
@Override
public void setDark(boolean dark, boolean fade, long delay) {
+ if (mDark == dark) {
+ return;
+ }
super.setDark(dark, fade, delay);
- mDark = dark;
if (!mIsAmbientPulsing) {
// Only fade the showing view of the pulsing notification.
fade = false;
@@ -2018,9 +2015,6 @@
if (showing != null) {
showing.setDark(dark, fade, delay);
}
- if (mIsSummaryWithChildren) {
- mChildrenContainer.setDark(dark, fade, delay);
- }
updateShelfIconColor();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridGroupManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridGroupManager.java
index 33badaf..90ff4a7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridGroupManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridGroupManager.java
@@ -39,14 +39,10 @@
private final NotificationDozeHelper mDozer;
private final ViewGroup mParent;
- private float mOverflowNumberSizeDark;
- private int mOverflowNumberPaddingDark;
private float mOverflowNumberSize;
private int mOverflowNumberPadding;
private int mOverflowNumberColor;
- private int mOverflowNumberColorDark;
- private float mDarkAmount = 0f;
public HybridGroupManager(Context ctx, ViewGroup parent) {
mContext = ctx;
@@ -59,12 +55,8 @@
Resources res = mContext.getResources();
mOverflowNumberSize = res.getDimensionPixelSize(
R.dimen.group_overflow_number_size);
- mOverflowNumberSizeDark = res.getDimensionPixelSize(
- R.dimen.group_overflow_number_size_dark);
mOverflowNumberPadding = res.getDimensionPixelSize(
R.dimen.group_overflow_number_padding);
- mOverflowNumberPaddingDark = mOverflowNumberPadding + res.getDimensionPixelSize(
- R.dimen.group_overflow_number_extra_padding_dark);
}
private HybridNotificationView inflateHybridViewWithStyle(int style) {
@@ -86,13 +78,11 @@
}
private void updateOverFlowNumberColor(TextView numberView) {
- numberView.setTextColor(NotificationUtils.interpolateColors(
- mOverflowNumberColor, mOverflowNumberColorDark, mDarkAmount));
+ numberView.setTextColor(mOverflowNumberColor);
}
- public void setOverflowNumberColor(TextView numberView, int colorRegular, int colorDark) {
+ public void setOverflowNumberColor(TextView numberView, int colorRegular) {
mOverflowNumberColor = colorRegular;
- mOverflowNumberColorDark = colorDark;
if (numberView != null) {
updateOverFlowNumberColor(numberView);
}
@@ -107,7 +97,7 @@
public HybridNotificationView bindAmbientFromNotification(HybridNotificationView reusableView,
Notification notification) {
return bindFromNotificationWithStyle(reusableView, notification,
- R.style.HybridNotification_Ambient);
+ R.style.HybridNotification);
}
private HybridNotificationView bindFromNotificationWithStyle(
@@ -150,6 +140,11 @@
R.plurals.notification_group_overflow_description, number), number);
reusableView.setContentDescription(contentDescription);
+ reusableView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mOverflowNumberSize);
+ reusableView.setPaddingRelative(reusableView.getPaddingStart(),
+ reusableView.getPaddingTop(), mOverflowNumberPadding,
+ reusableView.getPaddingBottom());
+ updateOverFlowNumberColor(reusableView);
return reusableView;
}
@@ -163,16 +158,4 @@
}
return titleView;
}
-
- public void setOverflowNumberDark(TextView view, boolean dark, boolean fade, long delay) {
- mDozer.setIntensityDark((f)->{
- mDarkAmount = f;
- updateOverFlowNumberColor(view);
- }, dark, fade, delay, view);
- view.setTextSize(TypedValue.COMPLEX_UNIT_PX,
- dark ? mOverflowNumberSizeDark : mOverflowNumberSize);
- int paddingEnd = dark ? mOverflowNumberPaddingDark : mOverflowNumberPadding;
- view.setPaddingRelative(view.getPaddingStart(), view.getPaddingTop(), paddingEnd,
- view.getPaddingBottom());
- }
}
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 cbec37e..1b5013d 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
@@ -75,7 +75,6 @@
private int mIntrinsicPadding;
private int mExpandAnimationTopChange;
private ExpandableNotificationRow mExpandingNotification;
- private int mDarkTopPadding;
private float mDarkAmount;
private boolean mAppearing;
@@ -351,7 +350,8 @@
}
public boolean hasPulsingNotifications() {
- return mPulsing;
+ return mPulsing && mAmbientPulseManager != null
+ && mAmbientPulseManager.hasNotifications();
}
public void setPulsing(boolean hasPulsing) {
@@ -458,14 +458,6 @@
return mDarkAmount != 0;
}
- public void setDarkTopPadding(int darkTopPadding) {
- mDarkTopPadding = darkTopPadding;
- }
-
- public int getDarkTopPadding() {
- return mDarkTopPadding;
- }
-
public void setAppearing(boolean appearing) {
mAppearing = appearing;
}
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 5118036..8ffada4 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
@@ -316,7 +316,7 @@
StatusBarNotification notification = mContainingNotification.getStatusBarNotification();
final Notification.Builder builder = Notification.Builder.recoverBuilder(getContext(),
notification.getNotification());
- RemoteViews header = builder.makeNotificationHeader(false /* ambient */);
+ RemoteViews header = builder.makeNotificationHeader();
if (mNotificationHeader == null) {
mNotificationHeader = (NotificationHeaderView) header.apply(getContext(), this);
final View expandButton = mNotificationHeader.findViewById(
@@ -344,7 +344,7 @@
builder = Notification.Builder.recoverBuilder(getContext(),
notification.getNotification());
}
- header = builder.makeNotificationHeader(true /* ambient */);
+ header = builder.makeNotificationHeader();
if (mNotificationHeaderAmbient == null) {
mNotificationHeaderAmbient = (ViewGroup) header.apply(getContext(), this);
mNotificationHeaderWrapperAmbient = NotificationViewWrapper.wrap(getContext(),
@@ -1171,12 +1171,6 @@
return mIsLowPriority && !mContainingNotification.isExpanded();
}
- public void setDark(boolean dark, boolean fade, long delay) {
- if (mOverflowNumber != null) {
- mHybridGroupManager.setOverflowNumberDark(mOverflowNumber, dark, fade, delay);
- }
- }
-
public void reInflateViews(OnClickListener listener, StatusBarNotification notification) {
if (mNotificationHeader != null) {
removeView(mNotificationHeader);
@@ -1227,8 +1221,7 @@
public void onNotificationUpdated() {
mHybridGroupManager.setOverflowNumberColor(mOverflowNumber,
- mContainingNotification.getNotificationColor(),
- mContainingNotification.getNotificationColorAmbient());
+ mContainingNotification.getNotificationColor());
}
public int getPositionInLinearLayout(View childInGroup) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java
index 9418601..c5ab9f6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java
@@ -18,6 +18,7 @@
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.NUM_SECTIONS;
+import com.android.systemui.statusbar.AmbientPulseManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
@@ -26,26 +27,34 @@
import java.util.HashSet;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
/**
* A class that manages the roundness for notification views
*/
-class NotificationRoundnessManager implements OnHeadsUpChangedListener {
+@Singleton
+class NotificationRoundnessManager implements OnHeadsUpChangedListener,
+ AmbientPulseManager.OnAmbientChangedListener {
+ private final ActivatableNotificationView[] mFirstInSectionViews;
+ private final ActivatableNotificationView[] mLastInSectionViews;
+ private final ActivatableNotificationView[] mTmpFirstInSectionViews;
+ private final ActivatableNotificationView[] mTmpLastInSectionViews;
private boolean mExpanded;
- private ActivatableNotificationView[] mFirstInSectionViews;
- private ActivatableNotificationView[] mLastInSectionViews;
- private ActivatableNotificationView[] mTmpFirstInSectionViews;
- private ActivatableNotificationView[] mTmpLastInSectionViews;
private HashSet<ExpandableView> mAnimatedChildren;
private Runnable mRoundingChangedCallback;
private ExpandableNotificationRow mTrackedHeadsUp;
+ private ActivatableNotificationView mTrackedAmbient;
private float mAppearFraction;
- NotificationRoundnessManager() {
+ @Inject
+ NotificationRoundnessManager(AmbientPulseManager ambientPulseManager) {
mFirstInSectionViews = new ActivatableNotificationView[NUM_SECTIONS];
mLastInSectionViews = new ActivatableNotificationView[NUM_SECTIONS];
mTmpFirstInSectionViews = new ActivatableNotificationView[NUM_SECTIONS];
mTmpLastInSectionViews = new ActivatableNotificationView[NUM_SECTIONS];
+ ambientPulseManager.addListener(this);
}
@Override
@@ -63,6 +72,17 @@
updateView(row, false /* animate */);
}
+ @Override
+ public void onAmbientStateChanged(NotificationEntry entry, boolean isPulsing) {
+ ActivatableNotificationView row = entry.getRow();
+ if (isPulsing) {
+ mTrackedAmbient = row;
+ } else if (mTrackedAmbient == row) {
+ mTrackedAmbient = null;
+ }
+ updateView(row, false /* animate */);
+ }
+
private void updateView(ActivatableNotificationView view, boolean animate) {
boolean changed = updateViewWithoutCallback(view, animate);
if (changed) {
@@ -125,6 +145,9 @@
// rounded.
return 1.0f;
}
+ if (view == mTrackedAmbient) {
+ return 1.0f;
+ }
return 0.0f;
}
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 a9b7972..c896d12 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
@@ -201,12 +201,7 @@
private int mPaddingBetweenElements;
private int mIncreasedPaddingBetweenElements;
private int mMaxTopPadding;
- private int mRegularTopPadding;
- private int mDarkTopPadding;
- // Current padding, will be either mRegularTopPadding or mDarkTopPadding
private int mTopPadding;
- // Distance between AOD separator and shelf
- private int mDarkShelfPadding;
private int mBottomMargin;
private int mBottomInset = 0;
private float mQsExpansionFraction;
@@ -318,7 +313,7 @@
private HashSet<Pair<ExpandableNotificationRow, Boolean>> mHeadsUpChangeAnimations
= new HashSet<>();
private HeadsUpManagerPhone mHeadsUpManager;
- private NotificationRoundnessManager mRoundnessManager = new NotificationRoundnessManager();
+ private final NotificationRoundnessManager mRoundnessManager;
private boolean mTrackingHeadsUp;
private ScrimController mScrimController;
private boolean mForceNoOverlappingRendering;
@@ -469,7 +464,8 @@
public NotificationStackScrollLayout(
@Named(VIEW_CONTEXT) Context context,
AttributeSet attrs,
- @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) boolean allowLongPress) {
+ @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) boolean allowLongPress,
+ NotificationRoundnessManager notificationRoundnessManager) {
super(context, attrs, 0, 0);
Resources res = getResources();
@@ -480,6 +476,7 @@
}
mAmbientState = new AmbientState(context);
+ mRoundnessManager = notificationRoundnessManager;
mBgColor = context.getColor(R.color.notification_shade_background_color);
int minHeight = res.getDimensionPixelSize(R.dimen.notification_min_height);
int maxHeight = res.getDimensionPixelSize(R.dimen.notification_max_height);
@@ -496,7 +493,6 @@
res.getBoolean(R.bool.config_drawNotificationBackground);
mFadeNotificationsOnDismiss =
res.getBoolean(R.bool.config_fadeNotificationsOnDismiss);
- mDarkShelfPadding = res.getDimensionPixelSize(R.dimen.widget_bottom_separator_padding);
mRoundnessManager.setAnimatedChildren(mChildrenToAddAnimated);
mRoundnessManager.setOnRoundingChangedCallback(this::invalidate);
addOnExpandedHeightListener(mRoundnessManager::setExpanded);
@@ -685,7 +681,7 @@
int lockScreenTop = mSections[0].getCurrentBounds().top;
int lockScreenBottom = mSections[NUM_SECTIONS - 1].getCurrentBounds().bottom;
int darkLeft = getWidth() / 2;
- int darkTop = mRegularTopPadding;
+ int darkTop = mTopPadding;
float yProgress = 1 - mInterpolatedDarkAmount;
float xProgress = mDarkXInterpolator.getInterpolation(
@@ -953,8 +949,6 @@
@ShadeViewRefactor(RefactorComponent.LAYOUT_ALGORITHM)
private void updateAlgorithmHeightAndPadding() {
- mTopPadding = (int) MathUtils.lerp(mRegularTopPadding, mDarkTopPadding,
- mInterpolatedDarkAmount);
mAmbientState.setLayoutHeight(getLayoutHeight());
updateAlgorithmLayoutMinHeight();
mAmbientState.setTopPadding(mTopPadding);
@@ -1092,10 +1086,8 @@
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
private void setTopPadding(int topPadding, boolean animate) {
- if (mRegularTopPadding != topPadding) {
- mRegularTopPadding = topPadding;
- mDarkTopPadding = topPadding + mDarkShelfPadding;
- mAmbientState.setDarkTopPadding(mDarkTopPadding);
+ if (mTopPadding != topPadding) {
+ mTopPadding = topPadding;
updateAlgorithmHeightAndPadding();
updateContentHeight();
if (animate && mAnimationsEnabled && mIsExpanded) {
@@ -2060,10 +2052,7 @@
}
mIntrinsicContentHeight = height;
- // We don't want to use the toppadding since that might be interpolated and we want
- // to take the final value of the animation.
- int topPadding = mAmbientState.isFullyDark() ? mDarkTopPadding : mRegularTopPadding;
- mContentHeight = height + topPadding + mBottomMargin;
+ mContentHeight = height + mTopPadding + mBottomMargin;
updateScrollability();
clampScrollPosition();
mAmbientState.setLayoutMaxHeight(mContentHeight);
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 19fce48..b4c205a 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
@@ -426,6 +426,9 @@
mTmpState.yTranslation += mPulsingAppearingTranslation;
mTmpState.alpha = 0;
mTmpState.applyToView(changingView);
+
+ mTmpState.copyFrom(mShelf.getViewState());
+ mTmpState.applyToView(mShelf);
}
} else if (event.animationType == NotificationStackScrollLayout
.AnimationEvent.ANIMATION_TYPE_PULSE_DISAPPEAR) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java
index 6f2b63d..1049773 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java
@@ -158,8 +158,7 @@
* @return duration in millis.
*/
public long getWallpaperAodDuration() {
- if (mAmbientDisplayConfiguration.wakeLockScreenGestureEnabled(UserHandle.USER_CURRENT)
- || shouldControlScreenOff()) {
+ if (shouldControlScreenOff()) {
return DozeScreenState.ENTER_DOZE_HIDE_WALLPAPER_DELAY;
}
return mAlwaysOnPolicy.wallpaperVisibilityDuration;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java
index 577e8d6..280dda0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java
@@ -84,14 +84,6 @@
public void onCancelled() {
pulseFinished();
}
-
- /**
- * Whether to fade out wallpaper.
- */
- @Override
- public boolean isFadeOutWallpaper() {
- return mPulseReason == DozeLog.PULSE_REASON_DOCKING;
- }
};
public DozeScrimController(DozeParameters dozeParameters) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
index a81b7e5..c68fdd4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
@@ -91,11 +91,6 @@
private int mBurnInPreventionOffsetY;
/**
- * Clock vertical padding when pulsing.
- */
- private int mPulsingPadding;
-
- /**
* Doze/AOD transition amount.
*/
private float mDarkAmount;
@@ -105,10 +100,6 @@
*/
private boolean mCurrentlySecure;
- /**
- * Dozing and receiving a notification (AOD notification.)
- */
- private boolean mPulsing;
private float mEmptyDragAmount;
/**
@@ -123,13 +114,11 @@
R.dimen.burn_in_prevention_offset_x);
mBurnInPreventionOffsetY = res.getDimensionPixelSize(
R.dimen.burn_in_prevention_offset_y);
- mPulsingPadding = res.getDimensionPixelSize(
- R.dimen.widget_pulsing_bottom_padding);
}
public void setup(int minTopMargin, int maxShadeBottom, int notificationStackHeight,
float panelExpansion, int parentHeight, int keyguardStatusHeight, float dark,
- boolean secure, boolean pulsing, float emptyDragAmount) {
+ boolean secure, float emptyDragAmount) {
mMinTopMargin = minTopMargin + mContainerTopPadding;
mMaxShadeBottom = maxShadeBottom;
mNotificationStackHeight = notificationStackHeight;
@@ -138,7 +127,6 @@
mKeyguardStatusHeight = keyguardStatusHeight;
mDarkAmount = dark;
mCurrentlySecure = secure;
- mPulsing = pulsing;
mEmptyDragAmount = emptyDragAmount;
}
@@ -146,7 +134,7 @@
final int y = getClockY();
result.clockY = y;
result.clockAlpha = getClockAlpha(y);
- result.stackScrollerPadding = y + (mPulsing ? mPulsingPadding : mKeyguardStatusHeight);
+ result.stackScrollerPadding = y + mKeyguardStatusHeight;
result.clockX = (int) interpolate(0, burnInPreventionOffsetX(), mDarkAmount);
}
@@ -185,9 +173,6 @@
private int getClockY() {
// Dark: Align the bottom edge of the clock at about half of the screen:
float clockYDark = getMaxClockY() + burnInPreventionOffsetY();
- if (mPulsing) {
- clockYDark -= mPulsingPadding;
- }
clockYDark = MathUtils.max(0, clockYDark);
float clockYRegular = getExpandedClockPosition();
@@ -230,11 +215,6 @@
- mBurnInPreventionOffsetX;
}
- @VisibleForTesting
- void setPulsingPadding(int padding) {
- mPulsingPadding = padding;
- }
-
public static class Result {
/**
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 32cc0e6..0d5ebb9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -579,7 +579,6 @@
mKeyguardStatusView.getHeight(),
mInterpolatedDarkAmount,
mStatusBar.isKeyguardCurrentlySecure(),
- mPulsing,
mEmptyDragAmount);
mClockPositionAlgorithm.run(mClockPositionResult);
PropertyAnimator.setProperty(mKeyguardStatusView, AnimatableProperty.X,
@@ -595,7 +594,8 @@
stackScrollerPadding = mClockPositionResult.stackScrollerPadding;
}
mNotificationStackScroller.setIntrinsicPadding(stackScrollerPadding);
- mNotificationStackScroller.setAntiBurnInOffsetX(mClockPositionResult.clockX);
+ int burnInXOffset = mPulsing ? 0 : mClockPositionResult.clockX;
+ mNotificationStackScroller.setAntiBurnInOffsetX(burnInXOffset);
mStackScrollerMeasuringPass++;
requestScrollerTopPaddingUpdate(animate);
@@ -2830,7 +2830,7 @@
mAnimateNextPositionUpdate = false;
}
mNotificationStackScroller.setPulsing(pulsing, animatePulse);
- mKeyguardStatusView.setPulsing(pulsing, animatePulse);
+ mKeyguardStatusView.setPulsing(pulsing);
mKeyguardBottomArea.setPulsing(pulsing, animatePulse);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index 6deff82..bf143c8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -274,8 +274,7 @@
// Docking pulses may take a long time, wallpapers should also fade away after a while.
if (mWallpaperSupportsAmbientMode && (
mDozeParameters.getAlwaysOn() && mState == ScrimState.AOD
- || mState == ScrimState.PULSING && mCallback != null
- && mCallback.isFadeOutWallpaper())) {
+ || mState == ScrimState.PULSING && mCallback != null)) {
if (!mWallpaperVisibilityTimedOut) {
mTimeTicker.schedule(mDozeParameters.getWallpaperAodDuration(),
AlarmTimeout.MODE_IGNORE_IF_SCHEDULED);
@@ -900,6 +899,10 @@
}
}
+ public void setPulseReason(int pulseReason) {
+ ScrimState.PULSING.setPulseReason(pulseReason);
+ }
+
public interface Callback {
default void onStart() {
}
@@ -909,9 +912,6 @@
}
default void onCancelled() {
}
- default boolean isFadeOutWallpaper() {
- return false;
- }
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
index a68c751..11a2d32 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
@@ -19,6 +19,7 @@
import android.graphics.Color;
import android.os.Trace;
+import com.android.systemui.doze.DozeLog;
import com.android.systemui.statusbar.ScrimView;
import com.android.systemui.statusbar.notification.stack.StackStateAnimator;
@@ -125,8 +126,15 @@
PULSING(5) {
@Override
public void prepare(ScrimState previousState) {
- mCurrentInFrontAlpha = 0;
- mCurrentBehindAlpha = mScrimBehindAlphaKeyguard;
+ mCurrentInFrontAlpha = 0f;
+ if (mPulseReason == DozeLog.PULSE_REASON_NOTIFICATION
+ || mPulseReason == DozeLog.PULSE_REASON_DOCKING) {
+ mCurrentBehindAlpha = previousState.getBehindAlpha();
+ mCurrentBehindTint = Color.BLACK;
+ } else {
+ mCurrentBehindAlpha = mScrimBehindAlphaKeyguard;
+ mCurrentBehindTint = Color.TRANSPARENT;
+ }
mBlankScreen = mDisplayRequiresBlanking;
}
},
@@ -189,6 +197,7 @@
int mIndex;
boolean mHasBackdrop;
boolean mLaunchingAffordanceWithPreview;
+ int mPulseReason;
ScrimState(int index) {
mIndex = index;
@@ -261,6 +270,10 @@
mAodFrontScrimAlpha = aodFrontScrimAlpha;
}
+ public void setPulseReason(int pulseReason) {
+ mPulseReason = pulseReason;
+ }
+
public void setScrimBehindAlphaKeyguard(float scrimBehindAlphaKeyguard) {
mScrimBehindAlphaKeyguard = scrimBehindAlphaKeyguard;
}
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 ed71598..1470d0f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -3883,6 +3883,7 @@
@Override
public void pulseWhileDozing(@NonNull PulseCallback callback, int reason) {
+ mScrimController.setPulseReason(reason);
if (reason == DozeLog.PULSE_REASON_SENSOR_LONG_PRESS) {
mPowerManager.wakeUp(SystemClock.uptimeMillis(), "com.android.systemui:NODOZE");
startAssist(new Bundle());
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java
index 8ae7d52..ff30a4d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java
@@ -29,7 +29,10 @@
import android.testing.TestableLooper.RunWithLooper;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.statusbar.AmbientPulseManager;
import com.android.systemui.statusbar.NotificationTestHelper;
+import com.android.systemui.statusbar.notification.collection.NotificationEntry;
+import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableView;
@@ -37,6 +40,8 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import java.util.HashSet;
@@ -45,14 +50,18 @@
@RunWithLooper
public class NotificationRoundnessManagerTest extends SysuiTestCase {
- private NotificationRoundnessManager mRoundnessManager = new NotificationRoundnessManager();
+ private NotificationRoundnessManager mRoundnessManager;
private HashSet<ExpandableView> mAnimatedChildren = new HashSet<>();
private Runnable mRoundnessCallback = mock(Runnable.class);
private ExpandableNotificationRow mFirst;
private ExpandableNotificationRow mSecond;
+ @Mock
+ private AmbientPulseManager mAmbientPulseManager;
@Before
public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ mRoundnessManager = new NotificationRoundnessManager(mAmbientPulseManager);
com.android.systemui.util.Assert.sMainLooper = TestableLooper.get(this).getLooper();
NotificationTestHelper testHelper = new NotificationTestHelper(getContext());
mFirst = testHelper.createRow();
@@ -127,6 +136,27 @@
}
@Test
+ public void testRoundnessPulsing() throws Exception {
+ // Let's create a notification that's neither the first or last item of the stack,
+ // this way we'll ensure that it won't have any rounded corners by default.
+ mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
+ createSection(mFirst, mSecond),
+ createSection(null, null)
+ });
+ ExpandableNotificationRow row = new NotificationTestHelper(getContext()).createRow();
+ NotificationEntry entry = mock(NotificationEntry.class);
+ when(entry.getRow()).thenReturn(row);
+
+ mRoundnessManager.onAmbientStateChanged(entry, true);
+ Assert.assertEquals(1f, row.getCurrentBottomRoundness(), 0.0f);
+ Assert.assertEquals(1f, row.getCurrentTopRoundness(), 0.0f);
+
+ mRoundnessManager.onAmbientStateChanged(entry, false);
+ Assert.assertEquals(0f, row.getCurrentBottomRoundness(), 0.0f);
+ Assert.assertEquals(0f, row.getCurrentTopRoundness(), 0.0f);
+ }
+
+ @Test
public void testRoundnessSetOnSecondSectionLast() {
mRoundnessManager.updateRoundedChildren(new NotificationSection[]{
createSection(mFirst, mFirst),
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 37814f0..736f384 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
@@ -107,6 +107,7 @@
@Mock private NotificationRemoteInputManager mRemoteInputManager;
@Mock private RemoteInputController mRemoteInputController;
@Mock private MetricsLogger mMetricsLogger;
+ @Mock private NotificationRoundnessManager mNotificationRoundnessManager;
private TestableNotificationEntryManager mEntryManager;
private int mOriginalInterruptionModelSetting;
@@ -140,7 +141,7 @@
// holds a copy of the CUT's instances of these classes, so they still refer to the CUT's
// member variables, not the spy's member variables.
mStackScrollerInternal = new NotificationStackScrollLayout(getContext(), null,
- true /* allowLongPress */);
+ true /* allowLongPress */, mNotificationRoundnessManager);
mStackScroller = spy(mStackScrollerInternal);
mStackScroller.setShelf(notificationShelf);
mStackScroller.setStatusBar(mBar);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
index 27ed9c5..cd52e87 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
@@ -47,7 +47,6 @@
private float mPanelExpansion;
private int mKeyguardStatusHeight;
private float mDark;
- private boolean mPulsing;
@Before
public void setUp() {
@@ -208,20 +207,6 @@
}
@Test
- public void notifPositionWhilePulsingOnAOD() {
- // GIVEN on AOD and pulsing
- givenAOD();
- mNotificationStackHeight = EMPTY_HEIGHT;
- mKeyguardStatusHeight = EMPTY_HEIGHT;
- mPulsing = true;
- mClockPositionAlgorithm.setPulsingPadding(200);
- // WHEN the clock position algorithm is run
- positionClock();
- // THEN the notif padding doesn't adjust for pulsing.
- assertThat(mClockPosition.stackScrollerPadding).isEqualTo(1000);
- }
-
- @Test
public void notifPositionMiddleOfScreenOnLockScreen() {
// GIVEN on lock screen and both stack scroll and clock have 0 height
givenLockScreen();
@@ -307,20 +292,6 @@
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
}
- @Test
- public void notifPositionWhilePulsingOnLockScreen() {
- // GIVEN on lock screen and pulsing
- givenLockScreen();
- mNotificationStackHeight = EMPTY_HEIGHT;
- mKeyguardStatusHeight = EMPTY_HEIGHT;
- mPulsing = true;
- mClockPositionAlgorithm.setPulsingPadding(200);
- // WHEN the clock position algorithm is run
- positionClock();
- // THEN the notif padding adjusts for pulsing.
- assertThat(mClockPosition.stackScrollerPadding).isEqualTo(1200);
- }
-
private void givenAOD() {
mPanelExpansion = 1.f;
mDark = 1.f;
@@ -334,7 +305,7 @@
private void positionClock() {
mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mNotificationStackHeight,
mPanelExpansion, SCREEN_HEIGHT, mKeyguardStatusHeight, mDark, SECURE_LOCKED,
- mPulsing, ZERO_DRAG);
+ ZERO_DRAG);
mClockPositionAlgorithm.run(mClockPosition);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
index 0471d76..c20d37f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
@@ -45,6 +45,7 @@
import com.android.internal.colorextraction.ColorExtractor.GradientColors;
import com.android.internal.util.function.TriConsumer;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.doze.DozeLog;
import com.android.systemui.statusbar.ScrimView;
import com.android.systemui.util.wakelock.WakeLock;
import com.android.systemui.utils.os.FakeHandler;
@@ -133,10 +134,11 @@
// Back scrim should be transparent
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
- // Move on to PULSING and check if the back scrim was updated
+ // Pulsing notification should conserve AOD wallpaper.
+ mScrimController.setPulseReason(DozeLog.PULSE_REASON_NOTIFICATION);
mScrimController.transitionTo(ScrimState.PULSING);
mScrimController.finishAnimationsImmediately();
- assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_SEMI_TRANSPARENT);
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
}
@Test
@@ -218,6 +220,7 @@
mScrimController.finishAnimationsImmediately();
assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
+ mScrimController.setPulseReason(DozeLog.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN);
mScrimController.transitionTo(ScrimState.PULSING);
mScrimController.finishAnimationsImmediately();
// Front scrim should be transparent
@@ -477,12 +480,8 @@
@Test
public void testHoldsPulsingWallpaperAnimationLock() {
// Pre-conditions
- mScrimController.transitionTo(ScrimState.PULSING, new ScrimController.Callback() {
- @Override
- public boolean isFadeOutWallpaper() {
- return true;
- }
- });
+ mScrimController.setPulseReason(DozeLog.PULSE_REASON_NOTIFICATION);
+ mScrimController.transitionTo(ScrimState.PULSING);
mScrimController.finishAnimationsImmediately();
reset(mWakeLock);
@@ -491,7 +490,6 @@
verify(mWakeLock, never()).release();
mScrimController.finishAnimationsImmediately();
verify(mWakeLock).release();
- assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
}
@Test
@@ -504,31 +502,27 @@
}
@Test
- public void testWillHidePulsingWallpaper_withRequestFadeOut() {
- mScrimController.setWallpaperSupportsAmbientMode(true);
- mScrimController.transitionTo(ScrimState.PULSING, new ScrimController.Callback() {
- @Override
- public boolean isFadeOutWallpaper() {
- return true;
- }
- });
- verify(mAlarmManager).setExact(anyInt(), anyLong(), any(), any(), any());
- mScrimController.transitionTo(ScrimState.KEYGUARD);
- verify(mAlarmManager).cancel(any(AlarmManager.OnAlarmListener.class));
- }
-
- @Test
- public void testDoesNotHidePulsingWallpaper_withoutRequestFadeOut() {
- mScrimController.setWallpaperSupportsAmbientMode(true);
- mScrimController.transitionTo(ScrimState.PULSING, new ScrimController.Callback() {});
- verify(mAlarmManager, never()).setExact(anyInt(), anyLong(), any(), any(), any());
- }
-
- @Test
- public void testDoesNotHidePulsingWallpaper_withoutCallback() {
- mScrimController.setWallpaperSupportsAmbientMode(true);
+ public void testWillHidePulsingWallpaper_whenNotification() {
+ mScrimController.setWallpaperSupportsAmbientMode(false);
+ mScrimController.transitionTo(ScrimState.AOD);
+ mScrimController.finishAnimationsImmediately();
+ mScrimController.setPulseReason(DozeLog.PULSE_REASON_NOTIFICATION);
mScrimController.transitionTo(ScrimState.PULSING);
- verify(mAlarmManager, never()).setExact(anyInt(), anyLong(), any(), any(), any());
+ mScrimController.finishAnimationsImmediately();
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
+ assertScrimTint(mScrimBehind, true);
+ }
+
+ @Test
+ public void testWillHidePulsingWallpaper_whenDocking() {
+ mScrimController.setWallpaperSupportsAmbientMode(false);
+ mScrimController.transitionTo(ScrimState.AOD);
+ mScrimController.finishAnimationsImmediately();
+ mScrimController.setPulseReason(DozeLog.PULSE_REASON_DOCKING);
+ mScrimController.transitionTo(ScrimState.PULSING);
+ mScrimController.finishAnimationsImmediately();
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
+ assertScrimTint(mScrimBehind, true);
}
@Test