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/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();
}