Fixed a bug that the notifications were not animating when reset
Also made sure that the touch event is never filtered when its a
heads up view.
Bug: 18188693
Change-Id: Ic5de3e36c785d2cf890936322820b739a0a1b107
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 09d0b5d..5180c91 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -59,7 +59,6 @@
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.util.Log;
-import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.view.Display;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index a4e5e74..f8332ea 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -22,6 +22,7 @@
import android.graphics.drawable.Drawable;
import android.service.notification.StatusBarNotification;
import android.util.AttributeSet;
+import android.view.MotionEvent;
import android.view.View;
import android.view.ViewStub;
import android.view.accessibility.AccessibilityEvent;
@@ -68,6 +69,7 @@
private NotificationGuts mGuts;
private StatusBarNotification mStatusBarNotification;
+ private boolean mIsHeadsUp;
public void setIconAnimationRunning(boolean running) {
setIconAnimationRunning(running, mPublicLayout);
@@ -122,6 +124,10 @@
return mStatusBarNotification;
}
+ public void setHeadsUp(boolean isHeadsUp) {
+ mIsHeadsUp = isHeadsUp;
+ }
+
public interface ExpansionLogger {
public void logNotificationExpansion(String key, boolean userAction, boolean expanded);
}
@@ -147,14 +153,16 @@
mShowingPublicInitialized = false;
mIsSystemExpanded = false;
mExpansionDisabled = false;
- mPublicLayout.reset();
- mPrivateLayout.reset();
+ mPublicLayout.reset(mIsHeadsUp);
+ mPrivateLayout.reset(mIsHeadsUp);
resetHeight();
logExpansionEvent(false, wasExpanded);
}
public void resetHeight() {
- super.resetHeight();
+ if (mIsHeadsUp) {
+ resetActualHeight();
+ }
mMaxExpandHeight = 0;
mWasReset = true;
onHeightReset();
@@ -162,6 +170,11 @@
}
@Override
+ protected boolean filterMotionEvent(MotionEvent event) {
+ return mIsHeadsUp || super.filterMotionEvent(event);
+ }
+
+ @Override
protected void onFinishInflate() {
super.onFinishInflate();
mPublicLayout = (NotificationContentView) findViewById(R.id.expandedPublic);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
index edfbe86..bf1e78e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
@@ -103,9 +103,13 @@
}
}
- protected void resetHeight() {
+ /**
+ * Resets the height of the view on the next layout pass
+ */
+ protected void resetActualHeight() {
mActualHeight = 0;
mActualHeightInitialized = false;
+ requestLayout();
}
protected int getInitialHeight() {
@@ -120,7 +124,7 @@
return false;
}
- private boolean filterMotionEvent(MotionEvent event) {
+ protected boolean filterMotionEvent(MotionEvent event) {
return event.getActionMasked() != MotionEvent.ACTION_DOWN
|| event.getY() > mClipTopAmount && event.getY() < mActualHeight;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index 9b11f9b..99214a0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -74,7 +74,7 @@
public NotificationContentView(Context context, AttributeSet attrs) {
super(context, attrs);
mFadePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
- reset();
+ reset(true);
}
@Override
@@ -89,7 +89,7 @@
updateVisibility();
}
- public void reset() {
+ public void reset(boolean resetActualHeight) {
if (mContractedChild != null) {
mContractedChild.animate().cancel();
}
@@ -100,8 +100,10 @@
mContractedChild = null;
mExpandedChild = null;
mSmallHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height);
- mActualHeight = mSmallHeight;
mContractedVisible = true;
+ if (resetActualHeight) {
+ mActualHeight = mSmallHeight;
+ }
}
public View getContractedChild() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
index 84216a4..6e779a3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
@@ -102,6 +102,7 @@
if (mHeadsUp != null) {
mHeadsUp.row.setSystemExpanded(true);
mHeadsUp.row.setSensitive(false);
+ mHeadsUp.row.setHeadsUp(true);
mHeadsUp.row.setHideSensitive(
false, false /* animated */, 0 /* delay */, 0 /* duration */);
if (mContentHolder == null) {