From 4ca6c63c96c23d47e9f35c333a2568a2f3feb9e6 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Thu, 23 Feb 2017 18:03:37 -0800 Subject: [PATCH] Worked around a bug where the view could render blank Heads up notifications could render blank due to a bug with invalidation. This works around this issue by manually invalidating the parent. Change-Id: I858d1c95bc936f5b14fc3485b2d54d76717c2537 Fixes: 34660898 --- .../systemui/statusbar/ExpandableNotificationRow.java | 11 +++++++++++ .../systemui/statusbar/NotificationContentView.java | 3 ++- .../statusbar/phone/NotificationIconContainer.java | 6 ------ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index b4c1af7f9f0f9..8274b9a74612c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -39,6 +39,7 @@ import android.view.MotionEvent; import android.view.NotificationHeaderView; import android.view.View; import android.view.ViewGroup; +import android.view.ViewParent; import android.view.ViewStub; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; @@ -1748,7 +1749,17 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { @Override public void setActualHeight(int height, boolean notifyListeners) { + boolean changed = height != getActualHeight(); super.setActualHeight(height, notifyListeners); + if (changed && isRemoved()) { + // TODO: remove this once we found the gfx bug for this. + // This is a hack since a removed view sometimes would just stay blank. it occured + // when sending yourself a message and then clicking on it. + ViewGroup parent = (ViewGroup) getParent(); + if (parent != null) { + parent.invalidate(); + } + } if (mGuts != null && mGuts.isExposed()) { mGuts.setActualHeight(height); return; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index 8c39a763f93e0..2eb0817264a10 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -1184,7 +1184,8 @@ public class NotificationContentView extends FrameLayout { mExpandable = expandable; // if the expanded child has the same height as the collapsed one we hide it. if (mExpandedChild != null && mExpandedChild.getHeight() != 0) { - if (!mIsHeadsUp || mHeadsUpChild == null || mContainingNotification.isOnKeyguard()) { + if ((!mIsHeadsUp && !mHeadsUpAnimatingAway) + || mHeadsUpChild == null || mContainingNotification.isOnKeyguard()) { if (mExpandedChild.getHeight() == mContractedChild.getHeight()) { expandable = false; } 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 dc5f98c13c6ab..f017eb1f18c48 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java @@ -524,11 +524,5 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { iconColor = ((StatusBarIconView) view).getStaticDrawableColor(); } } - - protected void onYTranslationAnimationFinished(View view) { - if (hidden) { - view.setVisibility(INVISIBLE); - } - } } }