Merge "Delete dead code which had adverse performance impact." into sc-dev

This commit is contained in:
Jeff DeCew
2021-07-09 00:12:59 +00:00
committed by Android (Google) Code Review
4 changed files with 0 additions and 69 deletions

View File

@@ -442,9 +442,6 @@
vibrator is capable of subtle vibrations --> vibrator is capable of subtle vibrations -->
<bool name="config_vibrateOnIconAnimation">false</bool> <bool name="config_vibrateOnIconAnimation">false</bool>
<!-- Adjust the theme on fully custom and decorated custom view notifications -->
<bool name="config_adjustThemeOnNotificationCustomViews">false</bool>
<!-- Notifications are sized to match the width of two (of 4) qs tiles in landscape. --> <!-- Notifications are sized to match the width of two (of 4) qs tiles in landscape. -->
<bool name="config_skinnyNotifsInLandscape">true</bool> <bool name="config_skinnyNotifsInLandscape">true</bool>

View File

@@ -47,10 +47,6 @@ public class NotificationCustomViewWrapper extends NotificationViewWrapper {
public void onContentUpdated(ExpandableNotificationRow row) { public void onContentUpdated(ExpandableNotificationRow row) {
super.onContentUpdated(row); super.onContentUpdated(row);
// Custom views will most likely use just white or black as their text color.
// We need to scan through and replace these colors by Material NEXT colors.
ensureThemeOnChildren(mView);
// Let's invert the notification colors when we're in night mode and // Let's invert the notification colors when we're in night mode and
// the notification background isn't colorized. // the notification background isn't colorized.
if (needsInversion(mBackgroundColor, mView)) { if (needsInversion(mBackgroundColor, mView)) {

View File

@@ -62,10 +62,6 @@ public class NotificationDecoratedCustomViewWrapper extends NotificationTemplate
public void onContentUpdated(ExpandableNotificationRow row) { public void onContentUpdated(ExpandableNotificationRow row) {
mWrappedView = getWrappedCustomView(mView); mWrappedView = getWrappedCustomView(mView);
// Custom views will most likely use just white or black as their text color.
// We need to scan through and replace these colors by Material NEXT colors.
ensureThemeOnChildren(mWrappedView);
if (needsInversion(resolveBackgroundColor(), mWrappedView)) { if (needsInversion(resolveBackgroundColor(), mWrappedView)) {
invertViewLuminosity(mWrappedView); invertViewLuminosity(mWrappedView);
} }

View File

@@ -30,7 +30,6 @@ import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.util.Pair; import android.util.Pair;
import android.view.ContextThemeWrapper;
import android.view.NotificationHeaderView; import android.view.NotificationHeaderView;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@@ -41,7 +40,6 @@ import com.android.internal.graphics.ColorUtils;
import com.android.internal.util.ContrastColorUtil; import com.android.internal.util.ContrastColorUtil;
import com.android.internal.widget.CachingIconView; import com.android.internal.widget.CachingIconView;
import com.android.settingslib.Utils; import com.android.settingslib.Utils;
import com.android.systemui.R;
import com.android.systemui.statusbar.CrossFadeHelper; import com.android.systemui.statusbar.CrossFadeHelper;
import com.android.systemui.statusbar.TransformableView; import com.android.systemui.statusbar.TransformableView;
import com.android.systemui.statusbar.notification.TransformState; import com.android.systemui.statusbar.notification.TransformState;
@@ -58,11 +56,6 @@ public abstract class NotificationViewWrapper implements TransformableView {
private final Rect mTmpRect = new Rect(); private final Rect mTmpRect = new Rect();
protected int mBackgroundColor = 0; protected int mBackgroundColor = 0;
private int mMaterialTextColorPrimary;
private int mMaterialTextColorSecondary;
private int mThemedTextColorPrimary;
private int mThemedTextColorSecondary;
private boolean mAdjustTheme;
public static NotificationViewWrapper wrap(Context ctx, View v, ExpandableNotificationRow row) { public static NotificationViewWrapper wrap(Context ctx, View v, ExpandableNotificationRow row) {
if (v.getId() == com.android.internal.R.id.status_bar_latest_event_content) { if (v.getId() == com.android.internal.R.id.status_bar_latest_event_content) {
@@ -98,8 +91,6 @@ public abstract class NotificationViewWrapper implements TransformableView {
mView = view; mView = view;
mRow = row; mRow = row;
onReinflated(); onReinflated();
mAdjustTheme = ctx.getResources().getBoolean(
R.bool.config_adjustThemeOnNotificationCustomViews);
} }
/** /**
@@ -124,22 +115,6 @@ public abstract class NotificationViewWrapper implements TransformableView {
mBackgroundColor = backgroundColor; mBackgroundColor = backgroundColor;
mView.setBackground(new ColorDrawable(Color.TRANSPARENT)); mView.setBackground(new ColorDrawable(Color.TRANSPARENT));
} }
Context materialTitleContext = new ContextThemeWrapper(mView.getContext(),
com.android.internal.R.style.TextAppearance_Material_Notification_Title);
mMaterialTextColorPrimary = Utils.getColorAttr(materialTitleContext,
com.android.internal.R.attr.textColor).getDefaultColor();
Context materialContext = new ContextThemeWrapper(mView.getContext(),
com.android.internal.R.style.TextAppearance_Material_Notification);
mMaterialTextColorSecondary = Utils.getColorAttr(materialContext,
com.android.internal.R.attr.textColor).getDefaultColor();
Context themedContext = new ContextThemeWrapper(mView.getContext(),
com.android.internal.R.style.Theme_DeviceDefault_DayNight);
mThemedTextColorPrimary = Utils.getColorAttr(themedContext,
com.android.internal.R.attr.textColorPrimary).getDefaultColor();
mThemedTextColorSecondary = Utils.getColorAttr(themedContext,
com.android.internal.R.attr.textColorSecondary).getDefaultColor();
} }
protected boolean needsInversion(int defaultBackgroundColor, View view) { protected boolean needsInversion(int defaultBackgroundColor, View view) {
@@ -217,39 +192,6 @@ public abstract class NotificationViewWrapper implements TransformableView {
return false; return false;
} }
protected void ensureThemeOnChildren(View rootView) {
if (!mAdjustTheme || mView == null || rootView == null) {
return;
}
// Notifications with custom backgrounds should not be adjusted
if (mBackgroundColor != Color.TRANSPARENT
|| getBackgroundColor(mView) != Color.TRANSPARENT
|| getBackgroundColor(rootView) != Color.TRANSPARENT) {
return;
}
// Now let's check if there's unprotected text somewhere, and apply the theme if we find it.
processTextColorRecursive(rootView);
}
private void processTextColorRecursive(View view) {
if (view instanceof TextView) {
TextView textView = (TextView) view;
int foreground = textView.getCurrentTextColor();
if (foreground == mMaterialTextColorPrimary) {
textView.setTextColor(mThemedTextColorPrimary);
} else if (foreground == mMaterialTextColorSecondary) {
textView.setTextColor(mThemedTextColorSecondary);
}
} else if (view instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) view;
for (int i = 0; i < viewGroup.getChildCount(); i++) {
processTextColorRecursive(viewGroup.getChildAt(i));
}
}
}
protected int getBackgroundColor(View view) { protected int getBackgroundColor(View view) {
if (view == null) { if (view == null) {
return Color.TRANSPARENT; return Color.TRANSPARENT;