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
This commit is contained in:
Selim Cinek
2017-02-23 18:03:37 -08:00
parent c8df064db3
commit 4ca6c63c96
3 changed files with 13 additions and 7 deletions

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -524,11 +524,5 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
iconColor = ((StatusBarIconView) view).getStaticDrawableColor();
}
}
protected void onYTranslationAnimationFinished(View view) {
if (hidden) {
view.setVisibility(INVISIBLE);
}
}
}
}