diff options
author | Jeff DeCew <jeffdq@google.com> | 2021-07-09 00:12:59 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-07-09 00:12:59 +0000 |
commit | 82a1baf813dd622846f9fb946ec247f738fbe0c4 (patch) | |
tree | a76f616f5dbe5042596841672b5a125f02032525 | |
parent | 55d8797628c23c33aaf14e6c94f32cca1b49721d (diff) | |
parent | 1bac76c51b08b8a472b69a497981ad8cc3ddb990 (diff) |
Merge "Delete dead code which had adverse performance impact." into sc-dev
4 files changed, 0 insertions, 69 deletions
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index d1ed2a852d38..f5d47ce9698c 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -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> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapper.java index 222735aeb35a..4c9c2f95b35c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationCustomViewWrapper.java @@ -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)) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationDecoratedCustomViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationDecoratedCustomViewWrapper.java index d21ae13a1e01..8c6fa023d92b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationDecoratedCustomViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationDecoratedCustomViewWrapper.java @@ -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); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java index 74abd38ec398..76301917b458 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationViewWrapper.java @@ -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; |