Hiding the children backgrounds now
To avoid overdraw we are now hiding
the background of the view if it has
the same color.
Bug: 24866646
Change-Id: Ie998c9d2e6055d8e88f33300583a4b86bf35362f
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
index 2e3e00c..147c3db 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
@@ -340,7 +340,7 @@
return;
}
mDark = dark;
- if (!dark && fade) {
+ if (!dark && fade && !shouldHideBackground()) {
if (mActivated) {
mBackgroundDimmed.setVisibility(View.VISIBLE);
mBackgroundNormal.setVisibility(View.VISIBLE);
@@ -428,10 +428,12 @@
private void fadeDimmedBackground() {
mBackgroundDimmed.animate().cancel();
mBackgroundNormal.animate().cancel();
- if (mDimmed) {
- mBackgroundDimmed.setVisibility(View.VISIBLE);
- } else {
- mBackgroundNormal.setVisibility(View.VISIBLE);
+ if (!shouldHideBackground()) {
+ if (mDimmed) {
+ mBackgroundDimmed.setVisibility(View.VISIBLE);
+ } else {
+ mBackgroundNormal.setVisibility(View.VISIBLE);
+ }
}
float startAlpha = mDimmed ? 1f : 0;
float endAlpha = mDimmed ? 0 : 1f;
@@ -466,9 +468,9 @@
mBackgroundAnimator.start();
}
- private void updateBackground() {
+ protected void updateBackground() {
cancelFadeAnimations();
- if (mDark) {
+ if (shouldHideBackground()) {
mBackgroundDimmed.setVisibility(View.INVISIBLE);
mBackgroundNormal.setVisibility(View.INVISIBLE);
} else if (mDimmed) {
@@ -482,6 +484,10 @@
}
}
+ protected boolean shouldHideBackground() {
+ return mDark;
+ }
+
private void cancelFadeAnimations() {
if (mBackgroundAnimator != null) {
mBackgroundAnimator.cancel();
@@ -676,7 +682,7 @@
protected abstract View getContentView();
- private int getBgColor() {
+ public int getBgColor() {
if (mBgTint != 0) {
return mBgTint;
} else if (mShowingLegacyBackground) {
@@ -739,6 +745,10 @@
setBelowSpeedBump(false);
}
+ public boolean hasSameBgColor(ActivatableNotificationView otherView) {
+ return getBgColor() == otherView.getBgColor();
+ }
+
public interface OnActivatedListener {
void onActivated(ActivatableNotificationView view);
void onActivationReset(ActivatableNotificationView view);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index fbd6477..026c5f7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -16,7 +16,6 @@
package com.android.systemui.statusbar;
-import android.app.Notification;
import android.content.Context;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.AnimationDrawable;
@@ -35,7 +34,6 @@
import com.android.systemui.R;
import com.android.systemui.classifier.FalsingManager;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
-import com.android.systemui.statusbar.phone.PhoneStatusBar;
import com.android.systemui.statusbar.stack.NotificationChildrenContainer;
import com.android.systemui.statusbar.notification.NotificationHeaderView;
import com.android.systemui.statusbar.stack.StackScrollState;
@@ -104,6 +102,7 @@
private boolean mJustClicked;
private NotificationData.Entry mEntry;
+ private boolean mShowNoBackground;
private boolean mChildInGroup;
public NotificationContentView getPrivateLayout() {
@@ -225,6 +224,13 @@
*/
public void setIsChildInGroup(boolean isChildInGroup, ExpandableNotificationRow parent) {
mChildInGroup = BaseStatusBar.ENABLE_CHILD_NOTIFICATIONS && isChildInGroup;
+ mShowNoBackground = mChildInGroup && hasSameBgColor(parent);
+ updateBackground();
+ }
+
+ @Override
+ protected boolean shouldHideBackground() {
+ return super.shouldHideBackground() || mShowNoBackground;
}
@Override