Fixed a bug where notifications could stay dark
The check whether dark changed was always done on the notification itself, ignoring that the contentviews actually also have a check whether it changed, leading to potential problems that this state became out of date. In addition did we assume that whenever an update comes in the text becomes normal, which is not true for an inline update. This hopefully fixes things once and for all! I said once and for all! Bug: 27147160 Change-Id: Idd68be8da0f648cf79102544b038065618c1d0ff
This commit is contained in:
@@ -584,11 +584,7 @@ public class NotificationContentView extends FrameLayout {
|
||||
}
|
||||
|
||||
public void setDark(boolean dark, boolean fade, long delay) {
|
||||
setDark(dark, fade, delay, false /* force */);
|
||||
}
|
||||
|
||||
public void setDark(boolean dark, boolean fade, long delay, boolean force) {
|
||||
if ((!force && mDark == dark) || mContractedChild == null) {
|
||||
if (mContractedChild == null) {
|
||||
return;
|
||||
}
|
||||
mDark = dark;
|
||||
@@ -645,7 +641,7 @@ public class NotificationContentView extends FrameLayout {
|
||||
if (mHeadsUpChild != null) {
|
||||
mHeadsUpWrapper.notifyContentUpdated(entry.notification);
|
||||
}
|
||||
setDark(mDark, false /* animate */, 0 /* delay */, true /* force */);
|
||||
setDark(mDark, false /* animate */, 0 /* delay */);
|
||||
}
|
||||
|
||||
private void updateSingleLineView() {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class NotificationCustomViewWrapper extends NotificationViewWrapper {
|
||||
|
||||
@Override
|
||||
public void setDark(boolean dark, boolean fade, long delay) {
|
||||
if (dark == mDark) {
|
||||
if (dark == mDark && mDarkInitialized) {
|
||||
return;
|
||||
}
|
||||
super.setDark(dark, fade, delay);
|
||||
|
||||
@@ -148,7 +148,7 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
|
||||
|
||||
@Override
|
||||
public void setDark(boolean dark, boolean fade, long delay) {
|
||||
if (dark == mDark) {
|
||||
if (dark == mDark && mDarkInitialized) {
|
||||
return;
|
||||
}
|
||||
super.setDark(dark, fade, delay);
|
||||
|
||||
@@ -163,7 +163,7 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp
|
||||
|
||||
@Override
|
||||
public void setDark(boolean dark, boolean fade, long delay) {
|
||||
if (dark == mDark) {
|
||||
if (dark == mDark && mDarkInitialized) {
|
||||
return;
|
||||
}
|
||||
super.setDark(dark, fade, delay);
|
||||
|
||||
@@ -32,6 +32,7 @@ public abstract class NotificationViewWrapper implements TransformableView {
|
||||
|
||||
protected final View mView;
|
||||
protected boolean mDark;
|
||||
protected boolean mDarkInitialized = false;
|
||||
|
||||
public static NotificationViewWrapper wrap(Context ctx, View v) {
|
||||
if (v.getId() == com.android.internal.R.id.status_bar_latest_event_content) {
|
||||
@@ -61,6 +62,7 @@ public abstract class NotificationViewWrapper implements TransformableView {
|
||||
*/
|
||||
public void setDark(boolean dark, boolean fade, long delay) {
|
||||
mDark = dark;
|
||||
mDarkInitialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +70,7 @@ public abstract class NotificationViewWrapper implements TransformableView {
|
||||
* @param notification
|
||||
*/
|
||||
public void notifyContentUpdated(StatusBarNotification notification) {
|
||||
mDark = false;
|
||||
mDarkInitialized = false;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user