Remove number code from StatusBarIconView
We had this to show an overlay with a number on notifications, but we
disabled that 13 years ago (ag/123288). This removes the dead code and
related resources that aren't used elsewhere.
I wanted to also remove ic_notification_overlay since we're not using
it, but it's technically a public resource and is used in some external
projects so that's probably not safe to do.
Similarly, two other resources are public so I just marked them as
deprecated to make it clear we don't want to use them anymore.
Bug: 315143361
Test: builds
Flag: EXEMPT removing dead code
Change-Id: I30e6c624b90c808e58f1c5c60b502517ef0011f7
diff --git a/core/api/current.txt b/core/api/current.txt
index 244cad0..1dcffe6 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -2456,7 +2456,7 @@
field public static final int config_longAnimTime = 17694722; // 0x10e0002
field public static final int config_mediumAnimTime = 17694721; // 0x10e0001
field public static final int config_shortAnimTime = 17694720; // 0x10e0000
- field public static final int status_bar_notification_info_maxnum = 17694723; // 0x10e0003
+ field @Deprecated public static final int status_bar_notification_info_maxnum = 17694723; // 0x10e0003
}
public static final class R.interpolator {
@@ -2550,7 +2550,7 @@
field public static final int search_go = 17039372; // 0x104000c
field public static final int selectAll = 17039373; // 0x104000d
field public static final int selectTextMode = 17039382; // 0x1040016
- field public static final int status_bar_notification_info_overflow = 17039383; // 0x1040017
+ field @Deprecated public static final int status_bar_notification_info_overflow = 17039383; // 0x1040017
field public static final int unknownName = 17039374; // 0x104000e
field public static final int untitled = 17039375; // 0x104000f
field @Deprecated public static final int yes = 17039379; // 0x1040013
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index f43351a..66b5557 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2633,10 +2633,7 @@
If false, not supported. -->
<bool name="config_duplicate_port_omadm_wappush">false</bool>
- <!-- Maximum numerical value that will be shown in a status bar
- notification icon or in the notification itself. Will be replaced
- with @string/status_bar_notification_info_overflow when shown in the
- UI. -->
+ <!-- @deprecated No longer used. -->
<integer name="status_bar_notification_info_maxnum">999</integer>
<!-- Path to an ISO image to be shared with via USB mass storage.
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index b547a7a..f5aed36 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -788,11 +788,7 @@
<!-- label for item that locks the phone and enforces that it can't be unlocked without strong authentication. [CHAR LIMIT=24] -->
<string name="global_action_lockdown">Lockdown</string>
- <!-- Text to use when the number in a notification info is too large
- (greater than status_bar_notification_info_maxnum, defined in
- values/config.xml) and must be truncated. May need to be localized
- for most appropriate textual indicator of "more than X".
- [CHAR LIMIT=4] -->
+ <!-- @deprecated No longer used. -->
<string name="status_bar_notification_info_overflow">999+</string>
<!-- The divider symbol between different parts of the notification header. not translatable [CHAR LIMIT=1] -->
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index ba59c2f9..b3d3021 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -18,7 +18,6 @@
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <drawable name="notification_number_text_color">#ffffffff</drawable>
<drawable name="system_bar_background">@color/system_bar_background_opaque</drawable>
<color name="system_bar_background_opaque">#ff000000</color>
<color name="system_bar_background_transparent">#00000000</color>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index f8762f0..95584eb 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -25,9 +25,6 @@
(package/class) -->
<string name="config_recentsComponent" translatable="false">com.android.systemui.recents.OverviewProxyRecentsImpl</string>
- <!-- Whether or not we show the number in the bar. -->
- <bool name="config_statusBarShowNumber">false</bool>
-
<!-- For how long the lock screen can be on before the display turns off. -->
<integer name="config_lockScreenDisplayTimeout">10000</integer>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index d0702fc..bbf0ae1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -69,7 +69,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -148,11 +147,6 @@
@VisibleForTesting float mScaleToFitNewIconSize = 1;
private StatusBarIcon mIcon;
@ViewDebug.ExportedProperty private String mSlot;
- private Drawable mNumberBackground;
- private Paint mNumberPain;
- private int mNumberX;
- private int mNumberY;
- private String mNumberText;
private StatusBarNotification mNotification;
private final boolean mBlocked;
private Configuration mConfiguration;
@@ -201,10 +195,6 @@
mDozer = new NotificationDozeHelper();
mBlocked = blocked;
mSlot = slot;
- mNumberPain = new Paint();
- mNumberPain.setTextAlign(Paint.Align.CENTER);
- mNumberPain.setColor(context.getColor(R.drawable.notification_number_text_color));
- mNumberPain.setAntiAlias(true);
setNotification(sbn);
setScaleType(ScaleType.CENTER);
mConfiguration = new Configuration(context.getResources().getConfiguration());
@@ -410,8 +400,6 @@
&& mIcon.iconLevel == icon.iconLevel;
final boolean visibilityEquals = mIcon != null
&& mIcon.visible == icon.visible;
- final boolean numberEquals = mIcon != null
- && mIcon.number == icon.number;
mIcon = icon.clone();
setContentDescription(icon.contentDescription);
if (!iconEquals) {
@@ -425,20 +413,6 @@
setImageLevel(icon.iconLevel);
}
- if (!numberEquals) {
- if (icon.number > 0 && getContext().getResources().getBoolean(
- R.bool.config_statusBarShowNumber)) {
- if (mNumberBackground == null) {
- mNumberBackground = getContext().getResources().getDrawable(
- R.drawable.ic_notification_overlay);
- }
- placeNumber();
- } else {
- mNumberBackground = null;
- mNumberText = null;
- }
- invalidate();
- }
if (!visibilityEquals) {
setVisibility(icon.visible && !mBlocked ? VISIBLE : GONE);
}
@@ -568,14 +542,6 @@
}
@Override
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
- super.onSizeChanged(w, h, oldw, oldh);
- if (mNumberBackground != null) {
- placeNumber();
- }
- }
-
- @Override
public void onRtlPropertiesChanged(int layoutDirection) {
super.onRtlPropertiesChanged(layoutDirection);
updateDrawable();
@@ -609,10 +575,6 @@
canvas.restore();
}
- if (mNumberBackground != null) {
- mNumberBackground.draw(canvas);
- canvas.drawText(mNumberText, mNumberX, mNumberY, mNumberPain);
- }
if (mDotAppearAmount != 0.0f) {
float radius;
float alpha = Color.alpha(mDecorColor) / 255.f;
@@ -640,39 +602,6 @@
Log.d("View", debugIndent(depth) + "icon=" + mIcon);
}
- void placeNumber() {
- final String str;
- final int tooBig = getContext().getResources().getInteger(
- android.R.integer.status_bar_notification_info_maxnum);
- if (mIcon.number > tooBig) {
- str = getContext().getResources().getString(
- android.R.string.status_bar_notification_info_overflow);
- } else {
- NumberFormat f = NumberFormat.getIntegerInstance();
- str = f.format(mIcon.number);
- }
- mNumberText = str;
-
- final int w = getWidth();
- final int h = getHeight();
- final Rect r = new Rect();
- mNumberPain.getTextBounds(str, 0, str.length(), r);
- final int tw = r.right - r.left;
- final int th = r.bottom - r.top;
- mNumberBackground.getPadding(r);
- int dw = r.left + tw + r.right;
- if (dw < mNumberBackground.getMinimumWidth()) {
- dw = mNumberBackground.getMinimumWidth();
- }
- mNumberX = w-r.right-((dw-r.right-r.left)/2);
- int dh = r.top + th + r.bottom;
- if (dh < mNumberBackground.getMinimumWidth()) {
- dh = mNumberBackground.getMinimumWidth();
- }
- mNumberY = h-r.bottom-((dh-r.top-th-r.bottom)/2);
- mNumberBackground.setBounds(w-dw, h-dh, w, h);
- }
-
@Override
public String toString() {
return "StatusBarIconView("