Merge "Delete dead code which had adverse performance impact." into sc-dev am: 82a1baf813
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15237650 Change-Id: Id0fb7addd831d89af6b15895dd0c70ffcb830980
This commit is contained in:
@@ -442,9 +442,6 @@
|
||||
vibrator is capable of subtle vibrations -->
|
||||
<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. -->
|
||||
<bool name="config_skinnyNotifsInLandscape">true</bool>
|
||||
|
||||
|
||||
@@ -47,10 +47,6 @@ public class NotificationCustomViewWrapper extends NotificationViewWrapper {
|
||||
public void onContentUpdated(ExpandableNotificationRow 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
|
||||
// the notification background isn't colorized.
|
||||
if (needsInversion(mBackgroundColor, mView)) {
|
||||
|
||||
@@ -62,10 +62,6 @@ public class NotificationDecoratedCustomViewWrapper extends NotificationTemplate
|
||||
public void onContentUpdated(ExpandableNotificationRow row) {
|
||||
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)) {
|
||||
invertViewLuminosity(mWrappedView);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.Pair;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.NotificationHeaderView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -41,7 +40,6 @@ import com.android.internal.graphics.ColorUtils;
|
||||
import com.android.internal.util.ContrastColorUtil;
|
||||
import com.android.internal.widget.CachingIconView;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.statusbar.CrossFadeHelper;
|
||||
import com.android.systemui.statusbar.TransformableView;
|
||||
import com.android.systemui.statusbar.notification.TransformState;
|
||||
@@ -58,11 +56,6 @@ public abstract class NotificationViewWrapper implements TransformableView {
|
||||
private final Rect mTmpRect = new Rect();
|
||||
|
||||
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) {
|
||||
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;
|
||||
mRow = row;
|
||||
onReinflated();
|
||||
mAdjustTheme = ctx.getResources().getBoolean(
|
||||
R.bool.config_adjustThemeOnNotificationCustomViews);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,22 +115,6 @@ public abstract class NotificationViewWrapper implements TransformableView {
|
||||
mBackgroundColor = backgroundColor;
|
||||
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) {
|
||||
@@ -217,39 +192,6 @@ public abstract class NotificationViewWrapper implements TransformableView {
|
||||
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) {
|
||||
if (view == null) {
|
||||
return Color.TRANSPARENT;
|
||||
|
||||
Reference in New Issue
Block a user